mattmccray / CodeMirror-markdown-list-autoindent

CodeMirror patched with markdown list auto-indent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeMirror-markdown-list-autoindent

This package is essentially a patch to CodeMirror that adds support for list auto-indentation in Markdown.

When continuing a list in Markdown, type <Tab> to indent the next bullet or <Shift-Tab> to unindent it.

Example:

Screencast

NPM

The package is on NPM:

$ npm install codemirror-markdown-list-autoindent

Usage

When including CodeMirror in your JS client, add the new indentlist.js file:

<link rel="stylesheet" href="(path_to_code_mirror)/lib/codemirror.css">
<script src="(path_to_code_mirror)/lib/codemirror.js"></script>
<script src="(path_to_code_mirror)/addon/edit/continuelist.js"></script>
<script src="(path_to_code_mirror)/addon/edit/indentlist.js"></script>
<script src="(path_to_code_mirror)/mode/markdown.js"></script>

Then bind the <Tab> and <Shift-Tab> keys to the right events:

extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList",
            "Tab": "autoIndentMarkdownList",
            "Shift-Tab": "autoUnindentMarkdownList"}

About

CodeMirror patched with markdown list auto-indent

License:MIT License


Languages

Language:JavaScript 100.0%