diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:41:12 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:41:12 +0000 |
| commit | 7d5456c657d4460e26aee6737211e867f6757f01 (patch) | |
| tree | cfba1e178063a30c107c3ea5004f0521b510577a /test | |
| parent | c0b09a409ba7dd859aa54ff1e603eab1c1e38c91 (diff) | |
Escape HTML tag and entity characters in Markdown writer
Diffstat (limited to 'test')
| -rw-r--r-- | test/writers/markdown-writer.tests.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/writers/markdown-writer.tests.js b/test/writers/markdown-writer.tests.js index 578e6ff..3beec47 100644 --- a/test/writers/markdown-writer.tests.js +++ b/test/writers/markdown-writer.tests.js @@ -330,3 +330,15 @@ test('generates correct spacing between paragraphs and lists', function() { writer.close("p"); return assert.equal(writer.asString(), "Hello World\n\n- First Item\n- Second Item\n\nHello World\n\n"); }); + +test("HTML tag characters are escaped", function() { + var escaped = mdWriter._escapeMarkdown("<br/>"); + + assert.strictEqual(escaped, "\\<br/\\>"); +}); + +test("HTML entity characters are escaped", function() { + var escaped = mdWriter._escapeMarkdown("&"); + + assert.strictEqual(escaped, "\\&"); +}); |
