Giter Site home page Giter Site logo

rohit-gohri / redocusaurus Goto Github PK

View Code? Open in Web Editor NEW
570.0 9.0 105.0 20.65 MB

OpenAPI for Docusaurus with Redoc

Home Page: https://redocusaurus.vercel.app/

License: MIT License

JavaScript 12.21% CSS 16.43% TypeScript 63.75% Shell 3.35% MDX 4.26%
redoc docusaurus-plugin docusaurus openapi-documentation open-api openapi docusaurus2 hacktoberfest typescript documentation

redocusaurus's Introduction

Redocusaurus

npm npm Libraries.io dependency status for latest release Typed with TypeScript Build and Deploy GitHub branch checks state This project is using Percy.io for visual regression testing.

Redoc for Docusaurus.

Usage

Check the documentation on the website.

Demo

See Examples

Packages

A Docusaurus Preset that combines the below 2 packages to easily add API doc(s) to your docs site.

A wrapper around RedocStandalone to make it match the Docusaurus Theme with added support for Dark Mode.

A content plugin that creates pages from your OpenAPI files or URLs and renders them using the Redoc component from the theme.

Docs website and example project show casing the preset in action with multiple different OpenAPI specs.

Who is using Redocusaurus?

See Who is using Redocusaurus? section in docs.

Contributing

Any help is greatly appreciated, check the DEVELOPMENT.md for help on how to setup the project in your local and CONTRIBUTING.md for general info about the contribution workflow.

Motivation

To have the documentation and API reference in the same site with the same headers/footers. Read more in the blog post, OpenAPI for Docusaurus.

See this issue, https://github.com/facebook/docusaurus/issues/638, and this gist, https://gist.github.com/rohit-gohri/b1a19f37702cfe4a6c5a47933a11785b for more details and history.

License

MIT License. Copyright (c) 2024 Rohit Gohri

redocusaurus's People

Contributors

aleksimo avatar awarrenlove avatar baptistearno avatar benbrandt avatar dependabot[bot] avatar develolongscript avatar erickreutz avatar github-actions[bot] avatar homotechsual avatar huan avatar javorosas avatar jeff1010322 avatar joshtemple avatar jpeer264 avatar jrub avatar kimsauce avatar lysannep avatar mauris avatar michieldemey avatar mkrtchian avatar nikolaynikolaevn avatar oil-oil avatar qin-guan avatar rohit-gohri avatar serut avatar snivio avatar tomas-zijdemans-vipps avatar zabomate avatar zackerydev avatar zerkms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redocusaurus's Issues

While refreshing the already built page, the theme is all over the place

While reloading the page or building the redoc pages I get the warning: scrollYOffset value is a selector to non-existing element. Using offset 0 by default

I have not changed anything in the theme configuration.

Maybe this happens because my navbar is not constant but built by reading in a .json file synchronously.

This is how it should look like and is seen if I use the dev server or switch from another page to the api docs:
image

And this is how it happens to look after reloading:
image

Download, parse and cache schema from urls

Allow passing a url into the spec field. It should automatically download it and treat it just like passing a local file allowing for SSR with it.

We should add this as warning into the docs, that the docs may not live update and will require a rebuild. If someone wants live preview then they should use specUrl option instead

React 17 support

This plugin seems to fail if react 17 is installed. I know the dependencies also say it currently only supports 16 but it would be great if it would work with 17.

Module not found: Error: Can't resolve 'fs'

I've updated my docusaurus project to 2.0.0-beta.0 and redocusaurus is not working anymore due to this error

Module not found: Error: Can't resolve 'fs'

Module not found: Error: Can't resolve 'fs' in '/home/romain/Projets/help/node_modules/redoc/bundles'
Module not found: Error: Can't resolve 'process/browser' in '/home/romain/Projets/help/node_modules/yaml/browser/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Add a way to display multiple APIs together

Hello,

I would like to know if there is a way to display the docusaurus left sidebar.

Currently, using your plugin, I have a full page displaying the swagger doc :
Screenshot from 2021-09-20 10-38-05

But since I have a lot of microservices, I would like my user be able to access the left sidebar to choose the microservice he wants to view the API.
Screenshot from 2021-09-20 10-39-03

Overall, I'm looking an integration of redoc with the versionning and the page system of docusaurus.
I've seen that if I create an empty page that has the same URL than what I specified in the docusaurus.config.js file, redocusaurus has an higher priority than the empty page. So if I'm not wrong, I can simulate the versionning of the API using an empty page.

