MD088 - Normalize to ASCII quotes and dashes¶
Aliases: quotes-dashes
Disabled by default. This rule is opt-in: enable it explicitly with
extend-enable.
What this rule does¶
This rule detects Unicode quotes and dashes that look like their ASCII equivalents, and replaces them with plain ASCII characters.
By default, it will only replace multiple styles of single and double quotes by their simple ASCII equivalents.
You can optionally enable replacement for dashes.
Characters covered by this rule:
| Unicode Character Name | Character | Codepoint | ASCII Replacement |
|---|---|---|---|
| Left Single Quotation Mark | ‘ | U+2018 | ' |
| Right Single Quotation Mark | ’ | U+2019 | ' |
| Single Low-9 Quotation Mark | ‚ | U+201A | ' |
| Single High-Reversed-9 Quotation Mark | ‛ | U+201B | ' |
| Prime | ′ | U+2032 | ' |
| Left Double Quotation Mark | “ | U+201C | " |
| Right Double Quotation Mark | ” | U+201D | " |
| Double Low-9 Quotation Mark | „ | U+201E | " |
| Double High-Reversed-9 Quotation Mark | ‟ | U+201F | " |
| Double Prime | ″ | U+2033 | " |
| Hyphen | ‐ | U+2010 | - |
| Non-Breaking Hyphen | ‑ | U+2011 | - |
| Figure Dash | ‒ | U+2012 | - |
| En Dash | – | U+2013 | - |
| Em Dash | — | U+2014 | - |
| Horizontal Bar | ― | U+2015 | - |
Characters that a language spells words with are not covered, because replacing
them would change the word rather than its typography. That includes the modifier
letters ʼ (U+02BC, Crimean Tatar, Nenets, Chechen) and ʻ (U+02BB, the Hawaiian
okina), and the guillemets « and », which are the quotation marks of several
languages rather than look-alikes for ASCII ones.
This rule checks only prose content and skips:
- YAML front matter
- fenced code blocks
- indented code blocks
- inline code spans
- math, both
$$ ... $$blocks and inline$ ... $spans, where′and″are the prime and double prime of a derivative or a unit
Why this matters¶
While more typographically correct, those characters only offer a very marginal readability gain.
Fancy quotes and dashes often come from smart punctuation features or copy/paste from rich text sources. These characters can create variability, noisy diffs and unexpected behavior in tooling that expects ASCII punctuation.
Bad handling of Unicode characters in editors/IDEs is also a source of "Mojibake", which are sequences of strange characters generated by decoding a Unicode-encoded character with another charset like ISO-8859-x or CP125x. See MD083 for a rule that detects such Mojibake.
Normalizing quotes and dashes to ASCII keeps Markdown content predictable and avoids hidden character drift across contributors and platforms.
Examples¶
Incorrect¶
Correct¶
Auto-fix behavior in code¶
Fixes to:
The inline code span is intentionally unchanged.
Configuration¶
normalize-quotes: if enabled (by default), replace Unicode quotes by simple ASCII ones.normalize-dashes: if enabled, replace Unicode dashes by simple ASCII ones.allow: A list of codepoints to preserve, written as the direct Unicode character, or asU+XXXX,U+XXXXX, orU+XXXXXX(for exampleU+2019). Any allowed codepoint is ignored by MD088 and will not be replaced.
Example:
With this configuration, the rule is enabled, quotes and dashes are replaced,
excepted "prime" ′ and "double prime" ″.