Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

[BUG] Anchors may have invalid chars that break the links #30

Open
Fred-Vatin opened this issue Jul 12, 2017 · 1 comment · May be fixed by #92
Open

[BUG] Anchors may have invalid chars that break the links #30

Fred-Vatin opened this issue Jul 12, 2017 · 1 comment · May be fixed by #92

Comments

@Fred-Vatin
Copy link

VS Code version OS Extension version
1.14.0 Win 10 x64 pro (french) 14393 0.8.1

Steps to reproduce

Use extension to create/update the TOC will produce this:

<!-- TOC -->

- [Valid link](#valid-link)
- [Invalid _link_](#invalid-_link_)
- [Another invalid link ([a link](https://link.com))](#another-invalid-link-a-linkhttpslinkcom)

<!-- /TOC -->

<a id="markdown-valid-link" name="valid-link"></a>
## Valid link

<a id="markdown-invalid-_link_" name="invalid-_link_"></a>
## Invalid _link_


<a id="markdown-another-invalid-link-a-linkhttpslinkcom" name="another-invalid-link-a-linkhttpslinkcom"></a>
## Another invalid link ([a link](https://link.com))

Results

Second and third links are broken in TOC.

Expectations

Extension must remove invalid chars such as _ or links in title to build valid reference targets. So the code above should be:

<!-- TOC -->

- [Valid link](#valid-link)
- [Invalid _link_](#invalid-link)
- [Another invalid link (a link)](#another-invalid-link)

<!-- /TOC -->

<a id="markdown-valid-link" name="valid-link"></a>
## Valid link

<a id="markdown-invalid-link" name="invalid-link"></a>
## Invalid _link_

<a id="markdown-another-invalid-link" name="another-invalid-link"></a>
## Another invalid link ([a link](https://link.com))

Note: the third link still won't work in VSCode but do in GitHub.

Regards

@alanwalk
Copy link
Owner

Thank your for your issue.
I had fixed it, i will release new version in recent days.

mcornella added a commit to mcornella/markdown-toc that referenced this issue Sep 23, 2020
@mcornella mcornella linked a pull request Sep 23, 2020 that will close this issue
mcornella added a commit to mcornella/markdown-toc that referenced this issue Sep 23, 2020
mcornella added a commit to mcornella/markdown-toc that referenced this issue Nov 2, 2020
Fixes wrong removal of _ in headers introduced in fe9b778

Fixes alanwalk#30
mcornella added a commit to mcornella/markdown-toc that referenced this issue Nov 2, 2020
Fixes wrong removal of _ in headers introduced in fe9b778

Fixes alanwalk#30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants