Skip to content

jbt/mdEdit

Folders and files

NameName
Last commit message
Last commit date
Oct 17, 2015
Sep 24, 2015
Sep 22, 2015
Oct 17, 2015
Sep 21, 2015
Oct 2, 2015
Oct 2, 2015
Apr 3, 2015
Oct 17, 2015
Oct 17, 2015
Oct 2, 2015
Apr 2, 2015
Apr 12, 2015

Repository files navigation

mdEdit

Syntax-highlighted / semi-formatted markdown editor view with minimal dependencies.

As seen in my online markdown editor (the left-hand side is this editor, or more accurately it will be once I've merged this pull request).

Requires Prism - Prism core is required plus any languages you want to be syntax-highlighted inside fenced code blocks. The bundled prism-all.js includes all available languages.

Usage

  • Include prism.css and mdedit.css
  • Include prism-all.js and mdedit.js
  • Include a <pre> element where you want an editor
  • Then var editor = mdEdit(thatPreElement, {options});

API

  • The options parameter to the constructor may include the following configuration options:

    • className - any css classes to apply to the editor view
    • change - callback function that is called whenever the editor value changes (value is passed as an argument)
  • editor.getValue() - returns the current value of the editor view

  • editor.setValue(val) - sets the current value to val and updates the view

Browser support

Anything that supports ES5 well enough. That means (hopefully) IE9+, and all recent versions of all the other browsers.