Markdown Widget for Yii2
Widget based on simplemde-markdown-editor
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist wonail/yii2-markdown "*"
or add
"wonail/yii2-markdown": "*"
to the require section of your composer.json.
Once the extension is installed, simply add widget to your page as follows:
1) Usage with ActiveForm and model
<?= $form->field($model, 'content')->widget(\wonail\markdown\MarkdownEditor::class, [
'editorOptions' => [
'showIcons' => ["code", "table"],
'spellChecker' => false,
],
]); ?>
2) Usage without ActiveForm and model
<?= \wonail\markdown\MarkdownEditor::widget([
'name' => 'markdown-editor',
'editorOptions' => [
'showIcons' => ["code", "table"],
'autofocus' => true,
'spellChecker' => false,
],
]);
?>
You can find them on the options page