syntax-tree/mdast-util-toc

`footnote` and `footnoteReference` in headings cause links in links

wooorm opened this issue · 0 comments

Subject of the issue

We allow phrasing content in headings, and copy those over to the links in the toc:
6fbb123

You don’t want links in links, so we ignore those:

if (node.type === LINK || node.type === LINK_REFERENCE) {
return all(node.children)
}

But footnotes and footnote references (which previously came from remark but are now in remark-footnotes) also result in links. Thus creating a in as, which is nonconforming HTML.

Your environment

n/a

Steps to reproduce

# Heading[^1]

Expected behaviour

- [Heading](#heading)

Actual behaviour

- [Heading[^1]](#heading)