Module Expr Str Import alias Import alias ImportFrom alias alias Import alias If CompareGtE AttributeLoad NameLoad attr Str body ImportFrom alias identifier orelse Import alias Expr Str Assign NameStore Str Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str BinOpMult BinOpAdd NameLoad Str Num BinOpMult BinOpAdd NameLoad Str Num NameLoad Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str If AttributeLoad NameLoad attr body Assign NameStore Str orelse Assign NameStore Str Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad Str Assign NameStore BinOpAdd BinOpAdd Str NameLoad Str Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad Str Assign NameStore BinOpAdd BinOpAdd Str NameLoad Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str FunctionDef arguments args NameParam defaults body Expr Str If BoolOpOr BoolOpAnd Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str BoolOpAnd Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str body Return SubscriptLoad NameLoad Slice Num Num orelse Return NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Str Str decorator_list Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list Expr Str ClassDef bases body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list Assign NameStore NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Num If CompareEq NameLoad AttributeLoad NameLoad attr body Return NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Num Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr Num attr Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Num Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore NameLoad Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Num If NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Assign NameStore SubscriptLoad NameLoad Slice Num Num Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr Str Str If NameLoad body Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Str Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad Assign NameStore NameLoad If BoolOpOr CompareNotEq NameLoad Str CompareIn NameLoad NameLoad body Assign NameStore NameLoad For NameStore SubscriptLoad NameLoad Slice Num body If CompareIn Str NameLoad body Assign NameStore NameLoad If BoolOpAnd AttributeLoad AttributeLoad NameLoad attr attr UnaryOpNot NameLoad body Return Str orelse Return Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Num If BoolOpAnd CompareEq SubscriptLoad NameLoad Index Num Str CompareEq SubscriptLoad NameLoad Index Num Str body Assign NameStore SubscriptLoad NameLoad Slice Num Num Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Str If CompareGt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Str Call NameLoad Call AttributeLoad Str attr SubscriptLoad NameLoad Slice Num If AttributeLoad NameLoad attr body Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Num NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body If Call AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr orelse Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num attr If UnaryOpNot CompareIn NameLoad AttributeLoad AttributeLoad NameLoad attr attr body Return NameLoad Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad NameLoad attr Num If Call AttributeLoad NameLoad attr Str body Assign NameStore SubscriptLoad NameLoad Slice Call NameLoad Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If NameLoad body Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad orelse Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad decorator_list Assign NameStore ListComp Call NameLoad Call NameLoad NameLoad comprehension NameStore NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore BinOpAdd Str NameLoad Assign NameStore Call AttributeLoad Str attr ListComp BinOpAdd AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list decorator_list
N/A N/A 
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
 N/A markdown N/A re urlparse urlparse urlunparse N/A sys N/A N/A N/A sys version 3.0 N/A html entities htmlentitydefs N/A N/A htmlentitydefs N/A 
