PHP code example of mheap / silex-markdown

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

    

mheap / silex-markdown example snippets


$app->register(new \SilexMarkdown\MarkdownExtension());

$app->register(new MarkdownExtension(), array(
    'markdown.features'   => array(
        'header' => false,
    )
));

$app->get('/', function() use($app) {
    $html = $app['markdown']->transform('# Hello World'); // <h1>Hello World</h1>
});

// In your route
$app->get('/', function() use($app) {
    $text = '# Hello World';
    $html = $app['twig']->render('example.twig', array(
        'input' => $text
    ));
});