diff options
-rw-r--r-- | docs/writing_extensions.txt | 7 | ||||
-rw-r--r-- | markdown/extensions/wikilinks.py | 2 | ||||
-rw-r--r-- | markdown/inlinepatterns.py | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/docs/writing_extensions.txt b/docs/writing_extensions.txt index 1300d55..2ecd4c9 100644 --- a/docs/writing_extensions.txt +++ b/docs/writing_extensions.txt @@ -80,9 +80,10 @@ 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 provided in the ``Pattern`` you can pass in a regular expression without that -and ``getCompiledRegExp`` will wrap your expression for you. This means that -the first group of your match will be ``m.group(2)`` as ``m.group(1)`` will -match everything before the pattern. +and ``getCompiledRegExp`` will wrap your expression for you and set the +`re.DOTALL` and `re.UNICODE` flags. This means that the first group of your +match will be ``m.group(2)`` as ``m.group(1)`` will match everything before the +pattern. For an example, consider this simplified emphasis pattern: diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py index f68e4e5..2b8abde 100644 --- a/markdown/extensions/wikilinks.py +++ b/markdown/extensions/wikilinks.py @@ -105,7 +105,7 @@ class WikiLinkExtension(markdown.Extension): self.md = md # append to end of inline patterns - WIKILINK_RE = r'\[\[([A-Za-z0-9_ -]+)\]\]' + WIKILINK_RE = r'\[\[([\w0-9_ -]+)\]\]' wikilinkPattern = WikiLinks(WIKILINK_RE, self.config) wikilinkPattern.md = md md.inlinePatterns.add('wikilink', wikilinkPattern, "<not_strong") diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index b5bd02b..ebc6d8d 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -153,7 +153,8 @@ class Pattern: """ self.pattern = pattern - self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, re.DOTALL) + self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, + re.DOTALL | re.UNICODE) # Api for Markdown to pass safe_mode into instance self.safe_mode = False |