PHP code example of davidepastore / slim-markdown-view

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

    

davidepastore / slim-markdown-view example snippets


use \DavidePastore\Slim\Views\MarkdownRenderer;

ntainer();
$container['renderer'] = new MarkdownRenderer("./templates");

$app->get('/hello/', function ($request, $response) {
    return $this->renderer->render($response, "/hello.md");
});

$app->run();

//Construct the View
$markdownView = new MarkdownRenderer("./path/to/templates");

//Render a file
$response = $markdownView->render(new Response(), "/path/to/template.md");

//Construct the View
$parsedown = Parsedown::instance()->setUrlsLinked(false);
$markdownView = new MarkdownRenderer("./path/to/templates", $parsedown);

//Render a file
$response = $markdownView->render(new Response(), "/path/to/template.md");