GitHub Flavored Markdown editing & rendering using Parsedown
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 includes the Ace editor for CMS editing.
composer require axllent/silverstripe-gfmarkdown
Use the Markdown data type as your fields data type, and the MarkdownEditor field in the CMS for editing.
<?php
use Axllent\Gfmarkdown\Forms\MarkdownEditor;
class MyPage extends Page
{
public static $db = array(
'MarkdownContent' => 'Markdown'
);
public function getCMSFields()
{
$fields = parent::getCMSFields();
// If you want the Ace markdown editor in the CMS
$fields->addFieldToTab('Root.Main',
MarkdownEditor::create('MarkdownContent')
->setTheme('github') // set theme
->setRows(20) // set number of rows in CMS
->setWrap(false) // disable word wrapping
->setHighlightActiveLine(true) // enable line highlighting
);
return $fields;
}
}
<div class="content">
$MarkdownContent <!-- Will show as rendered html -->
</div>
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem