Explicit IDs for markdown headings fail to parse dots #7603
Labels
bug
An error in the Docusaurus core causing instability or issues with its execution
domain: markdown
Related to Markdown parsing or syntax
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
The documentation describes the ability to choose a specific id for a markdown heading: https://docusaurus.io/docs/markdown-features/toc#heading-ids
This works in some cases, but the parser fails when dots are included in the id, which is a valid character for ids in html pages. The id definition will just be considered to be part of the heading.
Example image:

Reproducible demo
https://codesandbox.io/s/docusaurus-explicit-id-bug-ffjjmv?file=/docs/intro.md
Steps to reproduce
Define a markdown heading with an explicit id that contains dots. Eg:
Changes 2022.6.0 {#2022.6.0}
Expected behavior
I would expect a heading to be added with the text "Changes 2022.6.0" and the id "2022.6.0".
Actual behavior
A heading is added with text "Changes 2022.6.0 {#2022.6.0}" and the id "changes-202260-202260".
Your environment
Self-service
The text was updated successfully, but these errors were encountered: