skeeks/yii2-kartik-markdown Advanced Markdown editing and conversion utilities for Yii Framework 2.0

extensionbootstrapjqueryeditorforminputmarkdownconverter

yii2-markdown

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

This module provides Markdown Editing and Conversion utilities for Yii Framework 2.0. It implements markdown conversion using PHP Markdown Extra and PHP Smarty Pants. In addition, you can customize the flavor of Markdown, by including additional custom conversion patterns. The module also includes an enhanced customized Markdown Editor Widget for markdown editing and preview at runtime. This widget is styled using Bootstrap 3.0. View a complete demo.

Markdown

VIEW DEMO
This is a markdown converter class that uses PHP Markdown Extra and PHP SmartyPantsTypographer for processing Markdown conversion to HTML. It also supports configurable custom conversion processing of patterns for styling your own flavour of Markdown to some extent. View examples and details or view a complete demo.

MarkdownEditor

VIEW DEMO
This is an advanced markdown input widget with configurable options. It is styled using Bootstrap 3.0. Key features available with this widget are:

  1. Configurable toolbar and buttons for formatting content
  2. Live preview of Markdown formatted text as HTML
  3. Maximize editor for full screen editing
  4. Implements PHP Markdown Extra and PHP SmartyPantsTypographer functionality as provided by the Markdown.
  5. Uses Bootstrap 3.0 styling wherever possible
  6. Allows saving/exporting of the text-editor contents as Text or HTML
  7. Configurable header, footer, and input options.
  8. Supports localization and customization of messages and content.

View examples and details or view a complete demo.

Demo

You can see a demonstration here on usage of these functions with documentation and examples.

Installation

The preferred way to install this extension is through composer.

Note: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-markdown "dev-master"

or add

"kartik-v/yii2-markdown": "dev-master"

to the require section of your composer.json file.

Usage

Setup Module

Add markdown to your modules section of your Yii configuration file

'modules' = [
    /* other modules */
    'markdown' => [
        'class' => 'kartik\markdown\Module',
    ]
];

You can setup additional configuration options for the markdown module:

'modules' = [
    'markdown' => [
        // the module class
        'class' => 'kartik\markdown\Module',

        // the controller action route used for markdown editor preview
        'previewAction' => '/markdown/parse/preview',

        // the list of custom conversion patterns for post processing
        'customConversion' => [
            '<table>' => '<table class="table table-bordered table-striped">'
        ],

        // whether to use PHP SmartyPantsTypographer to process Markdown output
        'smartyPants' => true
    ]
    /* other modules */
];

Markdown

use kartik\markdown\Markdown;

// default call
echo Markdown::convert($content);

// with custom post processing
echo Markdown::convert($content, ['custom' => [
    '<h1>' => '<h1 class="custom-h1>',
    '<h2>' => '<h1 class="custom-h2>',
]]);

MarkdownEditor

// add this in your view
use kartik\markdown\MarkdownEditor;

// usage with model
echo MarkdownEditor::widget([
    'model' => $model, 
    'attribute' => 'markdown',
]);

// usage without model
echo MarkdownEditor::widget([
    'name' => 'markdown', 
    'value' => $value,
]);

License

yii2-markdown is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Changelog

version 1.3.1

Date: 13-Feb-2015

  • (enh #34): Allow markdown to be used as a sub-module.
  • Set copyright year to current.

version 1.3.0

Date: 12-Jan-2015

  • (enh #32): Add Ukranian translations.
  • (enh #33): Set release to stable
  • Revamp to use new Krajee base Module and TranslationTrait.
  • Change message file category name to begin with kv prefix.
  • Code formatting updates as per Yii2 coding style.

version 1.2.0

Date: 16-Dec-2014

  • (enh #9): German translations updated
  • (enh #13): French translations included
  • (enh #19): Russian translations included
  • (enh #20): Italian translations included
  • (enh #29): Hungarian translations included
  • (enh #30): Set dependency on Bootstrap Plugin Asset

version 1.1.0

Date: 09-Nov-2014

  • Enhance dependency validation using common code base.
  • Set release to stable.

version 1.0.0

Date: 01-Dec-2013

  • Initial release
  • PSR4 alias change

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.3.1 is the latest of 5 releases



BSD 3-Clause license
Stats
0 github stars & 0 github forks
0 downloads in the last day
0 downloads in the last 30 days
355 total downloads