The actual regular expressions for patterns
-----------------------------------------------------------------------------
 N/A NOBRACKET [^\]\[]* N/A BRK N/A N/A N/A N/A \[( N/A N/A NOBRACKET (\[ 6 N/A N/A NOBRACKET \])* 6 NOBRACKET )\] N/A NOIMG (?<!\!) N/A BACKTICK_RE (?<!\\)(`+)(.+?)(?<!`)\2(?!`) N/A ESCAPE_RE \\(.) N/A EMPHASIS_RE (\*)([^\*]+)\2 N/A STRONG_RE (\*{2}|_{2})(.+?)\2 N/A STRONG_EM_RE (\*{3}|_{3})(.+?)\2 N/A N/A markdown SMART_EMPHASIS N/A N/A EMPHASIS_2_RE (?<!\S)(_)(\S.+?)\2 N/A N/A EMPHASIS_2_RE (_)(.+?)\2 N/A LINK_RE N/A N/A NOIMG BRK \(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12)?\) N/A IMAGE_LINK_RE N/A N/A \! BRK \s*\((<.*?>|([^\)]*))\) N/A REFERENCE_RE N/A N/A NOIMG BRK \s*\[([^\]]*)\] N/A IMAGE_REFERENCE_RE N/A N/A \! BRK \s*\[([^\]]*)\] N/A NOT_STRONG_RE ((^| )(\*|_)( |$)) N/A AUTOLINK_RE <((?:f|ht)tps?://[^>]*)> N/A AUTOMAIL_RE <([^> \!]*@[^> ]*)> N/A HTML_RE (\<([a-zA-Z/][^\>]*?|\!--.*?--)\>) N/A ENTITY_RE (&[\#a-zA-Z0-9]*;) N/A LINE_BREAK_RE   \n N/A LINE_BREAK_2_RE   $ dequote N/A N/A string N/A N/A N/A Remove quotes from around a string. N/A N/A N/A N/A N/A string startswith " N/A N/A string endswith " N/A N/A N/A string startswith ' N/A N/A string endswith ' N/A N/A N/A string N/A 1 -1 N/A N/A string N/A N/A ATTR_RE N/A N/A re compile \{@([^\}]*)=([^\}]*)} handleAttributes N/A N/A text parent N/A N/A N/A Set values of an element based on attribute definitions ({@id=123}). attributeCallback N/A N/A match N/A N/A N/A N/A N/A parent set N/A N/A match group 1 N/A N/A N/A N/A match group 2 replace N/A N/A N/A N/A ATTR_RE sub attributeCallback text N/A N/A 
The pattern classes
-----------------------------------------------------------------------------
 Pattern N/A N/A N/A Base class that inline patterns subclass.  __init__ N/A N/A self pattern markdown_instance N/A None N/A N/A 
        Create an instant of an inline pattern.

        Keyword arguments:

        * pattern: A regular expression that matches a pattern

         N/A N/A self pattern pattern N/A N/A self compiled_re N/A N/A re compile N/A ^(.*?)%s(.*?)$ pattern N/A re DOTALL N/A N/A self safe_mode False N/A markdown_instance N/A N/A N/A self markdown markdown_instance N/A getCompiledRegExp N/A N/A self N/A N/A N/A  Return a compiled regular expression.  N/A N/A self compiled_re N/A handleMatch N/A N/A self m N/A N/A N/A Return a ElementTree element from the given match.

        Subclasses should override this method.

        Keyword arguments:

        * m: A re match object containing a match of the pattern.

         N/A N/A type N/A N/A self N/A N/A N/A  Return class name, to define pattern type  N/A N/A N/A self __class__ __name__ N/A N/A N/A BasePattern Pattern SimpleTextPattern N/A Pattern N/A N/A  Return a simple text of group(2) of a Pattern.  handleMatch N/A N/A self m N/A N/A N/A text N/A N/A m group 2 N/A N/A text N/A markdown INLINE_PLACEHOLDER_PREFIX N/A N/A None N/A text N/A N/A SimpleTagPattern N/A Pattern N/A N/A 
    Return element of type `tag` with a text attribute of group(3)
    of a Pattern.

     __init__ N/A N/A self pattern tag N/A N/A N/A N/A N/A Pattern __init__ self pattern N/A N/A self tag tag N/A handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element N/A self tag N/A N/A el text N/A N/A m group 3 N/A el N/A N/A SubstituteTagPattern N/A SimpleTagPattern N/A N/A  Return a eLement of type `tag` with no children.  handleMatch N/A N/A self m N/A N/A N/A N/A N/A N/A markdown etree Element N/A self tag N/A N/A BacktickPattern N/A Pattern N/A N/A  Return a `<code>` element containing the matching text.  __init__ N/A N/A self pattern N/A N/A N/A N/A N/A Pattern __init__ self pattern N/A N/A self tag code N/A handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element N/A self tag N/A N/A el text N/A N/A markdown AtomicString N/A N/A N/A N/A m group 3 strip N/A el N/A N/A DoubleTagPattern N/A SimpleTagPattern N/A N/A Return a ElementTree element nested in tag2 nested in tag1.

    Useful for strong emphasis etc.

     handleMatch N/A N/A self m N/A N/A N/A N/A tag1 tag2 N/A N/A N/A self tag split , N/A el1 N/A N/A N/A markdown etree Element tag1 N/A el2 N/A N/A N/A markdown etree SubElement el1 tag2 N/A N/A el2 text N/A N/A m group 3 N/A el1 N/A N/A HtmlPattern N/A Pattern N/A N/A  Store raw inline html and return a placeholder.  handleMatch N/A N/A self m N/A N/A N/A rawhtml N/A N/A m group 2 N/A inline True N/A place_holder N/A N/A N/A N/A self markdown htmlStash store rawhtml N/A place_holder N/A N/A LinkPattern N/A Pattern N/A N/A  Return a link element from the given match.  handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element a N/A N/A el text N/A N/A m group 2 N/A title N/A N/A m group 11 N/A href N/A N/A m group 9 N/A href N/A N/A N/A N/A href N/A 0 < N/A N/A href N/A href N/A 1 -1 N/A N/A N/A el set href N/A N/A self sanitize_url N/A N/A href strip N/A N/A N/A N/A el set href N/A title N/A N/A title N/A dequote title N/A N/A N/A el set title title N/A el N/A sanitize_url N/A N/A self url N/A N/A N/A 
        Sanitize a url against xss attacks in "safe_mode".

        Rather than specifically blacklisting `javascript:alert("XSS")` and all
        its aliases (see <http://ha.ckers.org/xss.html>), we whitelist known
        safe url formats. Most urls contain a network location, however some
        are known not to (i.e.: mailto links). Script urls do not contain a
        location. Additionally, for `javascript:...`, the scheme would be
        "javascript" but some aliases will appear to `urlparse()` to have no
        scheme. On top of that relative links (i.e.: "foo/bar.html") have no
        scheme. Therefore we must check "path", "parameters", "query" and
        "fragment" for any literal colons. We don't check "scheme" for colons
        because it *should* never have any and "netloc" must allow the form:
        `username:password@host:port`.

         N/A locless_schemes N/A mailto news N/A N/A scheme netloc path params query fragment url N/A urlparse url N/A safe_url False N/A N/A N/A netloc N/A scheme locless_schemes N/A N/A safe_url True N/A part N/A url N/A 2 N/A N/A N/A : part N/A N/A safe_url False N/A N/A N/A N/A self markdown safeMode N/A safe_url N/A N/A N/A N/A N/A urlunparse url N/A N/A ImagePattern N/A LinkPattern N/A N/A  Return a img element from the given match.  handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element img N/A src_parts N/A N/A N/A N/A m group 9 split N/A src_parts N/A N/A src N/A src_parts N/A 0 N/A N/A N/A N/A src N/A 0 < N/A N/A src N/A -1 > N/A N/A src N/A src N/A 1 -1 N/A N/A N/A el set src N/A N/A self sanitize_url src N/A N/A N/A N/A el set src N/A N/A N/A len src_parts 1 N/A N/A N/A N/A el set title N/A dequote N/A N/A join N/A src_parts N/A 1 N/A N/A markdown ENABLE_ATTRIBUTES N/A N/A truealt N/A handleAttributes N/A N/A m group 2 el N/A N/A truealt N/A N/A m group 2 N/A N/A N/A el set alt truealt N/A el N/A N/A ReferencePattern N/A LinkPattern N/A N/A  Match to a stored reference and return link element.  handleMatch N/A N/A self m N/A N/A N/A N/A N/A m group 9 N/A N/A id N/A N/A N/A N/A m group 9 lower N/A N/A id N/A N/A N/A N/A m group 2 lower N/A N/A N/A id N/A N/A self markdown references N/A N/A None N/A N/A href title N/A N/A N/A self markdown references N/A id N/A text N/A N/A m group 2 N/A N/A N/A self makeTag href title text N/A makeTag N/A N/A self href title text N/A N/A N/A el N/A N/A N/A markdown etree Element a N/A N/A N/A el set href N/A N/A self sanitize_url href N/A title N/A N/A N/A N/A el set title title N/A N/A el text text N/A el N/A N/A ImageReferencePattern N/A ReferencePattern N/A N/A  Match to a stored reference and return img element.  makeTag N/A N/A self href title text N/A N/A N/A el N/A N/A N/A markdown etree Element img N/A N/A N/A el set src N/A N/A self sanitize_url href N/A title N/A N/A N/A N/A el set title title N/A N/A N/A el set alt text N/A el N/A N/A AutolinkPattern N/A Pattern N/A N/A  Return a link Element given an autolink (`<http://example/com>`).  handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element a N/A N/A N/A el set href N/A N/A m group 2 N/A N/A el text N/A N/A markdown AtomicString N/A N/A m group 2 N/A el N/A N/A AutomailPattern N/A Pattern N/A N/A 
    Return a mailto link Element given an automail link (`<foo@example.com>`).
     handleMatch N/A N/A self m N/A N/A N/A el N/A N/A N/A markdown etree Element a N/A email N/A N/A m group 2 N/A N/A N/A email startswith mailto: N/A N/A email N/A email N/A N/A len mailto: codepoint2name N/A N/A code N/A N/A N/A Return entity definition by code, or the code if not defined. N/A entity N/A N/A N/A htmlentitydefs codepoint2name get code N/A entity N/A N/A N/A %s%s; N/A N/A markdown AMP_SUBSTITUTE entity N/A N/A N/A %s#%d; N/A N/A markdown AMP_SUBSTITUTE code N/A N/A letters N/A N/A codepoint2name N/A ord letter N/A letter email N/A N/A el text N/A N/A markdown AtomicString N/A N/A join letters N/A mailto N/A mailto: email N/A mailto N/A N/A join N/A N/A N/A markdown AMP_SUBSTITUTE N/A #%d; N/A ord letter N/A letter mailto N/A N/A N/A el set href mailto N/A el N/A N/A