In the screenshot above, the link Processing > API > Overview is the empty page that has the same URL than what is in my conf. It works great so far.

Any help would be appreciated.

How can I ref another yaml

Hi Team,

Thank you provide this plugin for us.
Just a question.
How can I ref. another yaml file just like,

requestBodies:
    Pet:
      content:
        application/json:
          schema:
            allOf:
            - $ref: 'other.yaml#/components/schemas/Pet'

I tried it and there was no error.
But it didn't show on the web page.

Thank you very much!

Improve behaviour with Algolia search

Feature suggestion

I suppose that most users that need a search bar will use the Algolia plugin provided by docusaurus.

Using this search, it can happen that you click on an API hit result, and it takes you to the right page, but not to the correct heading. Most probably because the page can take a bit too long to load, depending on your OAS file.

Here is an example. Notice that:

  • the first search takes me to the top of the API docs, instead of the correct header.
  • the second time I go to the search hit works fine, as the page is loaded.

example

I understand that the load times are purely redoc-related and there's nothing this great plugin can do about it. But maybe we could have some kind of property to manage a timer until the browser tries to reach the anchor.
I'm not sure how to deal with this issue.

Any ideas?

Can't resolve 'fs' when trying to include specs

I'm trying to compile a site after making some docs changes. It did work flawlessly, but when I try to build the site, I get the following errors:

/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/resolve.js
Module not found: Can't resolve 'fs' in '/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib'/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/utils.js
Module not found: Can't resolve 'fs' in '/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib'/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/config/config.js
Module not found: Can't resolve 'fs' in '/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/config'/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/redocly/index.js
Module not found: Can't resolve 'fs' in '/Users/ruben/Git/app/node_modules/@redocly/openapi-core/lib/redocly'

For reference, I'm using:

    "@docusaurus/core": "~2.0.0-alpha.72",
    "@docusaurus/preset-classic": "~2.0.0-alpha.72",
    "redocusaurus": "~0.3.2"

And my Docusaurus.config.js redocusaurus field is:

    [
      'redocusaurus',
      {
        specs: [{
    spec: 'specs/api',
    routePath: path //this is an actual absolute path that I get with fs.resolve
}],
        theme: {
          primaryColor: '#f6b18f'
        }
      }
    ]

If I remove the plugin it does work, and if I try to put any other path or url in the "spec" field, I get the same error (I tried with the yaml provided in one of the examples and didn't work)

Small navigation sidebar styling issue

Thank you for working on this! :)

I noticed a small issue in the nav sidebar which is that the navigation's border does not go all the way up:

Bildschirmaufnahme.2021-07-05.um.13.46.25.mov

Basically this is because the left sidebar has top: 90px:

Bildschirmfoto 2021-07-05 um 13 47 09

while this could just be a padding-top resolving the issue:

Bildschirmfoto 2021-07-05 um 13 47 24

I tried searching for uses of these classes but couldn't find them otherwise I would have created a PR for them. Maybe it's an issue in redoc itself? Happy to create a PR if you can share some pointers.

Thank you!

Unable to build due to "Module not found: Can't resolve 'core-js/es/promise'"

I followed the instructions at https://www.npmjs.com/package/redocusaurus and I'm faced with the following build error:

tom@marvin ~/.../flow/docs/docusaurus % npm run build                  13:52:55

> [email protected] build /home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus
> docusaurus build

[en] Creating an optimized production build...

โœ– Client
  Compiled with some errors in 32.66s

โ— Server โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ building (70%) 831/831 modules 0 active
 



