Closed JMcKiern closed 4 years ago
Thanks, I was considering your PR for a while, I even reworked it into:
var escape = ((
xml = new XMLSerializer(),
node = document.createTextNode('')
) => (input) => {
node.textContent = input
return xml.serializeToString(node)
})()
Which theoretically should have better performance .. in cases of huge markdown documents with lots of headers ..
Anyway, in the end I went on with this:
title: node.innerText.replace(/</g, '<').replace(/>/g, '>')
The XMLSerializer
additionally escapes &
but I prefer being a bit more explicit + escaping just <>
should be fine I think.
Will publish it shortly :+1:
Fixes #103