An extension to the Python Markdown project which adds the ability to subscript text. To do so, the character ~
becomes a Markdown tag for text meant to be subscripted, and is replaced with the HTML sub
tag.
For example, given the text: :
The molecular composition of water is H~2~O.
… using Markdown with this extension will output: :
<p>The molecular composition of water is H<sub>2</sub>O.</p>
This project is provided under the Simplified (2 Clause) BSD license.
pip install MarkdownSubscript
>>> from markdown import markdown >>> text = "The molecular composition of water is H~2~O." >>> markdown(text, ['subscript']) '<p>The molecular composition of water is H<sub>2</sub>O.</p>'
$ echo 'The molecular composition of water is H~2~O.' > text.md
$ python -m markdown -o html5 -x 'subscript' -f text.html text.md