Yii2 widget for Lepture Markdown Editor > stdout.in Ievgen Kuzminov IT blog

Yii2 widget for Lepture Markdown Editor

Mar 29, 2014, 7:49:00 PM

lepture yii2

Uses https://github.com/lepture/editor - "a markdown editor you really want".

I am using this editor on my blog and prefer it over EpicEditor. It's much handy to write posts with realtime basic highlight of Markdown syntax.

Demo

on http://lab.lepture.com/editor/

Installation via Composer

add to require section of your composer.json "ijackua/yii2-lepture-markdown-editor-widget" and run composer update

Usage example

Active widget

use ijackua\lepture\Markdowneditor;

Markdowneditor::widget(
            [
                'model' => $model,
                'attribute' => 'full_text',
            ])

Simple widget

use ijackua\lepture\Markdowneditor;

Markdowneditor::widget(
            [
                'name' => 'editor',
                'value' => '# Hello world'
            ])

Editor options

see on official site

use ijackua\lepture\Markdowneditor;

Markdowneditor::widget(
            [
                'model' => $model,
                'attribute' => 'full_text',
                'leptureOptions' => [
                    'toolbar' => false
                ]
            ])

Marked options (markdown parser used by Lepture Editor)

see on official Marked site

use ijackua\lepture\Markdowneditor;

Markdowneditor::widget(
            [
                'model' => $model,
                'attribute' => 'full_text',
                'markedOptions' => [
                    'tables' => false
                ]
            ])

Links

comments powered by Disqus
Ievgen
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in Ruby and Elixir, but still love PHP. Explore ES6 and Vue.js. Explore databases, use Ubuntu and MacOS, think about IT people and management

Notes


websocketd wrapper that turn any application that uses STDIO/STDOUT into a WebSocket server. Very interesting approach if you need a quick and dirty solution (maybe not even dirty).



How to add recursively .gitignore files to empty all dirs "find . -type d -regex ``./[^.].*'' -empty -exec touch {}"/.gitignore" \;"



Fix Skype sound noise on Ubuntu 13.10
"sudo sed -i 's/^Exec=.*/Exec=env PULSE_LATENCY_MSEC=30 skype %U/' /usr/share/applications/skype.desktop"