Markdown Mode 2.0 Preview
Markdown Mode 2.0 is nearing completion and since there are so many new features and improvements, a preview seemed in order. Also, if you follow the development version of Markdown Mode, it is now nearing stability, so this is a good time to test it to help find bugs before the release. Below are a few things you can expect to see in the next release.
Shorter keybindings:
- The precedence for the old markup insertion keybindings came from
html-helper-mode
. They were, unfortunately, rather verbose. In the new version, markup insertion will be possible with only a single prefix (C-c <letter>), rather than two prefixes (as in C-c C-s <letter>). (Updated 2013–03–17: Thanks to Scott Jaderholm for reminding me that Emacs key binding conventions prohibit major modes from usingC-c <letter>
. Such sequences are reserved for users. Therefore, it’s likely that the old keybindings will remain largely intact since it’s not clear that they could be significantly shortened.)
Smarter markup insertion:
- Fast heading insertion with a single command which automatically calculates the type (atx or setext) and level (which can now be cycled quickly, see below). Headings with a specific level or type can still be inserted quickly with specific keybindings.
- When there is no active region, the bold, italic, and code insertion commands will operate on the word at point, if any, so that you don’t have to have an active selection for simple modifications.
- Repeating the bold, italic, or code insertion commands when the point is at an element of the corresponding type will remove the markup.
- Indentation of preformatted text and blockquotes will be adjusted automatically in contexts where more indentation is required, as in nested lists. (For example, in Markdown, a preformatted text block inside a first-level list item must have eight spaces of indentation.)
- Minibuffer completion of reference link tags.
- Multiple horizontal rule styles, customizable as a list of strings, which can be cycled through.
- New URL insertion command (plain URLs delimited by brackets). Works on URL at point, if any, when there is no active region.
- Generally improved insertion commands with respect to insertion of surrounding whitespace and point position after insertion.
Markup removal:
- Easily kill an element (e.g., a link or reference definition) at the point and store the most important part in the kill ring (e.g., the link text or URL).
Markup completion:
- Completion of markup for ATX headings (balancing hash marks, removing extra whitespace).
- Completion of markup for setext headings (matching length of underline to heading text).
- Normalize horizontal rules (ensure they match one of the strings in the list).
Markup cycling:
- Heading level cycling.
- Horizontal rule cycling through a customizable list of strings.
- Bold and italic markup cycling (between *asterisks* and _underscores_).
Structure editing:
- Move list items up and down.
- Indent and exdent list items.
- Indent and exdent regions (with tab stops determined by context),
as in
python-mode
.
Improved syntax highlighting:
- Highlighting preformatted text blocks is now much faster and more accurate.
- Regular expression optimization for URI matching.
- Subtle syntax highlighting for hard line breaks.
- Font lock for title strings in inline links.
- Numerous other improvements for more accurate syntax highlighting.
Paragraph filling:
- Respect hard line breaks when filling paragraphs.
- List items with any of the three markers are filled in the same way.
New and improved movement commands:
- Quickly jump between reference definitions and reference-style links and between footnote markers and footnote text.
- Revised outline navigation commands, following
org-mode
. This frees up the sexp navigation keys C-M-f and C-M-b which can be useful in Markdown documents which have many matching delimiters, as well as the defun navigation keys C-M-a and C-M-e. - Previous/next section movement (in Emacs parlance, movement by defun).
- Previous/next block movement.
- Previous/next link movement (now includes inline and reference links as well as wiki links).
Link following and movement:
- Unified link following: open links in a browser and wiki links in a new buffer with the same keybinding.
- Generalized link movement and following: move between and open all link types (inline, reference, wiki, angle URIs) using the same key bindings.
Regression tests:
- Created a growing library of tests using the
ert
(Emacs Regression Testing) framework. - Currently almost 150 unit tests.
GFM (GitHub Flavored Markdown) mode:
- Changes italic font lock behavior to match GFM specification regarding underscores in words.
- Syntax highlighting and insertion command for GFM quoted code blocks with language keyword.