-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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(v2): docs, make numberPrefixParser configurable, better defaults, minor breaking-changes #4655
Conversation
…sing date/version patterns by default
[V1] Built with commit 57559ec |
[V2] Built with commit 57559ec |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4655--docusaurus-2.netlify.app/ |
[V2] Built with commit 1805a93 |
Size Change: 0 B Total Size: 630 kB ℹ️ View Unchanged
|
[V1] Built with commit 1805a93 |
Not really sure where I should comment, but I would like to propose that
If we want to add slightly more complexity, |
@valentine we have the infra in place for customizations, and PRs are welcome. I don't think we'll ever find the perfect opinionated regex to fit all usecases by default. Some users would be happy if Note that we don't extract number prefixes if there is no separator such as If you want these heuristics to keep being improved please open a proper bug report explaining how something is affecting you in practice. I think you didn't encounter any bug or annoyance yet right? |
@slorber Thanks for your thoughts. Yes, this won't affect me, especially after alpha.74 is released. I was preemptively thinking how it might be possible to make this feature better, but it looks like I completely looked past how a number without a separator won't be affected anyway. |
Motivation
Alpha 73 introduced autogenerated sidebars with support for number prefixes like
01-My Folder/02-My Doc
.This default non-configurable logic is annoying for some users that use numbers in filenames that should rather not be interpreted as numbers prefixes by default:
2021-01
: [v2.0.0-alpha.73] autogenerated sidebars: have a stripNumberPrefixes option in config file? #46408.0.0/MyDoc
: [2.0.0-alpha.73] Numeric value in subdirectory of DOCS yields issues with sideba #4653As it's impossible to predict all possible filename patterns that a Docusaurus would like to use, we try to provide good opinionated defaults and ignore some common patterns.
This new default behavior can be disabled entirely and revert back to a post-alpha-73 behavior, or the user can also provide its own parsing logic:
Minor breaking changes (from alpha.73):
strip_number_prefix
toparse_number_prefix
for consistencyHave you read the Contributing Guidelines on pull requests?
yes
Test Plan
tests