vscode-markdown: Links to headings with emoji code may be broken

What is the problem?

When an emoji is present in the heading, that heading will have the url broken because the extension will completely strip the emoji out of it, instead of including without the colon. I could disable the updateOnSave feature and manually change the URLs, but that wouldn’t prevent from erasing all my changes if i accidentally update it (since i’m used to it 😢).

How can I reproduce it?

  1. Create a file with the following text:
# :book: This won't work
# This won't work either :smile: 
# This will
  1. Place the cursor at the start of the first line
  2. Press <kbd>Ctrl</kbd> +<kbd>Shift</kbd> + <kbd>P</kbd>
  3. Search for Markdown All in One: Create Table of Contents and click on it

As you can see the emojis are stripped out of the link, where they should be present but without the colon.

I created a sample gist containing the lines i mentioned before.

Is there any error message in the console?

No


Thank you for your great work 😄

Best Regards, Luca

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for answering so quickly! With emojis I meant GitHub’s recognized emoji code and yes, my slugifyMode is set to github.

This input:

# Section 1
...
## :bangbang: Subsection 1
...
## :orange_book: Subsection 2
...

yields the following TOC in version 2.8 and lower (this is the expected output):

- [Section 1](#section-1)
  - [:bangbang: Subsection 1](#bangbang-subsection-1)
  - [:orange_book: Subsection 2](#orangebook-subsection-2)

However, in version 3+, the TOC looks as follows (the emoji code is no longer converted, but simply removed - the links are now broken):

- [Section 1](#section-1)
  - [:bangbang: Subsection 1](#️-subsection-1)
  - [:orange_book: Subsection 2](#-subsection-2)

Thank you all for the information.

Here is the result on my PC

So if you are using :book:, the link does contain a book.

Can you try again with other (Markdown) extensions disabled?