PHP code example of krisanalfa / bono-markdown
1. Go to this page and download the library: Download krisanalfa/bono-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/ */
krisanalfa / bono-markdown example snippets
'bono.providers' => [
'Bono\\Markdown\\Provider\\MarkdownProvider' => [
'gfm' => true, // activate Github Flavored Markdown
],
],
$app = App::getInstance();
$markdown = '**Markdown is awesome**';
// render markdown syntax
echo $app->container['markdown']->render($markdown);
// render markdown form input
echo $app->container['markdown.form']->renderInput($markdown);
use App\MyCustomViewEngine;
'bono.providers' => [
'Bono\\Markdown\\Provider\\MarkdownProvider' => [
'gfm' => true, // default false
'service' => true, // default false
'endpoint' => '/md-parser', // default '/md'
'requestKeyName' => 'entry', // default 'markdown',
'view' => function () { // default is not set, fallback to Slim\View
return new MyCustomViewEngine;
},
'partialTemplatePath' => 'templates/partials', // default is not set, using our own partials
],
],
'bono.providers' => [
'Bono\\Markdown\\Provider\\MarkdownProvider' => [
'view' => function() {
return new MyCustomViewEngine();
}
],
],
$view = new MyCustomViewEngine();
$app->container['markdown.form']->setView($view); // after this, form should use your custom view engine
$app->container['markdown.form']->renderInput($markdown, '_partials/markdown');