Typographer
Simple ASCII punctuation characters are substituted with typographic correct ones.
The Typographer provides a similar functionality as the Smartypants project from John Gruber, who also started Markdown.
The concept: Convenient typing options should encourage the use of good typography. (see also → Quote)
Substitutions
Name | ASCII | Result |
---|---|---|
Quotes | "Quote" | “Quote” |
Single quotes | 'Quote' | ‘Quote’ |
Apostrophe | Hugo's | Hugo’s |
Angled quotes | <<Angle>> | «Angle» |
Em Dash | --- | — |
En Dash | -- | – |
Ellipses | ... | … |
These substitutions can be configured in the markup section for the Goldmark renderer.
More general alternative
There are some reasons not to rely (always) on typographic substitution. They aren’t compelling for every project but may be considerable for yours.
If we want to transform our Markdown content with the help of other rendering software, we may not find a substitution engine working in the same way as Hugo’s typographer.
The substitution of punctuation like the apostrophe is unreliable for rare edge cases, where the correct substitution does not only depend on the place of the quotation mark in the content, but also on its meaning.
The only alternative then, is to write the correct punctuation yourself or to use a Markdown editor capable of transforming straight quotes on the fly like some word processors do.
There are two ways we can write correct punctuation and other special characters directly:
- Keyboard Shortcuts
- These are key combinations for special characters which depend unfortunately on the operating system and the keyboard layout. On some systems, they are relatively easy to remember. On others, they are very weird and practically useless.
- HTML entities
- We get the German Gänsefüßchen „ and “ with
„
and“
for example. Entities look weird in text files, but the result is as good as the original Unicode characters.