PHP code example of axllent / silverstripe-gfmarkdown
1. Go to this page and download the library: Download axllent/silverstripe-gfmarkdown 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-gfmarkdown example snippets
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;
}
}