1. Go to this page and download the library: Download skeeks/yii2-kartik-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/ */
'modules' = [
'markdown' => [
// the module class
'class' => 'kartik\markdown\Module',
// the controller action route used for markdown editor preview
'previewAction' => '/markdown/parse/preview',
// the list of custom conversion patterns for post processing
'customConversion' => [
'<table>' => '<table class="table table-bordered table-striped">'
],
// whether to use PHP SmartyPantsTypographer to process Markdown output
'smartyPants' => true
]
/* other modules */
];
use kartik\markdown\Markdown;
// default call
echo Markdown::convert($content);
// with custom post processing
echo Markdown::convert($content, ['custom' => [
'<h1>' => '<h1 class="custom-h1>',
'<h2>' => '<h1 class="custom-h2>',
]]);
// add this in your view
use kartik\markdown\MarkdownEditor;
// usage with model
echo MarkdownEditor::widget([
'model' => $model,
'attribute' => 'markdown',
]);
// usage without model
echo MarkdownEditor::widget([
'name' => 'markdown',
'value' => $value,
]);
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.