Markdown Mode 2.0 Release Notes
Markdown Mode version 2.0 was released on March 24, 2013. This is a major new stable release with many new features, including some changes to keybindings for element insertion and outline navigation. This new stable version can be downloaded from the Markdown Mode homepage. Below is a description of significant or user-visible enhancements or bug fixes. See the Git repository for a complete history of changes.
New Features
Keybinding Changes
- Physical styles: element insertion commands prefixed by C-c C-p have been removed in favor of their logical style counterparts prefixed by C-c C-s.
- Shift is now the preferred way to distinguish keybindings for two
similar elements:
- Insert an inline link with C-c C-a l or a reference link with C-c C-a L. The latter keybinding is new and preferred over C-c C-a r, which is deprecated.
- Insert an inline image with C-c C-a l or a reference image with C-c C-a L. The latter keybinding and insertion functionality is new.
- The new automatic header insertion function (more below) is bound to C-c C-t h, with C-c C-t H being a variant that indicates a preference for Setext headings.
- Insert an ATX level-one heading with C-c C-t 1 or a Setext level-one heading with C-c C-t ! (! is S–1). The latter keybinding is new and is preferred over C-c C-t t, which is deprecated.
- Insert an ATX level-two heading with C-c C-t 2 or a Setext level-two heading with C-c C-t @ (@ is S–2). The latter keybinding is new and is preferred over C-c C-t s, which is deprecated.
- Footnotes:
- Insert new footnote: C-c C-f n has been changed to C-c C-a f.
- Jump to footnote text: C-c C-f g has been superceded
by C-c C-j (
markdown-jump
). - Jump to footnote marker: C-c C-f b has been
superceded by C-c C-j (
markdown-jump
). - Kill footnote: C-c C-f k has been superceded by
C-c C-k (
markdown-kill-thing-at-point
).
- Several other new keybdings have been introduced and are described in more detail below.
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). Prefix with C-u to promote the heading by one level or C-u C-u to demote the heading by one level. Headings with a specific level or type can still be inserted quickly with specific keybindings.
- ATX heading insertion will use current line as heading text if not blank and there is no active region.
- Setext heading insertion will prompt for heading title when there is no active region.
- When the point is at a heading, the heading insertion commands will replace the heading at point with a heading of the requested level and type.
- When there is no active region, the bold, italic, code, link, and image 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.
- Smart list item insertion with M-RET, with indentation and marker determined by the surrounding context. Prefix with C-u to decrease the indentation by one level or C-u C-u to increase the indentation one level.
- 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.)
- Improved reference link insertion with label completion.
- Use word at point as link text, if possible, when there is no active region.
- Tab completion of reference labels from the set of currently defined references.
- Reference link insertion no longer prompts for a URL or title if the label is already defined.
- If no URL is given, create an empty reference definition and move the point there.
- Customizable reference link location via
markdown-reference-location
.
- Basic reference-style image markup insertion.
- Multiple horizontal rule styles, customizable as a list of strings, which can be cycled through.
- New URL insertion command for inserting plain URLs delimited by angle brackets (C-c C-a u). 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 (e.g., ensuring blank lines before and after newly inserted headings and horizontal rules).
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 (C-c C-]) normalizes the markup for an
element:
- balancing hash marks and removing extra whitespace for atx headings,
- equating the length of the underline with the text for setext headings, and
- ensuring that horizintal rule strings are chosen from a
pre-defined list of strings (
markdown-hr-strings
).
Markup Promotion and Demotion
- Markup promotion and demotion via C-c C– and C-c C-=, respectively. The sequences M-<up> and M-<down> may also be used.
- Certain types of markup may be promoted or demoted: atx headings, setext headings, horizontal rules, and list items. Bold and italic markup can also be toggled between asterisks and underscores.
- Promotion and demotion commands also cycle when level boundaries are reached (e.g. when demoting a level six heading, it cycles back a level one heading).
List and Region Editing
- Move list items up and down with M-<up> and M-<down>.
- Indent and exdent list items with M-<left> and M-<right>.
- Indent and exdent regions, with tab stops determined by context,
using C-c < and C-c > (as in
python-mode
).
Syntax Highlighting Improvements
- Highlighting preformatted text blocks is now much faster and more accurate. The pre block matching routines have been completely rewritten, with unit tests. The previous implementation was incorrect in some cases and generally slow. This should be much faster and more accurate for pre blocks inside nested lists. Markdown Mode adheres to the four space rule for nested list items: in a list item of level n, preformatted text must be indented at least 4(n + 1) spaces.
- Font lock for title strings in inline links.
- Subtle syntax highlighting for hard line breaks.
- More inclusive blockquote regular expression highlights blockquotes with leading indentation, when appropriate.
- Regular expression optimization for URI matching.
- Syntax highlighting for MultiMarkdown metadata and Pandoc title blocks.
- Numerous other improvements for more accurate syntax highlighting.
New and Improved Movement Commands
- Jumping:
- Quickly jump between reference definitions and reference-style links and between footnote markers and footnote text with C-c C-j.
- Create undefined references when jumping from a reference link.
- When jumping from a reference definition used by multiple reference links, show a temporary buffer with buttons for selecting which link to jump to. Possible locations may be cycled with TAB and S-TAB.
- 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 with C-M-a and C-M-e (in Emacs parlance, this is movement by defun). Mark the current section with C-M-h.
- Previous/next paragraph movement via M-{ and M-}.
- Previous/next block movement with C-u M-{ and C-u M-}.
Link Following and Movement
- Unified link following: open links in a browser and wiki links in a new buffer with the same keybinding (C-c C-o). This supercedes the separate wiki link following command (C-c C-w).
- Generalized link movement and following: move between and open all link types (inline, reference, wiki, angle URIs) using the same key bindings (M-n and M-p). Previously, these commands only moved between wiki links, but with the above following enhancement, moving between hyperlinks of all types is more useful.
- Remove wiki link following with
RET
andmarkdown-follow-wiki-link-on-enter
setting.
Other Enhancements
- Respect hard line breaks when filling paragraphs. A downside of this is that paragraph movement commands will also stop at hard line breaks, thus slightly changing the definition of “paragraph” in this mode. In those cases, use the new block movement commands instead.
- Use adaptive filling for list items and blockquotes.
- Treat all list items (any marker type) the same way with respect to filling.
- Retain the
>
prefix when filling blockquotes. - Fill list items inside of blockquotes.
- Add indentation positions: preceding list markers and pre block position.
imenu
support.- Added before and after export hooks.
markdown-before-export-hook
can make changes to the source buffer (e.g., preprocessing the Markdown source before running Markdown). Any changes made will be kept until the file is exported, so they will be incorporated into the resulting XHTML output, and the buffer will be restored to it’s original state after exporting.markdown-after-export-hook
may modify the resulting output buffer after export but before the output file is saved (e.g., postprocessing the XHTML output).
- Added a library of regression tests which currently contains 160 unit tests.
- Use newer
use-region-p
when possible to check for active region, with fallbacks for older Emacsen and Xemacs. - Numerous other internal improvements to make the code base more robust.
- Use button-map for navigating undefined references, so that references can be navigated via the keyboard by pressing TAB and S-TAB.
- Clean up whitespace after deleting footnote text.
- Math support:
- Dynamic loading and unloading for math support with refontification.
- Allow underscores and colons in equation labels.
GFM (GitHub Flavored Markdown) Mode Improvements
- Changes italic font lock behavior to match GFM specification regarding underscores in words.
- Syntax highlighting for GFM quoted code blocks with an optional language keyword.
- Insertion command (C-c C-s P) for GFM quoted code blocks.
Bug Fixes
- Fix bug in heading visibility cycling introduced in version 1.9 where the level of headings was being calculated incorrectly.
- Fix problems inserting ATX headings at end of buffer.
- Support small Setext headings (with fewer than three characters).
- Several improvements to inline code syntax highlighting.
- No need to prohibit spaces after the leading backquotes.
- Markdown allows more than two leading backquotes (but the same number must appear at the end to close the code tag).
- Ensure following character is not a backquote.
- Fix a bug where code fragments separated by a single character were not highlighted correctly. (This is difficult or impossible to do with regular expressions in Emacs, which do not support negative lookahead or negative lookbehind, so a matching function is used now.)
- Fix some edge cases regarding escaping, spaces, etc. for bold and italic font lock.
- Prohibit newlines and tabs immediately after opening bold and italic delimiters. This fixes a bug where italics would not be highlighted following a horizontal rule
- Improved multi-line font lock performance for large files.
- Improved multi-line font lock at beginning of buffer.
- List items with any of the three markers are filled in the same way
(previously list items starting with
+
were not filled with hanging indentation). - Fix end detection for empty list items. Don’t skip over the
whitespace following the marker on the same line. Previously, empty
list items were not being detected properly by
markdown-cur-list-item-bounds
as a result of this. - Don’t exclude
[^]
, which is a valid reference tag (but let’s please stick to alphanumeric characters). - No longer highlight escaped wiki links.
- Fix line number buttons for reference checking and make all buttons clickable.
- Fix killing of footnotes with no text.
- Fix escaping in
markdown-xhtml-standalone-regexp
. - Fix a font-lock edge case involving footnote markers preceding inline links.
- More accurate font-lock for ATX headings in edge cases.
- Fix killing of footnotes from footnote text.