From d302d0755e075811a37268f4cef00e7c54cb409a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 26 Sep 2026 22:28:05 +0100 Subject: Escape HTML IDs in markdown writer --- test/writers/markdown-writer.tests.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/writers/markdown-writer.tests.js b/test/writers/markdown-writer.tests.js index 6d078c5..e7ab9e1 100644 --- a/test/writers/markdown-writer.tests.js +++ b/test/writers/markdown-writer.tests.js @@ -90,6 +90,14 @@ test('elements with IDs have anchor tags with IDs appended to start of markdown return assert.equal(writer.asString(), '# Hello\n\n'); }); +test('anchor tag IDs are escaped', function() { + var writer = mdWriter.writer(); + writer.open("h1", {id: "\"start\""}); + writer.text("Hello"); + writer.close("h1"); + return assert.equal(writer.asString(), '# Hello\n\n'); +}); + test('links have anchors before opening square bracket', function() { var writer = mdWriter.writer(); writer.open("a", {href: "http://example.com", id: "start"}); -- cgit v1.2.3