-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
feat(core): add new site config option siteConfig.markdown.anchors.maintainCase
#10064
feat(core): add new site config option siteConfig.markdown.anchors.maintainCase
#10064
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you need to add config validation schema in packages/docusaurus/src/server/configValidation.ts
. Also, do we really want to make maintainCase
required? I think it should be anchor?: { maintainCase?: boolean }
so anchor: {}
is still valid, especially if we have other options in the future.
Hey, I added validation to the config and made all fields optional. Please check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks 👍
siteConfig.markdown.anchors.maintainCase
Added an option to preserve case then using github slugger as discussed in this comment. This option is disabled by default.
Pre-flight checklist
Motivation
This PR closes #7946. I encountered this issue while migrating large docs site to the Docusaurus. We also used mdx and Github slugger but with default options. After migrating we had hundreds of broken anchor links in our docs. Using https://docusaurus.io/docs/cli#docusaurus-write-heading-ids-sitedir helped, but it was updating the original mdx files which was not optimal.
Test Plan
I added a test case for this plugin option. See https://github.com/iAdramelk/docusaurus/blob/10ad71855edc3977c2c0eb75951c0a42952155f3/packages/docusaurus-mdx-loader/src/remark/headings/__tests__/index.test.ts#L323-L337
Test links
Changes:
heading
plugin.Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
#7946