markdown-toc icon indicating copy to clipboard operation
markdown-toc copied to clipboard

Markdown links in headings

Open microbouji opened this issue 7 years ago • 1 comments

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).

microbouji avatar Jun 29 '18 12:06 microbouji

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()

cspotcode avatar Dec 19 '19 22:12 cspotcode