Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Markdown Editor plugin
Markdown Editor - Download

This plugin allows you to create and edit pages using the Markdown syntax.

Existing pages created with the normal HTML editor will still use the default editor (CKeditor, raw HTML or whatever)

The page content is converted to HTML (by Parsedown, included) and stored in the content field, so plugins that expect it to be HTML will not be affected.

(Your Markdown content is stored in a hidden field, contentmd, to be swapped into the editor when you re-edit the page.)

If you later decide to stop using Markdown, just remove or deactivate the plugin. Your content will be available as HTML (though if you re-edit and save any page, its Markdown field will be lost).

There are two ways to use this plugin: mixed mode (default) and Markdown-only.

Both Markdown and HTML - mixed mode (default)
You will find a "Create new page (Markdown)" link in your page management sidebar to create pages using Markdown. The "Create new page" can be used to create a page that will always be edited with the normal HTML editor.
This is the default behaviour.
Optionally you can change the sidebar link text by inserting this in gsconfig.php (example):
define('MARKDOWN_ADDLINK','Create Markdown page');

Markdown-only mode
The "Create new page" link in the page management sidebar will be used to create Markdown pages.
You cannot create new HTML pages, but if you edit previously created pages the HTML editor will be used.
To enable this mode, insert this in gsconfig.php:
define('MARKDOWN_ADDLINK', false);

If you have an existing page and you want to stop using HTML but Markdown instead, you can:

- Delete it, and create it again (Markdown)

- Or, if you use Markdown-only mode: delete its content and save the page. You'll now have an empty Markdown page.

- If you use mixed mode you can do the same as above, but you first have to insert this in gsconfig.php:
define('MARKDOWN_EMPTY', true);
(if you don't, the empty content will still be HTML)

This plugin doesn't currently convert HTML to Markdown. You can use some online tool like to-markdown or others.

There's an additional setting that allows disabling the plugin without deactivating or removing it:
define('MARKDOWN_EDITOR', false);
(This may not seem very useful, but can be used in combination with the UserConfig plugin, e.g. if you only want to allow using Markdown to certain users)

TO-DO: syntax highlighting

It also seems to work nicely with the editor with toolbar plugin (based on Lepture Markdown editor) Shawn made, shown here: (topic which links to that)
Maybe something you can optionally integrate at some point.
Thank you, I had missed Shawn's plugin. I'll take a look at it.
In principle I was thinking about trying with codemirror.
Here's a small plugin that integrates the Lepture Editor with the Markdown Editor plugin.
Note: uses CDN for loading scripts.

Attached Files
.zip (Size: 624 bytes / Downloads: 10)
(2015-06-07, 17:37:53)Carlos Wrote: Here's a small plugin that integrates the Lepture Editor with the Markdown Editor plugin.
Note: uses CDN for loading scripts.

There's actually an improved editor based on the lepture editor: simplemde .
(it's actually not clear if it's still based on the lepture editor see bottom page for info)

Afaik there are only three lines of codes that have to be changed to change your plugin into the improved simplemde. The (cdn) sources and the var editor = new Editor into var simplemde = new SimpleMDE

Although there might be something needed to configure the editor.. (for example: dissabling the included spellchecking, changing the language of it)

What is added at the moment by default in comparison with the lepture editor : 
  • Button for Heading
  • Side by side view (in fullscreen) - edit and preview
  • keyboard shortcuts
  • Spellcheck (English)

Also, it is actually being actively developed, while the Lepture editor is not.

Users browsing this thread: 1 Guest(s)