Skip to content

Commit

Permalink
markdown: Add a failing test for pymdownx.superfences vs. fenced_code
Browse files Browse the repository at this point in the history
  • Loading branch information
mitya57 committed Dec 8, 2024
1 parent 2bf6cb8 commit a06beb6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@
</p>
"""

triple_backticks_in_list_source = """
1. List item 1
```python
import this
```
2. List item 2
"""


@unittest.skipUnless(MarkdownMarkup.available(), "Markdown not available")
class MarkdownTest(unittest.TestCase):
Expand Down Expand Up @@ -397,3 +407,13 @@ def test_pymdownx_highlight_custom_class(self) -> None:
self.assertIn(".myclass .k {", stylesheet)
body = converted.get_document_body()
self.assertIn('<div class="myclass">', body)

@unittest.skipIf(pymdownx is None, "pymdownx module is not available")
def test_pymdownx_superfences_is_preferred(self) -> None:
markup = MarkdownMarkup(extensions=["pymdownx.superfences"])
converted = markup.convert(triple_backticks_in_list_source)
body = converted.get_document_body()
# produced by pymdownx.superfences
self.assertIn('<div class="highlight">', body)
# produced by fenced_code (part of extra)
self.assertNotIn("<code>python", body)

0 comments on commit a06beb6

Please sign in to comment.