Skip to content

Commit

Permalink
Merge pull request #1975 from jmcouffin/clean-code
Browse files Browse the repository at this point in the history
fenced code
  • Loading branch information
jmcouffin authored Oct 22, 2023
2 parents 11f4085 + bdcc3de commit 5e924c0
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 5e924c0

Please sign in to comment.