Repository navigation
feat(v2): docs, make numberPrefixParser configurable, better defaults, minor breaking-changes - #4655
Conversation
…sing date/version patterns by default
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4655--docusaurus-2.netlify.app/ |
|
Size Change: 0 B Total Size: 630 kB ℹ️ View Unchanged
|
|
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. |
…, minor breaking-changes (meta#4655) * make number prefix parsing logic configurable * Make numberPrefixParser configurable + rename frontmatter + avoid parsing date/version patterns by default * add more tests * more test cases
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_prefixtoparse_number_prefixfor consistencyHave you read the Contributing Guidelines on pull requests?
yes
Test Plan
tests