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

Add note about escaping header ids #9725

Open
1 of 2 tasks
thadguidry opened this issue Jan 10, 2024 · 3 comments
Open
1 of 2 tasks

Add note about escaping header ids #9725

thadguidry opened this issue Jan 10, 2024 · 3 comments
Labels
documentation The issue is related to the documentation of Docusaurus
Milestone

Comments

@thadguidry
Copy link
Contributor

Have you read the Contributing Guidelines on issues?

Description

The current docs didn't mention about the new syntax conventions (or options) for header ids as @slorber mentioned at #3321 (comment)

A bit more detail about that should ideally be added to the page https://docusaurus.io/docs/markdown-features/toc#heading-ids ?

Self-service

  • I'd be willing to address this documentation request myself.
@thadguidry thadguidry added documentation The issue is related to the documentation of Docusaurus status: needs triage This issue has not been triaged by maintainers labels Jan 10, 2024
@slorber slorber added this to the 4.0 milestone Jan 11, 2024
@slorber
Copy link
Collaborator

slorber commented Jan 11, 2024

Hi @thadguidry

Docusaurus v3 is retrocompatible regarding heading ids with v2, and this doc remains relevant and accurate.

https://docusaurus.io/docs/api/docusaurus-config#markdown

https://docusaurus.io/docs/migration/v3#headingids-option

CleanShot 2024-01-11 at 13 36 20@2x

TLDR: until we provide a new syntax and deprecate the old one, I think it's fine to keep the docs as is.

I've added this issue for the Docusaurus v4 milestone, but it's not just documentation, it's also proposing and implementing the new syntax + a smooth migration plan.

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Jan 11, 2024
@damageboy
Copy link

When the mdxv1 compat option is turned on, are users expected to escape the heading id's or now.

The wording around "This syntax is now invalid" doesn't help would be users in understanding if thet are expected
to re-write the explicit ids with mdxv1compat turned on or not.

@slorber
Copy link
Collaborator

slorber commented Apr 5, 2024

When the mdxv1 compat option is turned on, are users expected to escape the heading id's or now.

I recommend to not do anything and keep the heading as is until we provide a better replacement.

But there are cases where you might want need escape: if you use additional tools (like VSCode extensions, syntax highlighters or whatever else exists) that require a valid MDX document. Without escaping \{, your document is invalid, and it's possible that those tools report you errors (and they are right, because they don't know about our compatibility option).

That's the only reason I can think of to rewrite your headers with escaping right now. Unless you have a good reason to rewrite headings, you'd rather keep them as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation The issue is related to the documentation of Docusaurus
Projects
None yet
Development

No branches or pull requests

4 participants
@damageboy @slorber @thadguidry and others