diff options
author | A. Jesse Jiryu Davis <jesse@10gen.com> | 2014-01-07 12:55:58 -0500 |
---|---|---|
committer | A. Jesse Jiryu Davis <jesse@10gen.com> | 2014-01-07 12:55:58 -0500 |
commit | 1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d (patch) | |
tree | 63acf64ec3ef8803a7d7b3bec544bfbf3a390eef /markdown/extensions | |
parent | 436b420c1c6bb9db569d6ce4be2d06cff829aea9 (diff) | |
download | markdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.tar.gz markdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.tar.bz2 markdown-1fca2a3b2d65bc013e22f7c00c503ea7cea7f72d.zip |
Allow single as well as double quotes for hl_lines.
Diffstat (limited to 'markdown/extensions')
-rw-r--r-- | markdown/extensions/codehilite.py | 3 | ||||
-rw-r--r-- | markdown/extensions/fenced_code.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py index 7f20efe..9f99518 100644 --- a/markdown/extensions/codehilite.py +++ b/markdown/extensions/codehilite.py @@ -168,7 +168,8 @@ class CodeHilite(object): (?P<path>(?:/\w+)*[/ ])? # Zero or 1 path (?P<lang>[\w+-]*) # The language \s* # Arbitrary whitespace - (hl_lines="(?P<hl_lines>.*?)")? # Maybe highlight lines + # Optional highlight lines, single- or double-quote-delimited + (hl_lines=(?P<quot>"|')(?P<hl_lines>.*?)(?P=quot))? ''', re.VERBOSE) # search first line for shebang m = c.search(fl) diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 6ee6759..39c6540 100644 --- a/markdown/extensions/fenced_code.py +++ b/markdown/extensions/fenced_code.py @@ -110,7 +110,8 @@ class FencedBlockPreprocessor(Preprocessor): FENCED_BLOCK_RE = re.compile(r''' (?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~ (\{?\.?(?P<lang>[a-zA-Z0-9_+-]*))?[ ]* # Optional {, and lang -(hl_lines="(?P<hl_lines>.*?)")?[ ]* # Optional highlight lines +# Optional highlight lines, single- or double-quote-delimited +(hl_lines=(?P<quot>"|')(?P<hl_lines>.*?)(?P=quot))?[ ]* }?[ ]*\n # Optional closing } (?P<code>.*?)(?<=\n) (?P=fence)[ ]*$''', re.MULTILINE | re.DOTALL | re.VERBOSE) |