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