module documentation

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 AsteriskProcessor Emphasis processor for handling strong and em matches inside asterisks.
Class AutolinkInlineProcessor Return a link Element given an autolink (`<http://example/com>`).
Class AutomailInlineProcessor Return a mailto link Element given an automail link (`<foo@example.com>`).
Class BacktickInlineProcessor Return a `<code>` element containing the matching text.
Class DoubleTagInlineProcessor Return a ElementTree element nested in tag2 nested in tag1.
Class DoubleTagPattern Return a ElementTree element nested in tag2 nested in tag1.
Class EmStrongItem Emphasis/strong pattern item.
Class EscapeInlineProcessor Return an escaped character.
Class HtmlInlineProcessor Store raw inline html and return a placeholder.
Class ImageInlineProcessor Return a img element from the given match.
Class ImageReferenceInlineProcessor Match to a stored reference and return img element.
Class InlineProcessor Base class that inline patterns subclass.
Class LinkInlineProcessor Return a link element from the given match.
Class Pattern Base class that inline patterns subclass.
Class ReferenceInlineProcessor Match to a stored reference and return link element.
Class ShortImageReferenceInlineProcessor Short form of inage reference: ![ref].
Class ShortReferenceInlineProcessor Short form of reference: [google].
Class SimpleTagInlineProcessor Return element of type `tag` with a text attribute of group(2) of a Pattern.
Class SimpleTagPattern Return element of type `tag` with a text attribute of group(3) of a Pattern.
Class SimpleTextInlineProcessor Return a simple text of group(1) of a Pattern.
Class SimpleTextPattern Return a simple text of group(2) of a Pattern.
Class SubstituteTagInlineProcessor Return an element of type `tag` with no children.
Class SubstituteTagPattern Return an element of type `tag` with no children.
Class UnderscoreProcessor Emphasis processor for handling strong and em matches inside underscores.
Function build_inlinepatterns Build the default set of inline patterns for Markdown.
Function dequote Remove quotes from around a string.
Constant AUTOLINK_RE Undocumented
Constant AUTOMAIL_RE Undocumented
Constant BACKTICK_RE Undocumented
Constant EM_STRONG2_RE Undocumented
Constant EM_STRONG_RE Undocumented
Constant EMPHASIS_RE Undocumented
Constant ENTITY_RE Undocumented
Constant ESCAPE_RE Undocumented
Constant HTML_RE Undocumented
Constant IMAGE_LINK_RE Undocumented
Constant LINE_BREAK_RE Undocumented
Constant LINK_RE Undocumented
Constant NOIMG Undocumented
Constant NOT_STRONG_RE Undocumented
Constant SMART_EMPHASIS_RE Undocumented
Constant SMART_STRONG_EM_RE Undocumented
Constant SMART_STRONG_RE Undocumented
Constant STRONG_EM2_RE Undocumented
Constant STRONG_EM3_RE Undocumented
Constant STRONG_EM_RE Undocumented
Constant STRONG_RE Undocumented
def build_inlinepatterns(md, **kwargs): (source)

Build the default set of inline patterns for Markdown.

def dequote(string): (source)

Remove quotes from around a string.

AUTOLINK_RE: str = (source)

Undocumented

Value
'<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^<>]*)>'
AUTOMAIL_RE: str = (source)

Undocumented

Value
'<([^<> !]+@[^@<> ]+)>'
BACKTICK_RE: str = (source)

Undocumented

Value
'(?:(?<!\\\\)((?:\\\\{2})+)(?=`+)|(?<!\\\\)(`+)(.+?)(?<!`)\\2(?!`))'
EM_STRONG2_RE: str = (source)

Undocumented

Value
'(_)\\1{2}(.+?)\\1(.*?)\\1{2}'
EM_STRONG_RE: str = (source)

Undocumented

Value
'(\\*)\\1{2}(.+?)\\1(.*?)\\1{2}'
EMPHASIS_RE: str = (source)

Undocumented

Value
'(\\*)([^\\*]+)\\1'
ENTITY_RE: str = (source)

Undocumented

Value
'(&(?:\\#[0-9]+|\\#x[0-9a-fA-F]+|[a-zA-Z0-9]+);)'
ESCAPE_RE: str = (source)

Undocumented

Value
'\\\\(.)'
HTML_RE: str = (source)

Undocumented

Value
'(<(\\/?[a-zA-Z][^<>@ ]*( [^<>]*)?|!--(?:(?!<!--|-->).)*--)>)'
IMAGE_LINK_RE: str = (source)

Undocumented

Value
'\\!\\['
LINE_BREAK_RE: str = (source)

Undocumented

Value
'  \\n'
LINK_RE = (source)

Undocumented

Value
NOIMG+'\\['
NOIMG: str = (source)

Undocumented

Value
'(?<!\\!)'
NOT_STRONG_RE: str = (source)

Undocumented

Value
'((^|\\s)(\\*|_)(\\s|$))'
SMART_EMPHASIS_RE: str = (source)

Undocumented

Value
'(?<!\\w)(_)(?!_)(.+?)(?<!_)\\1(?!\\w)'
SMART_STRONG_EM_RE: str = (source)

Undocumented

Value
'(?<!\\w)(\\_)\\1(?!\\1)(.+?)(?<!\\w)\\1(?!\\1)(.+?)\\1{3}(?!\\w)'
SMART_STRONG_RE: str = (source)

Undocumented

Value
'(?<!\\w)(_{2})(?!_)(.+?)(?<!_)\\1(?!\\w)'
STRONG_EM2_RE: str = (source)

Undocumented

Value
'(_)\\1{2}(.+?)\\1{2}(.*?)\\1'
STRONG_EM3_RE: str = (source)

Undocumented

Value
'(\\*)\\1(?!\\1)([^*]+?)\\1(?!\\1)(.+?)\\1{3}'
STRONG_EM_RE: str = (source)

Undocumented

Value
'(\\*)\\1{2}(.+?)\\1{2}(.*?)\\1'
STRONG_RE: str = (source)

Undocumented

Value
'(\\*{2})(.+?)\\1'