Package: markdown-text-decorator
Text Decorator Extension for Python-MarkdownThis extension add Text Decorate handler toPython-Markdown.SpecThis extension supports following expressions.TypeMarkdownHTMLdelete--text--<del>text</del>insert++text++<ins>text</ins>mark!!text!!<mark>text</mark>overline===text===<span class="overline" style="...">text</span>ruby{text:rt-text}<ruby>text<rt>rt-text</rt></ruby>strikethrough~~text~~
text
subscript^text^<sub>text</sub>superscript^^text^^<sup>text</sup>underline=text=<span class="underline" style="...">text</span>underoverline==text==<span class="underoverline" style="...">text</span>Extension ParamNameTypeDefaultDescriptionpriorityint100When you use other extensions, Try to adjust this param.* Higher value will be prioritized proccessing.Ref)Registries priorityInstallationpython3-mpipinstallmarkdown_text_decoratorUsageSample CodefrommarkdownimportMarkdownMARKDOWN_EXTENSIONS=["markdown_text_decorator"]MARKDOWN_EXTENSION_CONFS={"markdown_text_decorator":{"priority":90}}md2html=Markdown(extensions=MARKDOWN_EXTENSIONS,extension_configs=MARKDOWN_EXTENSION_CONFS)markdown_input="""# Markdown Text Decoration Expression~~This is~~ strikethrough ~~line~~++This is++ insert ++line++--This is-- delete --line--^^This is^^ superscript ^^line^^^This is^ subscript ^line^!!This is!! mark !!line!!=This is= underline =line===This is== underoverline ==line=====This is=== overline ===line==={ Markdown Text Decorator : mɑ́ːkdàun tékst dékərèitər }{ 日本語: !!Japanese!! } { 英語: !!English!! }# Python-Markdown Standard ExpressionThis is nomal line*This is* italic-1 *line*_This is_ italic-2 _line_**This is** bold-1 **line**__This is__ bold-2 __line__***This is*** bold+italic-1 ***line***___This is___ bold+italic-2 ___line___**_This is_** bold+italic-3 **_line_**"""html_output=md2html.convert(markdown_input)print(html_output)Sample Output<h1>Markdown Text Decoration Expression</h1><p>
This is
strikethrough
line
</p><p><ins>This is</ins>insert<ins>line</ins></p><p><del>This is</del>delete<del>line</del></p><p><sup>This is</sup>superscript<sup>line</sup></p><p><sub>This is</sub>subscript<sub>line</sub></p><p><mark>This is</mark>mark<mark>line</mark></p><p><spanclass="underline"style="text-decoration: underline">This is</span>underline<spanclass="underline"style="text-decoration: underline">line</span></p><p><spanclass="underoverline"style="text-decoration: underline overline">This is</span>underoverline<spanclass="underoverline"style="text-decoration: underline overline">line</span></p><p><spanclass="overline"style="text-decoration: overline">This is</span>overline<spanclass="overline"style="text-decoration: overline">line</span></p><p><ruby>Markdown Text Decorator<rt>mɑ́ːkdàun tékst dékərèitər</rt></ruby></p><p><ruby>日本語<rt><mark>Japanese</mark></rt></ruby><ruby>英語<rt><mark>English</mark></rt></ruby></p><h1>Python-Markdown Standard Expression</h1><p>This is nomal line</p><p><em>This is</em>italic-1<em>line</em></p><p><em>This is</em>italic-2<em>line</em></p><p><strong>This is</strong>bold-1<strong>line</strong></p><p><strong>This is</strong>bold-2<strong>line</strong></p><p><strong><em>This is</em></strong>bold+italic-1<strong><em>line</em></strong></p><p><strong><em>This is</em></strong>bold+italic-2<strong><em>line</em></strong></p><p><strong><em>This is</em></strong>bold+italic-3<strong><em>line</em></strong></p>Test ResultMarkdownTextDecoratorTest
----------------------------------------------------------------------
test_bold_italic_p1 (__main__.MarkdownStandardTextDecoratorTestCase)
test for bold_italic pattern 1 ... ok
test_bold_italic_p2 (__main__.MarkdownStandardTextDecoratorTestCase)
test for bold_italic pattern 2 ... ok
test_bold_italic_p3 (__main__.MarkdownStandardTextDecoratorTestCase)
test for bold_italic pattern 3 ... ok
test_bold_p1 (__main__.MarkdownStandardTextDecoratorTestCase)
test for bold pattern 1 ... ok
test_bold_p2 (__main__.MarkdownStandardTextDecoratorTestCase)
test for bold pattern 2 ... ok
test_italic_p1 (__main__.MarkdownStandardTextDecoratorTestCase)
test for italic pattern 1 ... ok
test_italic_p2 (__main__.MarkdownStandardTextDecoratorTestCase)
test for italic pattern 2 ... ok
test_normal (__main__.MarkdownStandardTextDecoratorTestCase)
test for normal ... ok
test_all (__main__.MarkdownTextDecoratorTestCase)
test for all at once ... ok
test_delete (__main__.MarkdownTextDecoratorTestCase)
test for delete ... ok
test_insert (__main__.MarkdownTextDecoratorTestCase)
test for insert ... ok
test_mark (__main__.MarkdownTextDecoratorTestCase)
test for mark ... ok
test_overline (__main__.MarkdownTextDecoratorTestCase)
test for overline ... ok
test_ruby (__main__.MarkdownTextDecoratorTestCase)
test for ruby ... ok
test_strikethrough (__main__.MarkdownTextDecoratorTestCase)
test for strikethrough ... ok
test_subscript (__main__.MarkdownTextDecoratorTestCase)
test for subscript ... ok
test_superscript (__main__.MarkdownTextDecoratorTestCase)
test for superscript ... ok
test_underline (__main__.MarkdownTextDecoratorTestCase)
test for underline ... ok
test_underoverline (__main__.MarkdownTextDecoratorTestCase)
test for underoverline ... ok

----------------------------------------------------------------------
Ran 19 tests in 0.020sCHANGE LOGv3.2.0Add Extension param "priority".v3.1.1Fix bug.v3.1.0Refactor codes and update README.v3.0.1Add unittest for Checking markdown_text_decorator does not destructPython-Markdownstandard text decoration.Italic, Bold, Italic+Bold.v3.0.0Support overline, underline and underoverline.Add unittest for them.v2.0.0Support ruby and add unittest for ruby.v1.2.0Support mark and add unittest for mark.v1.1.1Add unittest for strikethrough, insert, delete, superscript and subscript.v1.1.0Support superscript and subscript.v1.0.1Support multi-pairs in one line release.v1.0.0Initial Release.ReferenceCommonMark SpecPython-Markdown HPHTML tagsCSS