PHP code example of hector68 / yii2-grafikart-markdown-editor

1. Go to this page and download the library: Download hector68/yii2-grafikart-markdown-editor 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/ */

    

hector68 / yii2-grafikart-markdown-editor example snippets


    'modules' => [
        'markdown-editor' => [
            'class' => 'Hector68\GrafikartMarkdownEditor\Module',
            'uploadDir' => '@webroot/images/markdown',
            'isFileNameUnique' => true, //set unique name or use base name,
            'maxSize' => 2097152, // in bites, Default 2mb
            'expansions' => ['jpg', 'png'] 
        ],
    ],
    ...

  <?= $form->field($model, 'firstMessage')->widget(Hector68\GrafikartMarkdownEditor\widgets\MdEditor::className(), [
            'uploader' => Url::to(['markdown-editor/upload/data']), //or false. Default false
            'preview' => true, // default false,
            'jsOptions' => [], // js options of widget. See https://github.com/Grafikart/JS-Markdown-Editor,
            'images' => [], //Default images See https://github.com/Grafikart/JS-Markdown-Editor,
        ]) 

$parser = new cebe\markdown\Markdown();
echo $parser->parse($model->firstMessage);