alanwalk / markdown-toc

MarkdownTOC(Table Of Contents) Plugin for Visual Studio Code.
MIT License
141 stars 111 forks source link

Are Hyperlinks on Headers Not Supported? #56

Open bayu01 opened 6 years ago

bayu01 commented 6 years ago

Hello, I was trying to have subsections that are actually hyperlinks to other documents but the ToC generates my subsections with nested looking hyperlinks that are not working.

Steps to reproduce:

  1. After the comments, generate an H1 with some text.
  2. Generate an H2 under the H1 text.
  3. Convert the H2 section to a hyperlink to some resource. e.g:
    # My H1 section
    ## [My H2 section](www.example.com)

Expected ToC:

- [My H1 section](#my-h1-section)
    - [My H2 section](#my-h2-section)

Actual ToC:

- [My H1 section](#my-h1-section)
    - [[My H2 section](www.example.com)](#my-h2-section)

Is there a workaround for this issue?

caraya commented 5 years ago

If you want the TOC to point to the external resource, you'll have to change the link in the TOC to point to the resource you want or put the link inside the text of the section.