Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji (character or code) in heading causes broken TOC link #98

Closed
benji-bou opened this issue Feb 20, 2018 · 5 comments
Closed

Emoji (character or code) in heading causes broken TOC link #98

benji-bou opened this issue Feb 20, 2018 · 5 comments
Labels
Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.

Comments

@benji-bou
Copy link

benji-bou commented Feb 20, 2018

When adding emoji in a Header the generated link in TOC is broken.
It seems that (in the case of the warning emoji) there is extra code %E2%9A%A0 and if the "shortcode" is used it add an extra "warning" at the end of link

The link is correct inside Visual Studio itself, but the visual studio preview and on gitlab the link is broken

To fix the link (in this particular case (with warning emoji)) we need to manually disable the "markdown.extension.toc.updateOnSave"
and remove the extra code %E2%9A%A0 or remove the warning (in case of "shortcode") in the generated toc link

Add a Header with the Warning Emoji and generate TOC
--> It doesn't work when generated

- [Test ⚠️](#test-%E2%9A%A0%EF%B8%8F)
- [Test \:warning\:](#test-warning)

## Test ⚠️
## Test 2 :warning:

--> It works when

- [Test ⚠️](#test-EF%B8%8F)
- [Test \:warning\:](#test-)

## Test ⚠️
## Test 2 :warning:

Best

@yzhang-gh
Copy link
Owner

I see. That is because the anchor/link will be encoded (just like space will be encoded to %20).
related #90.

@benji-bou
Copy link
Author

Hi,

Ok, you think the encodeUrl you want to implement will fix this problem as well? Do you have a due date for this fix?

Good extension By the way 👍
Best

@yzhang-gh
Copy link
Owner

I will get back to you on Feb 25 😉

yzhang-gh pushed a commit that referenced this issue Feb 25, 2018
@yzhang-gh
Copy link
Owner

yzhang-gh commented Feb 25, 2018

If you set encodeUri to false, it will be

# Test ⚠️
# Test 2 :warning:

- [Test ⚠️](#test-⚠️)
- [Test 2 :warning:](#test-2-warning)

That means ⚠️ will remain the same rather than being encoded into %%E2%9A%A0...


The upcoming vscode monthly build has some breaking changes so I would like to update this extension later. But if you need, I can also package a beta version in advance.

@yzhang-gh
Copy link
Owner

v1.1.0 released

@Lemmingh Lemmingh added Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release. labels Aug 27, 2021
@Lemmingh Lemmingh changed the title Emoji used in header and generated TOC problem Emoji (character or code) in heading causes broken TOC link Aug 27, 2021
Repository owner locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Link (Reserved) Markdown link processing, URI recognition, slugification. Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.
Projects
None yet
Development

No branches or pull requests

3 participants