diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:38:49 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:38:49 +0000 |
| commit | 8627676ce1cbb573ecc799141c35f302cbc20af9 (patch) | |
| tree | aa4f1041a27166b20ef44d6623711991766a042c /tests | |
| parent | 414cb49cd08d4952cf5eff51bd9e2da811c4661b (diff) | |
Escape HTML tag and entity characters in Markdown writer
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/writers/markdown_tests.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/writers/markdown_tests.py b/tests/writers/markdown_tests.py index cb91905..af0f9d2 100644 --- a/tests/writers/markdown_tests.py +++ b/tests/writers/markdown_tests.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from mammoth.writers.markdown import MarkdownWriter +from mammoth.writers.markdown import MarkdownWriter, _escape_markdown from ..testing import assert_equal @@ -208,6 +208,17 @@ def test_numbering_is_separate_for_nested_list_and_parent_list(): assert_equal("1. Fruit\n\t1. Apple\n\t2. Banana\n2. Condiments\n\n", writer.as_string()) +def test_html_tag_characters_are_escaped(): + escaped = _escape_markdown("<br/>") + + assert_equal(r"\<br/\>", escaped) + + +def test_html_entity_characters_are_escaped(): + escaped = _escape_markdown("&") + + assert_equal(r"\&", escaped) + def _create_writer(): return MarkdownWriter() |
