aboutsummaryrefslogtreecommitdiff
path: root/test/writers/markdown-writer.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-09-26 22:28:05 +0100
committerMichael Williamson <mike@zwobble.org>2026-09-26 22:28:05 +0100
commitd302d0755e075811a37268f4cef00e7c54cb409a (patch)
tree9ef351b65000d176a1edc39cbeef8bcce5dee6a2 /test/writers/markdown-writer.tests.js
parent671dbb6ae5738d6bf8f97d13dd08bfc0a23e0b04 (diff)
Escape HTML IDs in markdown writer
Diffstat (limited to 'test/writers/markdown-writer.tests.js')
-rw-r--r--test/writers/markdown-writer.tests.js8
1 files changed, 8 insertions, 0 deletions
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(), '# <a id="start"></a>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(), '# <a id="&quot;start&quot;"></a>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"});