1
title: SmartyPants Extension
2
prev_title: Sane Lists Extension
3
prev_url: sane_lists.html
4
next_title: Table of Contents Extension
13
The SmartyPants extension converts ASCII dashes, quotes and ellipses to
14
their HTML entity equivalents.
16
ASCII symbol | Replacements | HTML Entities | Substitution Keys
17
------------ | --------------- | ------------------- | ----------------------------------------
18
`'` | ‘ ’ | `‘` `’` | `'left-single-quote'`, `'right-single-quote'`
19
`"` | “ ” | `“` `”` | `'left-double-quote'`, `'right-double-quote'`
20
`<< >>` | « » | `«` `»` | `'left-angle-quote'`, `'right-angle-quote'`
21
`...` | … | `…` | `'ellipsis'`
22
`--` | – | `–` | `'ndash'`
23
`---` | — | `—` | `'mdash'`
25
Using the configuration option 'substitutions' you can overwrite the
26
default substitutions. Just pass a dict mapping (a subset of) the
27
keys to the substitution strings.
29
For example, one might use the following configuration to get correct quotes for
33
'markdown.extensions.smarty': {
35
'left-single-quote': '‚', # sb is not a typo!
36
'right-single-quote': '‘',
37
'left-double-quote': '„',
38
'right-double-quote': '“'
44
This extension re-implements the Python [SmartyPants]
45
library by integrating it into the markdown parser.
46
While this does not provide any additional features,
47
it does offer a few advantages. Notably, it will not
48
try to work on highlighted code blocks (using the
49
[CodeHilite] Extension) like the third party library
52
[SmartyPants]: http://pythonhosted.org/smartypants/
53
[CodeHilite]: code_hilite.html
58
See [Extensions](index.html) for general extension usage, specify
59
`markdown.extensions.smarty` as the name of the extension.
61
See the [Library Reference](../reference.html#extensions) for information about
62
configuring extensions.
64
The following options are provided to configure the output:
66
Option | Default value | Description
67
------ | ------------- | -----------
68
`smart_dashes` | `True` | whether to convert dashes
69
`smart_quotes` | `True` | whether to convert straight quotes
70
`smart_angled_quotes` | `False` | whether to convert angled quotes
71
`smart_ellipses` | `True` | whether to convert ellipses
72
`substitutions` | `{}` | overwrite default substitutions
77
SmartyPants extension is based on the original SmartyPants implementation
78
by John Gruber. Please read it's [documentation][1] for details.
80
[1]: http://daringfireball.net/projects/smartypants/