PHP code example of patrickrose / markdown-extender

1. Go to this page and download the library: Download patrickrose/markdown-extender library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

patrickrose / markdown-extender example snippets



$markdown = new PatrickRose\MarkdownExtender\MarkdownExtender;
$string = "I really like this youtube video!

[{youtube:BgAdeuxkUyY}]

And I added an extension:

[{extended:one,two,3}]";

$markdown->extend("extended", function($one,$two,$three) {
    return "You passed in <em>$one</em>, <em>$two</em> and <em>$three</em>.";
});

$markdown->compile($string)

/* returns:
"<p>I really like this youtube video!</p>

<p><iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/BgAdeuxkUyY\" frameborder=\"0\" allowfullscreen></iframe></p>

<p>And I added an extension:</p>

<p>You passed in <em>one</em>, <em>two</em> and <em>3</em>.</p>"
*/


"providers" => [
    ...
    "PatrickRose\\MarkdownExtender\\MarkdownExtenderServiceProvider",
]


"aliases" => [
    ...
    "MarkdownExtender" => "PatrickRose\\MarkdownExtender\\Facades\\MarkdownExtender"
]