Python Markdown A Python implementation of John Gruber's Markdown. Documentation: https://python-markdown.github.io/ GitHub: https://github.com/Python-Markdown/markdown/ PyPI: https://pypi.org/project/Markdown/ Started by Manfred Stienstra (http://www.dwerg.net/). Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). Currently maintained by Waylan Limberg (https://github.com/waylan), Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) Copyright 2004 Manfred Stienstra (the original version) License: BSD (see LICENSE.md for details). INLINE PATTERNS ============================================================================= Inline patterns such as *emphasis* are handled by means of auxiliary objects, one per pattern. Pattern objects must be instances of classes that extend markdown.Pattern. Each pattern object uses a single regular expression and needs support the following methods: pattern.getCompiledRegExp() # returns a regular expression pattern.handleMatch(m) # takes a match object and returns # an ElementTree element or just plain text All of python markdown's built-in patterns subclass from Pattern, but you can add additional patterns that don't. Also note that all the regular expressions used by inline must capture the whole block. For this reason, they all start with '^(.*)' and end with '(.*)!'. In case with built-in expression Pattern takes care of adding the "^(.*)" and "(.*)!". Finally, the order in which regular expressions are applied is very important - e.g. if we first replace http://.../ links with <a> tags and _then_ try to replace inline html, we would end up with a mess. So, we apply the expressions in the following order: * escape and backticks have to go before everything else, so that we can preempt any markdown patterns by escaping them. * then we handle auto-links (must be done before inline html) * then we handle inline HTML. At this point we will simply replace all inline HTML strings with a placeholder and add the actual HTML to a hash. * then inline images (must be done before links) * then bracketed links, first regular then reference-style * finally we apply strong and emphasis
Class |
|
Emphasis processor for handling strong and em matches inside asterisks. |
Class |
|
Return a link Element given an autolink (`<http://example/com>`). |
Class |
|
Return a mailto link Element given an automail link (`<foo@example.com>`). |
Class |
|
Return a `<code>` element containing the matching text. |
Class |
|
Return a ElementTree element nested in tag2 nested in tag1. |
Class |
|
Return a ElementTree element nested in tag2 nested in tag1. |
Class |
|
Emphasis/strong pattern item. |
Class |
|
Return an escaped character. |
Class |
|
Store raw inline html and return a placeholder. |
Class |
|
Return a img element from the given match. |
Class |
|
Match to a stored reference and return img element. |
Class |
|
Base class that inline patterns subclass. |
Class |
|
Return a link element from the given match. |
Class |
|
Base class that inline patterns subclass. |
Class |
|
Match to a stored reference and return link element. |
Class |
|
Short form of inage reference: ![ref]. |
Class |
|
Short form of reference: [google]. |
Class |
|
Return element of type `tag` with a text attribute of group(2) of a Pattern. |
Class |
|
Return element of type `tag` with a text attribute of group(3) of a Pattern. |
Class |
|
Return a simple text of group(1) of a Pattern. |
Class |
|
Return a simple text of group(2) of a Pattern. |
Class |
|
Return an element of type `tag` with no children. |
Class |
|
Return an element of type `tag` with no children. |
Class |
|
Emphasis processor for handling strong and em matches inside underscores. |
Function | build |
Build the default set of inline patterns for Markdown. |
Function | dequote |
Remove quotes from around a string. |
Constant | AUTOLINK |
Undocumented |
Constant | AUTOMAIL |
Undocumented |
Constant | BACKTICK |
Undocumented |
Constant | EM |
Undocumented |
Constant | EM |
Undocumented |
Constant | EMPHASIS |
Undocumented |
Constant | ENTITY |
Undocumented |
Constant | ESCAPE |
Undocumented |
Constant | HTML |
Undocumented |
Constant | IMAGE |
Undocumented |
Constant | LINE |
Undocumented |
Constant | LINK |
Undocumented |
Constant | NOIMG |
Undocumented |
Constant | NOT |
Undocumented |
Constant | SMART |
Undocumented |
Constant | SMART |
Undocumented |
Constant | SMART |
Undocumented |
Constant | STRONG |
Undocumented |
Constant | STRONG |
Undocumented |
Constant | STRONG |
Undocumented |
Constant | STRONG |
Undocumented |