aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions
diff options
context:
space:
mode:
authorIsaac Muse <faceless.shop@gmail.com>2017-11-23 07:56:38 -0700
committerWaylan Limberg <waylan.limberg@icloud.com>2017-11-23 09:56:38 -0500
commitde5c696f94e8dde242c29d4be50b7bbf3c17fedb (patch)
tree31c6c11b698be4b284c9b93b05a4d0ca3bd58e6a /docs/extensions
parent007bd2aa4c184b28f710d041a0abe78bffc0ec2e (diff)
downloadmarkdown-de5c696f94e8dde242c29d4be50b7bbf3c17fedb.tar.gz
markdown-de5c696f94e8dde242c29d4be50b7bbf3c17fedb.tar.bz2
markdown-de5c696f94e8dde242c29d4be50b7bbf3c17fedb.zip
Feature ancestry (#598)
Ancestry exclusion for inline patterns. Adds the ability for an inline pattern to define a list of ancestor tag names that should be avoided. If a pattern would create a descendant of one of the listed tag names, the pattern will not match. Fixes #596.
Diffstat (limited to 'docs/extensions')
-rw-r--r--docs/extensions/api.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/extensions/api.txt b/docs/extensions/api.txt
index 9653883..246bb27 100644
--- a/docs/extensions/api.txt
+++ b/docs/extensions/api.txt
@@ -53,7 +53,7 @@ A pseudo example:
Inline Patterns {: #inlinepatterns }
------------------------------------
-Inline Patterns implement the inline HTML element syntax for Markdown such as
+Inline Patterns implement the inline HTML element syntax for Markdown such as
`*emphasis*` or `[links](http://example.com)`. Pattern objects should be
instances of classes that inherit from `markdown.inlinepatterns.Pattern` or
one of its children. Each pattern object uses a single regular expression and
@@ -68,6 +68,10 @@ must have the following methods:
Accepts a match object and returns an ElementTree element of a plain
Unicode string.
+Also, Inline Patterns can define the property `ANCESTOR_EXCLUDES` with either
+a list or tuple of undesirable ancestors. The pattern should not match if it
+would cause the content to be a descendant of one of the defined tag names.
+
Note that any regular expression returned by `getCompiledRegExp` must capture
the whole block. Therefore, they should all start with `r'^(.*?)'` and end
with `r'(.*?)!'`. When using the default `getCompiledRegExp()` method