Simplemde



SimpleMDE Configuration

SimpleMDE for Kirby This is a textarea with Markdown highlighting using SimpleMDE.

Simplemde
  1. SimpleMDE is used as post editor (html code below). I want to save the markdown content to local file and render by flask-misaka in jinja2. In SimpleMDE, I can get raw markdown content by simplemde.value. But when I pass simplemde.value to var in javascript. ' ' is missing aftering passing.
  2. SimpleMDE - Markdown Editor A drop-in JavaScript textarea replacement for writing beautiful and understandable Markdown. The WYSIWYG-esque editor allows users who may be less experienced with Markdown to use familiar toolbar buttons and shortcuts. In addition, the syntax is rendered while editing to clearly show the expected result.
  3. Vue-SimpleMDE Markdown Editor component for Vue.js. Support both vue1.0 & vue2.0.
  • autoDownloadFontAwesome: If set to true, force downloads Font Awesome (used for icons). If set to false, prevents downloading. Defaults to undefined, which will intelligently check whether Font Awesome has already been included, then download accordingly.
  • autofocus: If set to true, autofocuses the editor. Defaults to false.
  • autosave: Saves the text that’s being written and will load it back in the future. It will forget the text when the form it’s contained in is submitted.
    • enabled: If set to true, autosave the text. Defaults to false.
    • delay: Delay between saves, in milliseconds. Defaults to 10000 (10s).
    • uniqueId: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
  • blockStyles: Customize how certain buttons that style blocks of text behave.
    • bold Can be set to ** or __. Defaults to **.
    • code Can be set to ``` or ~~~. Defaults to ```.
    • italic Can be set to * or _. Defaults to *.
  • element: The DOM element for the textarea to use. Defaults to the first textarea on the page.
  • forceSync: If set to true, force text changes made in SimpleMDE to be immediately stored in original textarea. Defaults to false.
  • hideIcons: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
  • indentWithTabs: If set to false, indent using spaces instead of tabs. Defaults to true.
  • initialValue: If set, will customize the initial value of the editor.
  • insertTexts: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: ['[', '](http://)'].
    • horizontalRule
    • image
    • link
    • table
  • lineWrapping: If set to false, disable line wrapping. Defaults to true.
  • parsingConfig: Adjust settings for parsing the Markdown during editing (not previewing).
    • allowAtxHeaderWithoutSpace: If set to true, will render headers without a space after the #. Defaults to false.
    • strikethrough: If set to false, will not process GFM strikethrough syntax. Defaults to true.
    • underscoresBreakWords: If set to true, let underscores be a delimiter for separating words. Defaults to false.
  • placeholder: Custom placeholder that should be displayed
  • previewRender: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
  • promptURLs: If set to true, a JS alert window appears asking for the link or image URL. Defaults to false.
  • renderingConfig: Adjust settings for parsing the Markdown during previewing (not editing).
    • singleLineBreaks: If set to false, disable parsing GFM single line breaks. Defaults to true.
    • codeSyntaxHighlighting: If set to true, will highlight using highlight.js. Defaults to false. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:
      <script src='https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js'></script>
      <link href='https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css'>
  • shortcuts: Keyboard shortcuts associated with this instance. Defaults to the array of shortcuts.
  • showIcons: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
  • spellChecker: If set to false, disable the spell checker. Defaults to true.
  • status: If set to false, hide the status bar. Defaults to the array of built-in status bar items.
    • Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items.
  • styleSelectedText: If set to false, remove the CodeMirror-selectedtext class from selected lines. Defaults to true.
  • tabSize: If set, customize the tab size. Defaults to 2.
  • toolbar: If set to false, hide the toolbar. Defaults to the array of icons.
  • toolbarTips: If set to false, disable toolbar button tips. Defaults to true.
Simplemde

Toolbar icons

Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. ‘Name’ is the name of the icon, referenced in the JS. ‘Action’ is either a function or a URL to open. ‘Class’ is the class given to the icon. ‘Tooltip’ is the small tooltip that appears via the title=' attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of action set to bold and that of tooltip set to Bold, the final text the user will see would be ‘Bold (Ctrl-B)’).

SimplemdeSimplemde

Additionally, you can add a separator between any icons by adding '|' to the toolbar array.

NameActionTooltip
Class
boldtoggleBoldBold
fa fa-bold
italictoggleItalicItalic
fa fa-italic
strikethroughtoggleStrikethroughStrikethrough
fa fa-strikethrough
headingtoggleHeadingSmallerHeading
fa fa-header
heading-smallertoggleHeadingSmallerSmaller Heading
fa fa-header
heading-biggertoggleHeadingBiggerBigger Heading
fa fa-lg fa-header
heading-1toggleHeading1Big Heading
fa fa-header fa-header-x fa-header-1
heading-2toggleHeading2Medium Heading
fa fa-header fa-header-x fa-header-2
heading-3toggleHeading3Small Heading
fa fa-header fa-header-x fa-header-3
codetoggleCodeBlockCode
fa fa-code
quotetoggleBlockquoteQuote
fa fa-quote-left
unordered-listtoggleUnorderedListGeneric List
fa fa-list-ul
ordered-listtoggleOrderedListNumbered List
fa fa-list-ol
clean-blockcleanBlockClean block
fa fa-eraser fa-clean-block
linkdrawLinkCreate Link
fa fa-link
imagedrawImageInsert Image
fa fa-picture-o
tabledrawTableInsert Table
fa fa-table
horizontal-ruledrawHorizontalRuleInsert Horizontal Line
fa fa-minus
previewtogglePreviewToggle Preview
fa fa-eye no-disable
side-by-sidetoggleSideBySideToggle Side by Side
fa fa-columns no-disable no-mobile
fullscreentoggleFullScreenToggle Fullscreen
fa fa-arrows-alt no-disable no-mobile
guideThis linkMarkdown Guide
fa fa-question-circle

Customize the toolbar using the toolbar option like:

Keyboard shortcuts

SimpleMDE comes with an array of predefined keyboard shortcuts, but they can be altered with a configuration option. The list of default ones is as follows:

ShortcutAction
Cmd-‘‘toggleBlockquote’
Cmd-B‘toggleBold’
Cmd-E‘cleanBlock’
Cmd-H‘toggleHeadingSmaller’
Cmd-I‘toggleItalic’
Cmd-K‘drawLink’
Cmd-L‘toggleUnorderedList’
Cmd-P‘togglePreview’
Cmd-Alt-C‘toggleCodeBlock’
Cmd-Alt-I‘drawImage’
Cmd-Alt-L‘toggleOrderedList’
Shift-Cmd-H‘toggleHeadingBigger’
F9‘toggleSideBySide’
F11‘toggleFullScreen’

Simplemde Angular

Here is how you can change a few, while leaving others untouched:

Shortcuts are automatically converted between platforms. If you define a shortcut as ‘Cmd-B’, on PC that shortcut will be changed to ‘Ctrl-B’. Conversely, a shortcut defined as ‘Ctrl-B’ will become ‘Cmd-B’ for Mac users.

The list of actions that can be bound is the same as the list of built-in actions available for toolbar buttons.

Height

To change the minimum height (before it starts auto-growing):

Markdown To Html

Or, you can keep the height static: