MarkDown 的 python 實現:Python-Markdown

jopen 10年前發布 | 81K 次閱讀 Python開發 Python-Markdown

MarkDown 的 python 實現。這幾乎是完全符合規范的實現,但也有一些非常細微的差別。

除了基本的Markdown語法,Python-Markdown支持以下功能:

  • International Input

    Python-Markdown will accept input in any language supported by Unicode including bi-directional text. In fact the test suite includes documents written in Russian and Arabic.

  • Extensions

    Various extensions are provided (including extra) to change and/or extend the base syntax. Additionally, a public Extension API is available to write your own extensions.

  • Output Formats

    Python-Markdown can output documents in HTML4, XHTML and HTML5. See theLibrary Reference for details.

  • Command Line Interface

    In addition to being a Python Library, a command line script is available for your convenience.

示例代碼:

import markdown
import bleach
html = bleach.clean(markdown.markdown(untrusted_text))

md = markdown.Markdown(safe_mode='replace', 
                   html_replacement_text='--RAW HTML NOT ALLOWED--')

項目主頁:http://www.baiduhome.net/lib/view/home/1412994109436

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!