codemirror-markdown-list-autoindent

1.0.1 • Public • Published

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"}

Package Sidebar

Install

npm i codemirror-markdown-list-autoindent

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • joel.porquet