Skip to content

Commit e270030

Browse files
committed
Add Readme
1 parent e619f9d commit e270030

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

README.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Superscript for Markdown-IT-Py
2+
==============================
3+
4+
This is a plugin for the Python implementation of
5+
`Markdown-IT <https://github.com/executablebooks/markdown-it-py>`_ (a CommonMark
6+
parser) that provides superscript (``<sup>``) via carets (``^``).
7+
8+
Markup is based on the `Pandoc superscript extension
9+
<https://pandoc.org/MANUAL.html#superscripts-and-subscripts>`_.
10+
11+
Place superscripted text within caret ``^`` characters. You must escape any
12+
spaces in the superscripted text. Note that you cannot use newline or tab
13+
characters, and that nested markup is not supported.
14+
15+
Example usage::
16+
17+
>>> from markdown_it import MarkdownIt
18+
>>> from mdit_py_plugins.superscript import superscript_plugin
19+
>>> md = MarkdownIt().use(superscript_plugin)
20+
>>> md.render("1^st^")
21+
'<p>1<sup>st</sup></p>\\n'
22+
>>> md.render("this^text\\\\ has\\\\ spaces^")
23+
'<p>this<sup>text has spaces</sup></p>\\n'
24+
25+
Tests can be run using ``pytest``.
26+
27+
28+
For whatever reason, subscript was added to the "official" *mdit-py-plugins*
29+
collection, but superscript has been langishing as an open pull reqest for the
30+
past six months. This is meant as an interim measure so I can make use of the
31+
plugin locally, until such time as the upstream pull request lands. Maybe
32+
you'll find it helpful too!

0 commit comments

Comments
 (0)