-
Notifications
You must be signed in to change notification settings - Fork 247
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
Ensure Docusaurus v3 (MDX v3) compatibility #654
Comments
Since we are still in v2 beta yet, shall we consider making v2 release #439 compatible with docusaurus 3? |
Yes please. Our team is testing |
Yes. |
Is this already available? I need to use a plugin that requires docusaurus v3, and need react 18. |
@jasikpark Well, if you use OpenAPI >= 3.1.0 , you can use my plugin as starting this version, OpenAPI is fully compatible with JSON Schema |
Thank you for the suggestion, but I'm looking to keep the same plugin for the UI and design choices we've made, and because this OpenAPI plugin has purpose built components for showing api definitions. I'm more interested in teaching my users about how to use the API than being specific about the shape of the spec, it's just a nice way to format the documentation. |
For me, when running against my definition I get these errors:
<details style={{"marginBottom":"1rem"}} className={"openapi-markdown__details"} data-collapsed={false} open={true}><summary style={{}}><strong>Query Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"includeCounts","in":"query","description":"If true, return count of total records and current page start and count in metadata","required":false,"schema":{"type":"boolean","default":false}}}></ParamsItem><ParamsItem className={"paramsItem"} param={{"name":"cursor","in":"query","description":"Cursor value at which to start the results, provided in `nextCursor` or `prevCursor` of a prior request","example":"bmV4dA.eyJsb2dzLmNyZQ5iIiwiX3ZhbHVlIjo9In19","schema":{"type":"string"}}}></ParamsItem><ParamsItem className={"paramsItem"} param={{"name":"pageSize","in":"query","description":"Number of records to return in each page","required":false,"schema":{"type":"integer","default":25,"maximum":500}}}></ParamsItem></ul></div></details><div><div><ApiTabs><TabItem label={"200"} value={"200"}><div> Not sure exactly what the issue is.. https://mdxjs.com/playground/: ![]() |
![]() https://docusaurus.io/blog/preparing-your-site-for-docusaurus-v3#unintended-extra-paragraphs |
When I ran into that it was due to the lack of new line chars and the presence of non-escaped characters. I did replacements following Docusaurus migration guide: |
I managed to fix the MDX output with this simple patch, it's very rudimentary but diff --git a/lib/markdown/utils.js b/lib/markdown/utils.js
index 09d5baef75e5f495c19610021771094463e69ce5..19519432acbe3918dc2db90246bf184fee53f2d5 100644
--- a/lib/markdown/utils.js
+++ b/lib/markdown/utils.js
@@ -13,7 +13,7 @@ function create(tag, props) {
for (const [key, value] of Object.entries(rest)) {
propString += ` ${key}={${JSON.stringify(value)}}`;
}
- return `<${tag}${propString}>${render(children)}</${tag}>`;
+ return `\n<${tag}${propString}>${render(children)}</${tag}>\n`;
}
exports.create = create;
function guard(value, cb) { However, the UI still crashes with |
Anyone have a chance to try |
I left a comment here #660 (comment), but tldr, everything looks to be working well, except for some syntax highlighting |
With Great work on the quick release! |
After some more testing I ran into an issue with path parameters. Looking at the Swagger specifications for describing parameters, each parameter is denoted with curly braces. In MDX3 these parameters will be considered to be expressions (see the Docusaurus migration guide for this common issue as well). Thus, for endpoints with path parameters (in this specific case |
I believe this issue was addressed in v2 #663 and will be ported to v3 soon. |
After another inspection I noticed that this error occurs because of parameters that are in the description. We use this to, for example, show what endpoints you should use instead of an deprecated endpoint. I believe this is another issue than is described in #663 (but I might be mistaken). Since the specifications allow you to use curly braces in summaries, descriptions and other places, I think it would be nice if these are escaped by default where possible. |
@sserrata I tested out 3.0.0-beta.1 and mostly everything looks good, thank you! The mdx files all compile and pass
I get this error when there are multiple |
I found that the recent changes in v3 are causing problems in the mermaid diagrams used in the info page description. v2 (ok):
v3.0.0-beta.2 (error):
As a temporary solution, I solved this with a custom Everything else works fine for me with |
Yep, you're totally right, adding |
When I was testing with following testcases, got these errors
ERROR
could not find react-redux context value; please ensure the component is wrapped in a <Provider>
at useReduxContext (webpack-internal:///./node_modules/react-redux/es/hooks/useReduxContext.js:31:11)
at useSelector (webpack-internal:///./node_modules/react-redux/es/hooks/useSelector.js:136:28)
at MethodEndpoint (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/lib/theme/ApiExplorer/MethodEndpoint/index.js:6:932)
at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:16306:18)
at mountIndeterminateComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20070:13)
at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21583:16)
at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4165:14)
at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4214:16)
at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4278:31)
at beginWork$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:27447:7)
ERROR
Hook useScrollController is called outside the <ScrollControllerProvider>.
ReactContextError
at useScrollController (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-common/lib/utils/scrollUtils.js:27:145)
at useScrollPositionBlocker (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-common/lib/utils/scrollUtils.js:45:63)
at TabList (webpack-internal:///./node_modules/docusaurus-theme-openapi-docs/lib/theme/MimeTabs/index.js:20:339)
at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:16306:18)
at mountIndeterminateComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20070:13)
at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21583:16)
at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4165:14)
at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4214:16)
at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4278:31)
at beginWork$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:27447:7) |
As far as my testing brought me any difference in version matching between docusaurus and docusaurus-plugin-openapi-docs will cause issues with redux and hooks. I feel like this might be due to slight mismatches in dependencies, comparable to this issue. You should be able to use the v3.0.0-beta.3 release in combination with docusaurus 3.0.1. It will not work with docusaurus 3.0.0 or any older versions. |
I think this issue still persists with v3.0.0-beta.3, and is due to some necessary updates in the theme package. I started refactoring this package but this is a somewhat slow process... |
Thanks for the response. But the issue is still in the combination (v3.0.1 - v3.0.0-beta.3) |
Hello! Adding |
Have you tried deleting your |
for me it does not help package.json
still have the error:
|
Sure, I have deleted and reinstalled all the things with "@docusaurus/core": "3.0.1" and "docusaurus-plugin-openapi-docs": "^3.0.0-beta.3". But it doesn't work with same react-redux error |
I am getting the same error as @kjeom Running these versions:
So does not seem to be only a 3.0.0 issue. |
versions:
|
I have also checked it working well
|
Hello i m still facing the issue, with those versions. |
I'm also facing same issue as
|
You should refer #654 (comment) change the |
I'm still hitting the |
Try to cleanup the generated api docs and run. Also check that |
Thank you this is working now |
Is there a recommended way to do that? I can go through and remove the accidental newlines in the generated mdx files manually, but it would take ages on the petstore example to do by hand. I've got |
Hello, I am also getting following error, as soon as I click on one of the endpoint displayed in sidebard
|
same config and same error :( |
Yes same here |
There's an Open PR #660, What's missing on that PR to be merged and release v3.0? |
Same, plus "Expected a closing tag for |
Hi, have you tried it after deleting .lock and node_module files? I checked it doesn't occur the error with #654 (comment) |
@kjeom That worked. Thank you! That solved the following issues:
More things that helped me to solve other problems:
|
I appreciate that everyone's bringing up issues and helping each other here, but I'm very confused as to the current state of the plugin. Is it fully compatible with docusaurus v3, or are the approaches here just workarounds until the plugin is updated to work with v3? @sserrata could you share what you believe to be the current state? That would really help bring clarity to those of us waiting to update. |
Hi everyone, the latest v3 beta is definitely not tested with the latest docusaurus (3.1.1). It's possible a breaking change was introduced in docusaurus, which is quite common for plugins/themes. That said, I would recommend downgrading to either 3.1.0 or 3.0.1. Also, please ensure all docusaurus dependencies are on the same release - this sometimes requires configuring yarn resolutions or manually pinning versions in package.json. |
Great, so it sounds like v3 beta is compatible with at least some versions of docusaurus 3.x? If so, I'd suggest closing out this issue so that people can open separate individual ones if they have problems. |
Had to make these changes to dedupe dependencies:
After that I don't see major dupes anymore:
Make sure to include these to avoid the Redux Provider error:
After that the only issue remaining seems to be
|
Closing my issue 👍 |
Could you please give me an example of how to use a custom markdownGenerators->createInfoPageMD function? |
Is your feature request related to a problem?
I would like to easily upgrade my Docusaurus site to v3 in the future (https://docusaurus.io/blog/preparing-your-site-for-docusaurus-v3) and I'm uncertain whether this plugin supports Docusaurus v3 / MDX v3
Describe the solution you'd like
Confirmation that the plugin works with the updated framework version
Describe alternatives you've considered
Additional context
Just trying to open a preemptive issue so testing can be started before full release
The text was updated successfully, but these errors were encountered: