docs: add note about escaping heading IDs#11783
docs: add note about escaping heading IDs#11783mitre88 wants to merge 1 commit intofacebook:mainfrom
Conversation
Add a tip explaining how to escape the {#id} syntax in heading text using a backslash, so it is rendered literally instead of being interpreted as a custom heading ID.
Closes facebook#9725
|
Hi @mitre88! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
slorber
left a comment
There was a problem hiding this comment.
Thanks, ok to document this but not in a new tip blog, this should be part of the warning just above
|
|
||
| ::: | ||
|
|
||
| :::tip Escaping heading IDs |
There was a problem hiding this comment.
Work in underway regarding heading ids, see recent PRs
As the warning above says, you should avoid this syntax with MDX now.
In practice, the markdown.mdx1Compat.headingIds option automatically escapes, so my proposal would be to update the warning above to mention manual escaping is also possible
It is only supported in Docusaurus for backward compatibility, thanks to the
markdown.mdx1Compat.headingIdsconfig option, or by manually escaping the JSX expression:\{#id}
Motivation
Closes #9725
As mentioned in this comment, it's possible to escape the
{#id}heading ID syntax using a backslash, but this isn't documented anywhere.Changes
Added a tip admonition in the Heading IDs section of the TOC docs page explaining that users can escape
{#..}sequences with a backslash when they want the text to be rendered literally.Test Plan
The change is documentation-only (no code changes).