aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-09-26 22:46:13 +0100
committerMichael Williamson <mike@zwobble.org>2026-09-26 22:46:13 +0100
commit2a5cf02b98fe7d20ba7af5395f0af1f22e2c4210 (patch)
tree722cebf5ce50926fe767386978efde9e82adab91 /tests
parentaa2253a10d92a07af74e96a04568734dc4c197f1 (diff)
Escape HTML IDs in markdown writer
Diffstat (limited to 'tests')
-rw-r--r--tests/writers/markdown_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/writers/markdown_tests.py b/tests/writers/markdown_tests.py
index 7083fef..28f74fc 100644
--- a/tests/writers/markdown_tests.py
+++ b/tests/writers/markdown_tests.py
@@ -91,6 +91,14 @@ def test_elements_with_ids_have_anchor_tags_with_ids_appended_to_start_of_markdo
assert_equal('# <a id="start"></a>Hello\n\n', writer.as_string())
+def test_anchor_tag_ids_are_escaped():
+ writer = _create_writer()
+ writer.start("h1", {"id": "\"start\""})
+ writer.text("Hello")
+ writer.end("h1")
+ assert_equal('# <a id="&quot;start&quot;"></a>Hello\n\n', writer.as_string())
+
+
def test_links_have_anchors_before_opening_square_bracket():
writer = _create_writer()
writer.start("a", {"href": "http://example.com", "id": "start"})