Skip to content

Commit

Permalink
Merge pull request Python-Markdown#469 from martinmo/fenced-code-no-p…
Browse files Browse the repository at this point in the history
…ygments

Support CodeHilite option use_pygments in fenced_code
  • Loading branch information
waylan committed Apr 11, 2016
2 parents 882ce66 + dd669e3 commit 4d96f00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions markdown/extensions/fenced_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def run(self, lines):
guess_lang=self.codehilite_conf['guess_lang'][0],
css_class=self.codehilite_conf['css_class'][0],
style=self.codehilite_conf['pygments_style'][0],
use_pygments=self.codehilite_conf['use_pygments'][0],
lang=(m.group('lang') or None),
noclasses=self.codehilite_conf['noclasses'][0],
hl_lines=parse_hl_lines(m.group('hl_lines'))
Expand Down
12 changes: 12 additions & 0 deletions tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,18 @@ def testFencedLanguageAndHighlightLines(self):
'#line 3</code></pre>'
)

def testFencedLanguageAndPygmentsDisabled(self):
""" Test if fenced_code honors CodeHilite option use_pygments=False. """

text = '```python\nfrom __future__ import braces\n```'
md = markdown.Markdown(
extensions=[
markdown.extensions.codehilite.CodeHiliteExtension(use_pygments=False),
'markdown.extensions.fenced_code'
]
)
self.assertTrue('<code class="language-python">' in md.convert(text))


class TestHeaderId(unittest.TestCase):
""" Test HeaderId Extension. """
Expand Down

0 comments on commit 4d96f00

Please sign in to comment.