PHP code example of axllent / silverstripe-simplemde-markdown

1. Go to this page and download the library: Download axllent/silverstripe-simplemde-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/ */

    

axllent / silverstripe-simplemde-markdown example snippets


class MyMarkdownPage extends Page
{
    public static $db = array(
        'MarkdownContent'=>'Markdown'
    );

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $editor = SimpleMDEEditor::create('MarkdownContent', 'Page Content (Markdown)');
        $fields->addFieldToTab('Root.Main', $editor);

        return $fields;
    }
}