Skip to content

Commit

Permalink
fenced code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcouffin committed Oct 22, 2023
1 parent ea31e38 commit bdcc3de
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def extendMarkdown(self, md, md_globals):

class FencedBlockPreprocessor(Preprocessor):
"""Fenced code block preprocessor."""
FENCED_BLOCK_RE = re.compile(r```
FENCED_BLOCK_RE = re.compile(r'''
(?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~
(\{?\.?(?P<lang>[\w#.+-]*))?[ ]* # Optional {, and lang
# 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)
(?P=fence)[ ]*$''', re.MULTILINE | re.DOTALL | re.VERBOSE)
CODE_WRAP = '<pre><code%s>%s</code></pre>'
LANG_TAG = ' class="%s"'

Expand Down

0 comments on commit bdcc3de

Please sign in to comment.