markdown-it-github-headings
markdown-it-github-headings copied to clipboard
Size of innertext dependency
The innertext dependency is dependent on html-entities which results in an extra 46.2 KB or 13.82 KB gzip'd.
Could innertext be replaced with a more lightweight library?
Sure! We'll happily accept pull requests to do this!
I'm working on it and noticed the following. Without changing the dependency yet, the following test runs succesfully
test('innertext', function (t) {
var result = md().use(anchor, { prefix: 'foo-' }).render('# Hello <b>there</b>')
var expectedResult = `<h1><a id="foo-hello-bthereb" class="anchor" href="#hello-bthereb" aria-hidden="true">${svg}</a>Hello <b>there</b></h1>\n`
t.equals(result, expectedResult, 'works')
t.end()
})
Is it intended that the id includes the tag-name b?
Using .render('<h1>Hello <b>there</b></h1>') results in no header element at all.
Sorry for the late reply on this... No I don't think that is intended!