uran1980/yii2-bootstrap-markdown-editor

Yii2 Markdown Editor based on Bootstrap Markdown.

0.0.4 2015-03-21 23:30 UTC

This package is auto-updated.

Last update: 2024-10-13 04:01:56 UTC


README

Yii2 Markdown Editor based on Bootstrap Markdown.

This component use folowing libraries:

  • Marked -- a full-featured markdown parser and compiler, written in JavaScript.
  • To markdown -- an HTML to Markdown converter written in javascript.
  • Bootstrap Markdown -- JSimple Markdown editing tools that works!

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require uran1980/yii2-bootstrap-markdown-editor "dev-master"

or add

"uran1980/yii2-bootstrap-markdown-editor": "dev-master"

to the require section of your composer.json

Usage

Active widget

In view in active form:

<?php

use yii\widgets\ActiveForm;
use uran1980\yii\widgets\markdown\MarkdownEditor;
?>

<div class="active-form">
    <?php $form = ActiveForm::begin(); ?>
    <?php echo $form->field($model, 'content')->widget(MarkdownEditor::className(), [
        'clientOptions' => ['language' => Yii::$app->language],
        'options'       => ['data-provider' => 'markdown'],
    ]); ?>
    <?php ActiveForm::end(); ?>
</div>

Simple widget

In view:

<?php
use uran1980\yii\widgets\markdown\MarkdownEditor;

echo MarkdownEditor::widget([
    'name'          => 'md-editor',
    'value'         => '# test message',
    'clientOptions' => ['language' => Yii::$app->language],
    'options'       => ['data-provider' => 'markdown'],
]);

See also

Author

Ivan Yakovlev, e-mail: uran1980@gmail.com