PHP code example of sc0 / parsedown

1. Go to this page and download the library: Download sc0/parsedown 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/ */

    

sc0 / parsedown example snippets


use Sc\Parsedown\Parsedown;

$replacements = [
    'p' => [
        'tag_name' => 'div', // rename <p> to <div>
        'class' => 'paragraph', // add class="paragraph" attribute to div
        'data-foo' => 'bar', // add data-foo="bar" attribute to div
    ],
    'em' => [
        'class' => 'em', // don't rename tag, just add class="em" attribute to em
    ],
];
$Parsedown = new Parsedown($replacements);

echo $Parsedown->text('Hello _Parsedown_!'); # prints: <div class="paragraph" data-foo="bar">Hello <em class="em">Parsedown</em>!</div>

 php
use Sc\Parsedown\Parsedown;

$Parsedown = new Parsedown();

echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>