feat(core): add new site config option siteConfig.markdown.anchors.maintainCase#10064
Merged
slorber merged 9 commits intofacebook:mainfrom Apr 25, 2024
Merged
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Josh-Cena
requested changes
Apr 21, 2024
Collaborator
Josh-Cena
left a comment
There was a problem hiding this comment.
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.
Contributor
Author
|
Hey, I added validation to the config and made all fields optional. Please check. |
siteConfig.markdown.anchors.maintainCase
This was referenced May 24, 2024
This was referenced May 25, 2024
This was referenced May 25, 2024
This was referenced Aug 27, 2024
This was referenced Sep 4, 2024
This was referenced Sep 8, 2024
This was referenced Sep 11, 2024
This was referenced Sep 28, 2024
This was referenced Oct 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
headingplugin.Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
#7946