This module adds a field and a data type that allows for Markdown editing in the CMS using the Github Flavoured Markdown parser Parsedown to render the html.
It is integrated with the Ace editor for CMS editing.
Silverstripe-gfmarkdown is strongly based on silverstripe-markdown.
- SilverStripe 3.x
Use the Markdown data type as your fields data type, then use the MarkdownEditor field in the CMS for editing.
class MyPage extends Page {
public static $db=array(
'MarkdownContent'=>'Markdown'
);
public function getCMSFields() {
$fields=parent::getCMSFields();
$editor = new MarkdownEditor('MarkdownContent', 'Page Content (Markdown)');
$editor->setRows(15); //optional, set number of rows in CMS
$editor->setWrapMode(true); //optional, turn on word wrapping
$fields->addFieldToTab("Root.Main", $editor);
return $fields;
}
}
<div class="content">
$MarkdownContent <!-- Will show as rendered html -->
</div>