markdown-toc
markdown-toc copied to clipboard
Markdown links in headings
toc("# [full](link)\n\n # Link [inside](header)").content;
// Results in:
// - [full](#full)
// - [Link [inside](header)](#link-insideheader)
So it's correctly titleizeing the first case where the full header consists of just a link, but in the second case it's putting a link inside the link.
I believe the title of the second heading should become [Link inside] (and maybe the default slug also (#link-inside) but that's probably a different, even if related, issue).
I am hitting the same issue. I want to use markdown-toc to generate a TOC for a markdown file that will live in a Github README. We have links in headers.
# Header with [Link](https://example.com)
markdown-toc should be generating a TOC entry with the text "Header with Link" and a slug of "header-with-link" since that is the anchor generated by Github.
Does remarkable have an API for getting the text, not HTML, of a markdown node? If so, titleize can be updated to replace tok.content with tok.getTextContents()