Giter Site home page Giter Site logo

minimalic / silverstripe-gfmarkdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from axllent/silverstripe-gfmarkdown

0.0 0.0 0.0 260 KB

GitHub Flavored Markdown editing & rendering using Parsedown for Silverstripe

License: MIT License

JavaScript 27.06% PHP 68.33% CSS 4.61%

silverstripe-gfmarkdown's Introduction

Github Flavoured Markdown for Silverstripe

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.

Requirements

  • Silverstripe ^4.0 || ^5.0

Installation

composer require axllent/silverstripe-gfmarkdown

Usage

Use the Markdown data type as your fields data type, and the MarkdownEditor field in the CMS for editing.

Example:

<?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;
    }
}

Silverstripe Template:

<div class="content">
    $MarkdownContent  <!-- Will show as rendered html -->
</div>

silverstripe-gfmarkdown's People

Contributors

axllent avatar minimalic avatar robbieaverill avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.