diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-09-26 22:28:05 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-09-26 22:28:05 +0100 |
| commit | d302d0755e075811a37268f4cef00e7c54cb409a (patch) | |
| tree | 9ef351b65000d176a1edc39cbeef8bcce5dee6a2 /test/writers/markdown-writer.tests.js | |
| parent | 671dbb6ae5738d6bf8f97d13dd08bfc0a23e0b04 (diff) | |
Escape HTML IDs in markdown writer
Diffstat (limited to 'test/writers/markdown-writer.tests.js')
| -rw-r--r-- | test/writers/markdown-writer.tests.js | 8 |
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=""start""></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"}); |
