✨ Feature request
Parse inline HTML markup also, for things that cant' be defined in markdown directly, such as <time>, <span class="some-class">.
Motivation
Sometimes we want support raw-markup inline in markdown string, for things that can't be represented in markdown.
My use case is browser extension's localization messages, where I had to include a <time> element in a string.
Example
const html = render(markdown, {
// bold: (node) => `<b>${node.children}</b>`,
// ...
raw: (node) => {
if (node.tag !== 'time') return null;
return `<${node.tag} datetime="${node.attrs.datetime}">${node.children}</${node.tag}>`, // ignore all attributes except `datetime`
}
})
<!-- input -->
hello <time datetime="foo" style="ignored">foo</time> world <img src="oh no" />
<!-- output -->
hello <time datetime="foo">foo</time> world
Alternatives
Some other much heavier library
Additional context
For simplicity, I think we can require well-formed XML, and leave rendering to users. As long as parsing is light (and told explicitly that it's unsafe), I think this can be a good addition.
✨ Feature request
Parse inline HTML markup also, for things that cant' be defined in markdown directly, such as
<time>,<span class="some-class">.Motivation
Sometimes we want support raw-markup inline in markdown string, for things that can't be represented in markdown.
My use case is browser extension's localization messages, where I had to include a
<time>element in a string.Example
Alternatives
Some other much heavier library
Additional context
For simplicity, I think we can require well-formed XML, and leave rendering to users. As long as parsing is light (and told explicitly that it's unsafe), I think this can be a good addition.