Redoc for Docusaurus v2.
Usage
- Install redocusaurus:
npm i --save redocusaurus
yarn add redocusaurus
-
Add it as a preset to your docusaurus config along with @docusaurus/preset-classic and pass options:
- Pass it a path to a local OpenAPI YAML file
module.exports = {
presets: [
'@docusaurus/preset-classic',
[
'redocusaurus',
{
specs: [
{
spec: 'openapi/openapi.yaml',
route: '/api/',
},
],
theme: {
primaryColor: '#1890ff',
},
},
],
],
};
-
OR Pass it a OpenAPI spec URL
module.exports = {
presets: [
'@docusaurus/preset-classic',
[
'redocusaurus',
{
specs: [
{
spec: 'https://redocly.github.io/redoc/openapi.yaml',
route: '/api/',
},
],
theme: {
primaryColor: '#1890ff',
},
},
],
],
};
The API Doc will be available at the route specified (/api/
in the example above). To customize it see full plugin options.
Options
specs
Pass it an array of plugin options, see docusaurus-plugin-redoc for individual option details.
theme
Pass options to customize the theme, see docusaurus-theme-redoc for individual option details.
Docs
See: https://redocusaurus.vercel.app/docs