mdx_smartypants /

Filename Size Date modified Message
747 B
1.2 KB
1.2 KB
554 B
2.4 KB
59 B
993 B

A Python-Markdown extension that uses smartypants to provide typographically nicer ("curly") quotes, proper ("em" and "en") dashes, etc.


pip install mdx_smartypants

Failing that, fall back to the older approach:

easy_install mdx_smartypants

(You may need to begin these with "sudo ".)


import markdown
import mdx_smartypants

text = """
Markdown makes HTML from simple text files. But--it lacks typographic
"prettification." That... That'd be sweet. Definitely 7---8 on a '10-point
scale'. Now it has it.


print markdown.markdown(text, extensions=['smartypants'])

This produces nice HTML output, including typographically "pretty" quotes and other punctuation. It also renders HTML entites in their named rather than numeric form, which is easier on the eyes and more readily comprehended:

<p>Markdown makes HTML from simple text files. But&mdash;it lacks
typographic &ldquo;prettification.&rdquo; That&hellip; That&rsquo;d be
sweet. Definitely 7&ndash;8 on a &lsquo;10-point scale&rsquo;. Now it has