./node_modules/redoc/bundles/redoc.lib.js
Module not found: Can't resolve 'core-js/es/promise' in '/home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus/node_modules/redoc/bundles'
Client bundle compiled with errors therefore further build is impossible.
./node_modules/redoc/bundles/redoc.lib.js
Module not found: Error: Can't resolve 'core-js/es/promise' in '/home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus/node_modules/redoc/bundles'
 @ ./node_modules/redoc/bundles/redoc.lib.js 6760:17-46
 @ ./node_modules/docusaurus-theme-redoc/dist-jsx/theme/Redoc/Redoc.jsx
 @ ./node_modules/docusaurus-theme-redoc/dist-jsx/theme/Redoc/index.js
 @ ./node_modules/docusaurus-theme-redoc/dist-jsx/theme/ApiDoc/ApiDoc.jsx
 @ ./node_modules/docusaurus-theme-redoc/dist-jsx/theme/ApiDoc/index.js
 @ ./.docusaurus/registry.js
 @ ./node_modules/@docusaurus/core/lib/client/exports/ComponentCreator.js
 @ ./.docusaurus/routes.js
 @ ./node_modules/@docusaurus/core/lib/client/clientEntry.js
 @ multi ./node_modules/@docusaurus/core/lib/client/clientEntry.js
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `docusaurus build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/tom/.npm/_logs/2021-04-27T11_54_02_152Z-debug.log

error log listed at the bottom:

% cat /home/tom/.npm/_logs/2021-04-27T11_54_02_152Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus/node_modules/.bin:/home/tom/.cabal/bin:/home/tom/.ghcup/bin:/home/tom/.nix-profile/bin:/home/tom/.npm-global/lib/node_modules/bin/:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/:/home/tom/.cabal/bin:/home/tom/.ghcup/bin:/home/tom/.cabal/bin:/home/tom/.ghcup/bin:/home/tom/.nix-profile/bin:/home/tom/.npm-global/lib/node_modules/bin/:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/:/home/tom/.cabal/bin:/home/tom/.ghcup/bin:/home/tom/.cargo/bin:/home/tom/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin
9 verbose lifecycle [email protected]~build: CWD: /home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus
10 silly lifecycle [email protected]~build: Args: [ '-c', 'docusaurus build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `docusaurus build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/tom/Documents/scrive/kontrakcja/backend/flow/docs/docusaurus
16 verbose Linux 4.19.0-16-amd64
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v10.24.0
19 verbose npm  v6.14.10
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `docusaurus build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I've done some reading on various similar issues, but it doesn't look like I can fix this without trying to fix the deps that your package itself specifies.

keep a changelog

it would be nice to have a simple changelog.md to keep changes among versions

Issues with rendering when hosted and interesting interaction when using raw.github url

Hi,

I've been trying to use your tool to generate my docs for the last few days and a couple interesting things have come up. Firstly when I tried to reference my local spec I ran into the same issues others have with it being a multi-file spec, but when I reference the spec via its raw.github url using specUrl the doc was generated perfectly despite it being multiple files.

Onto the real issue, when I have my spec referenced with specUrl and its raw.github url and I run my app locally everything works great, but when I host the app via github pages the spec is no longer able to render and I see these errors in the console.

image

What's happening locally is exactly what we're looking for so any insights into what might be happening when it's hosted would be very much appreciated.

setGlobalData is not a function

Hi Rohit,

I'm getting this error when building my project after following the install instructions.

I'm on version 0.3.2 of redocusaurus.

TypeError: setGlobalData is not a function
    at Object.contentLoaded (/Users/joshtemple/repos/spectacles-docs/node_modules/docusaurus-theme-redoc/dist/index.js:27:13)
    at Promise.all.plugins.map (/Users/joshtemple/repos/spectacles-docs/node_modules/@docusaurus/core/lib/server/plugins/index.js:74:22)
    at Array.map (<anonymous>)
    at Object.loadPlugins (/Users/joshtemple/repos/spectacles-docs/node_modules/@docusaurus/core/lib/server/plugins/index.js:60:31)
error Command failed with exit code 1.

Support multi file OpenAPI definitions

This package is wonderful, and I've been having a blast working on prototyping serving some of my org's Swagger definitions with it. One thing I've run into, however, is an inability to use file refs as specified in https://redoc.ly/docs/resources/ref-guide/

This is fairly easily reproduced by opening up the example project in this repo, taking one of the schemas in the components section of the openapi.yaml (for example the ApiResponse component), moving it into a new file, and trying to reference it with $ref: './ApiResponse.yaml' (which is what I'd named the file I copied the component to).
image

I'm currently getting around this by using https://github.com/wework/speccy to merge my JSON Schemas into the same file as my Swagger API spec, however this is reasonably clunky and makes rapid updates locally a pain. I think that adding this functionality would be fantastic, especially for larger APIs, and even the Redocly team encourages breaking specs up into multiple files for readability/composition.

That all being said, I may just be doing something wrong, and this functionality may already exist within redocusaurus! If this is the case, I bet adding an example of this to the example project in this repo would help others who come across the same issue.

Hide right panel

Hi team.

The right panel is great but sometimes I want to hide it.
Do you have any idea?

I set redocOptions as follows:

theme: {
  primaryColor: '#1890ff',
  redocOptions: { // https://github.com/Redocly/redoc#redoc-options-object
    scrollYOffset: 60,
    theme: {
      rightPanel: {
        width: '0%',
        textColor: '#f00',
      }

but it doesn't work.

Multiple APIs?

Is it possible to have multiple APIs like https://github.com/cloud-annotations/docusaurus-plugin-openapi#multiple-openapi-definitions allows?

What we would like to have is menu entries in Docusaurus, each pointing to the documentation of an API (Redoc).
Is this possible with Redocusaurus? Like defining multiple plugin entries?

Also we need to specify the URL of each API, for example, https://localhost:8080, https://localhost:8081 ...
We would use it for documentation and hopefully with https://github.com/wll8/redoc-try to allow developers to try each API.

Webpack 5 error

when call:
docusaurus start

it throws:
Module not found: Error: Can't resolve 'path' in './node_modules/@redocly/openapi-core/lib/config'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

docusaurus version:
2.0.0-alpha.75

Add docs section to website

Current examples website leads a lot to be desired.

  • Add a separate docs section and move examples to a sub-path

Then add these docs:

  • Installation instructions
  • Add api spec
    • Customize doc path
  • Theming
    • Primary Color
    • Other Redoc Theme Options
  • Overriding Redoc Options
    • Download button
      • Custom url for download
  • Advanced Guides
    • Server Side Rendering
    • Importing into MDX

Module parse failed: 'import' and 'export' may appear only with 'sourceType: module'

I was like to add redocusaurus to my current docs setup. I have installed the package and added the default snippet from docs to presets key. After restart, I get this error to stdout:

Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> import { d as defaultTagPrefix, _ as _createForOfIteratorHelper, a as _typeof, b as _createClass, c as _classCallCheck, e as _defineProperty, Y as YAMLSyntaxError, T as Type, f as YAMLWarning, g as YAMLSemanticError, h as _slicedToArray, i as YAMLError, j as _inherits, k as _createSuper } from './PlainValue-ff5147c6.js';
| import { parse as parse$1 } from './parse-cst.js';
| import { b as binaryOptions, a as boolOptions, i as intOptions, n as nullOptions, s as strOptions, N as Node, P as Pair, S as Scalar, c as stringifyString, A as Alias, Y as YAMLSeq, d as YAMLMap, M as Merge, C as Collection, r as resolveNode, e as isEmptyPath, t as toJSON, f as addComment } from './resolveSeq-04825f30.js';

Part of my docusaurus.config.js:

  ...
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
          routeBasePath: '/', // Docs-only mode
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
    [
      'redocusaurus',
      {
        specs: [{
          specUrl: 'https://redocly.github.io/redoc/openapi.yaml',
        }],
      }
    ],
  ],
};

My package.json:

{
  "name": "docs",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "docusaurus": "docusaurus",
    "start": "docusaurus start",
    "build": "docusaurus build",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy",
    "serve": "docusaurus serve",
    "clear": "docusaurus clear"
  },
  "dependencies": {
    "@docusaurus/core": "2.0.0-beta.8",
    "@docusaurus/preset-classic": "2.0.0-beta.8",
    "@mdx-js/react": "^1.6.22",
    "clsx": "^1.1.1",
    "react": "^17.0.0",
    "react-dom": "^17.0.0",
    "redocusaurus": "^0.4.6"
  },
  "browserslist": {
    "production": [
      ">0.5%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Node version:

node -v
v16.10.0

Was already trying to remove node_modules dir and install from scratch but no difference.

Any advice on how to proceed?

Enabling additional languages for syntax highlighting in Docusaurus breaks Redocusaurus

How to reproduce

Add additional languages for the syntax highlighting in Docusarus (https://docusaurus.io/docs/markdown-features/code-blocks#supported-languages)

Example:

module.exports = {
  // ...
  themeConfig: {
    prism: {
      additionalLanguages: ['java'],
    },
    // ...
  },
};

The additional language is correctly enabled in Docusaurus, however, when navigating to a Redocusaurus page the following error is happening:

Uncaught (in promise) TypeError: lang is undefined

Screen Shot 2021-07-08 at 13 00 42

Dependencies used in package.json

"dependencies": {
    "@docusaurus/core": "2.0.0-beta.3",
    "@docusaurus/preset-classic": "2.0.0-beta.3",
    "@mdx-js/react": "^1.6.22",
    "@svgr/webpack": "^5.5.0",
    "clsx": "^1.1.1",
    "core-js": "^3.9.1",
    "docusaurus-theme-redoc": "^0.4.4",
    "file-loader": "^6.2.0",
    "prism-react-renderer": "^1.2.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "redoc": "^2.0.0-rc.54",
    "redocusaurus": "^0.4.4",
    "remark-mermaid-dataurl": "^1.0.1",
    "url-loader": "^4.1.1"
  },

Any idea of how to fix it?
Thanks

Dark mode text theme

I created a simple example and called my api docs specs, but when I try to view the full URL with dark mode in the right session (with responses and payloads), I get a lighter text in dark mode, similar to background color

image

When I turn on light mode, this text color has fixed

image

Build error

Hi @rohit-gohri,

first thanks for the great work.

i'm using redocusaurus in my project but i get error when build it:

Docusaurus Node/SSR could not render static page with path=/swagger/ because of error: Cannot read property 'style' of undefined

TypeError: Cannot read property 'style' of undefined
error building locale=en
Error: Failed to compile with errors.
at /Users/<>/Documents/Projects/<>/docs/node_modules/@docusaurus/core/lib/webpack/utils.js:198:24
at /Users/<>/Documents/Projects/<>/docs/node_modules/webpack/lib/MultiCompiler.js:554:14
at processQueueWorker (/Users/M</Documents/Projects/<>/docs/node_modules/webpack/lib/MultiCompiler.js:492:6)
at processTicksAndRejections (node:internal/process/task_queues:76:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Buffer is not defined, theme_apiDoc error on latest docusuarus version

config

module.exports = {
[
      'redocusaurus',
      {
        specs: [
          {
            routePath: '/api-public/',
            spec: './src/swaggers/public.json',
          },
          {
            routePath: '/api-private/',
            spec: './src/swaggers/public.json',
          },
        ],
      },
    ],
}

error

```jsx
Docusaurus Node/SSR could not render static page with path=/api-public because of error: Buffer is not defined
Docusaurus Node/SSR could not render static page with path=/api-private because of error: Cannot access 'theme_ApiDoc' before initialization

