Skip to content

Commit 75df4e9

Browse files
Correct docstring regarding use of spaces
My original docstring stated that superscripted text cannot contain any whitespace characters. In fact, superscripted text can contain space characters, as long as they are escaped.
1 parent 822a097 commit 75df4e9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

mdit_py_plugins/superscript/index.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@
3737
def superscript_plugin(md: MarkdownIt) -> None:
3838
"""Superscript (``<sup>``) tag plugin for Markdown-It-Py.
3939
40-
This plugin is ported from `markdown-it-sup <https://github.com/markdown-it/markdown-it-sup>`_. Markup is based on the `Pandoc superscript extension <https://pandoc.org/MANUAL.html#superscripts-and-subscripts>`_.
40+
This plugin is ported from `markdown-it-sup
41+
<https://github.com/markdown-it/markdown-it-sup>`_. Markup is based on the
42+
`Pandoc superscript extension
43+
<https://pandoc.org/MANUAL.html#superscripts-and-subscripts>`_.
4144
42-
Surround superscripted text with caret ``^`` characters. Superscripted text cannot contain whitespace characters. Nested markup is not supported.
45+
Place superscripted text within caret ``^`` characters. You must escape any
46+
spaces in the superscripted text. Note that you cannot use newline or tab
47+
characters, and that nested markup is not supported.
4348
4449
Example usage:
4550
@@ -48,8 +53,8 @@ def superscript_plugin(md: MarkdownIt) -> None:
4853
>>> md = MarkdownIt().use(superscript_plugin)
4954
>>> md.render("1^st^")
5055
'<p>1<sup>st</sup></p>\\n'
51-
>>> md.render("2^nd^")
52-
'<p>2<sup>nd</sup></p>\\n'
56+
>>> md.render("this^text\\\\ has\\\\ spaces^")
57+
'<p>this<sup>text has spaces</sup></p>\\n'
5358
"""
5459

5560
def superscript(state: StateInline, silent: bool) -> bool:

0 commit comments

Comments
 (0)