fix(validation): allow non-object params to remark/rehype plugins #6977
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.
Remark and Rehype plugins allow having options as a non-object type, such as a string.
For instance, the official MDX docs even have an example of this:
Apparently it may also be possible for a unified plugin to have multiple option parameters (see docs), however:
Motivation
Docusaurus validation is too strict for
remarkPlugins
andrehypePlugins
.Have you read the Contributing Guidelines on pull requests?
Yes ✔️
Test Plan
I've added a test case in
packages/docusaurus-utils-validation/src/__tests__/validationSchemas.test.ts
Additionally, I've also tested by doing the following:
However, once I modified the
node_modules/@docusaurus/utils-validation/lib/validationSchemas.js
to match this PR,npm start
worked!Related PRs
#4412 would have made this bug a lot easier to debug.
Additionally, #4412 (comment) has some discussion about whether:
docusaurus/packages/docusaurus-utils-validation/src/validationSchemas.ts
Line 24 in 4b3f568
is correct. From my research, I also agree that it's unlikely that it will work too (but I'm not certain)