@chargeover/docusaurus-theme-redoc
Version:
Redoc Component for DocusaurusV2
93 lines (62 loc) • 2.46 kB
Markdown

This theme provides a `Redoc` and a `ApiDoc` theme component with a theme matching the default docusaurus classic theme and with dark mode support.
⚠️⚠️⚠️ NOTE: Not recommended for direct use. Use through main package instead: [`redocusaurus`](https://github.com/rohit-gohri/redocusaurus)
1. Install theme:
```sh
npm i --save docusaurus-theme-redoc
```
1. Add it as a theme to your docusaurus config:
```js
// docusaurus.config.js
module.exports = {
// ...
themes: ['docusaurus-theme-redoc'],
// ...
};
```
`RedocStandalone` with dark mode support, matching docusaurus classic theme.
```js
import Redoc from '@theme/Redoc';
```
See [here for full example.](../../website/src/pages/examples/custom-layout/index.js)
Includes a `@theme/Layout` wrapper over Redoc.
```js
import ApiDoc from '@theme/ApiDoc';
```
See [here for full example.](../../website/src/pages/examples/custom-page/index.js)
```js
{
/**
* Highlight color for docs
*/
primaryColor: '#1890ff',
/**
* Options to pass to redoc
* @see https://github.com/redocly/redoc#redoc-options-object
*/
options: { disableSearch: true },
/**
* Options to pass to override RedocThemeObject
* @see https://github.com/Redocly/redoc#redoc-theme-object
*/
theme: { typography: { fontSize: '16px' }},
}
```
Convenient way to provide the highlighted color used by Redoc.
This value will be used as `colors.primary.main` in the `themes` option. Must be an actual color value and not a css variable.
Override redoc options passed to [RedocStandalone](https://redoc.ly/docs/redoc/quickstart/react/) component. See the defaults [here](./src/redocData.ts#L5-L12).
Available properties [here](https://github.com/Redocly/redoc#redoc-options-object).
You cannot set theme property using this property, use `theme` option below instead.
Override the redoc theme object passed to Redoc. See the default [here](https://github.com/Redocly/redoc#redoc-theme-object).
> Note: You should not provide any color using this property, as it will be the same value for dark and light themes.
See: <https://redocusaurus.vercel.app/docs>