ReferenceError: Buffer is not defined
ReferenceError: Cannot access 'theme_ApiDoc' before initialization
at Array.forEach (<anonymous>)
  error building locale=pt-BR
  Error: Failed to compile with errors.
  at /app/node_modules/@docusaurus/core/lib/webpack/utils.js:198:24
  at /app/node_modules/webpack/lib/MultiCompiler.js:550:14
  at processQueue (/app/node_modules/webpack/lib/MultiCompiler.js:488:6)
  at processTicksAndRejections (internal/process/task_queues.js:75:11)

version

"@docusaurus/core": "2.0.0-beta.0",
"@docusaurus/preset-classic": "2.0.0-beta.0",
"redocusaurus": "^0.3.4",

Module not found: Error: Can't resolve 'process/browser'

Module not found: Error: Can't resolve 'process/browser' in 'app/node_modules/yaml/browser/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

related to #57

I've tried to polyfill like this

sitePlugin.js

const webpack = require('webpack');

// eslint-disable-next-line
module.exports = function (context, options) {
  return {
    name: 'custom-docusaurus-plugin',
    // eslint-disable-next-line
    configureWebpack(config, isServer, utils) {
      return {
        resolve: {
          alias: {
            path: require.resolve('path-browserify'),
          },
          fallback: {
            fs: false,
            http: require.resolve('stream-http'),
            https: require.resolve('https-browserify'),
            os: require.resolve('os-browserify/browser'),
          },
        },
        plugins: [
          new webpack.ProvidePlugin({
            process: 'process/browser',
          }),
        ],
      };
    },
  };
};

similar to #57 (comment)

Issue with collapsing code blocks

I'm encountering an issue where multi-line code blocks are collapsing into a single line (in Docusaurus articles). I believe this could have something to do with Redocusaurus (not 100% sure though). Or rather, an issue with Redoc specifically.

This issue in the Docusarusus repo is identical to the issue I'm facing: facebook/docusaurus#5443

If you go the URL mentioned in the issue (https://docs.talon.one/docs/dev/getting-started/overview/), scroll down to the first code block, and then hover over the Integration API or Management API link, the code block collapses into a single line.

Notice that this doesn't happen when hovering over any of the other navbar links.

Any insight would be appreciated as this is a real head scratcher for me.

Add documentation to website

The current website https://rohit-gohri.github.io/redocusaurus/ only has some examples. Add detailed documentation there and version it.

Current examples website leads a lot to be desired.

  • Add a separate docs section and move examples to a sub-path

Then add these docs:

  • Installation instructions
  • Add api spec
    • Customize doc path
  • Theming
    • Primary Color
    • Other Redoc Theme Options
  • Overriding Redoc Options
    • Download button
      • Custom url for download
  • Advanced Guides
    • Server Side Rendering
    • Importing into MDX

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.