mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-21 13:06:58 +02:00
docs: make API sidebar partially autogenerated (#5917)
* docs: make API sidebar autogenerated * fix paths
This commit is contained in:
parent
c541e2d83c
commit
4478dd9659
24 changed files with 33 additions and 36 deletions
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 0
|
||||
id: docusaurus.config.js
|
||||
description: API reference for Docusaurus configuration file.
|
||||
slug: /api/docusaurus-config
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
id: lifecycle-apis
|
||||
title: Lifecycle APIs
|
||||
slug: /lifecycle-apis
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
2
website/docs/api/plugins/_category_.yml
Normal file
2
website/docs/api/plugins/_category_.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
label: Plugins
|
||||
position: 2
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 0
|
||||
id: plugins-overview
|
||||
title: 'Docusaurus plugins'
|
||||
sidebar_label: Plugins overview
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 4
|
||||
id: plugin-client-redirects
|
||||
title: '📦 plugin-client-redirects'
|
||||
slug: '/api/plugins/@docusaurus/plugin-client-redirects'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
id: plugin-content-blog
|
||||
title: '📦 plugin-content-blog'
|
||||
slug: '/api/plugins/@docusaurus/plugin-content-blog'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
id: plugin-content-docs
|
||||
title: '📦 plugin-content-docs'
|
||||
slug: '/api/plugins/@docusaurus/plugin-content-docs'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 3
|
||||
id: plugin-content-pages
|
||||
title: '📦 plugin-content-pages'
|
||||
slug: '/api/plugins/@docusaurus/plugin-content-pages'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 5
|
||||
id: plugin-debug
|
||||
title: '📦 plugin-debug'
|
||||
slug: '/api/plugins/@docusaurus/plugin-debug'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 6
|
||||
id: plugin-google-analytics
|
||||
title: '📦 plugin-google-analytics'
|
||||
slug: '/api/plugins/@docusaurus/plugin-google-analytics'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 7
|
||||
id: plugin-google-gtag
|
||||
title: '📦 plugin-google-gtag'
|
||||
slug: '/api/plugins/@docusaurus/plugin-google-gtag'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 8
|
||||
id: plugin-ideal-image
|
||||
title: '📦 plugin-ideal-image'
|
||||
slug: '/api/plugins/@docusaurus/plugin-ideal-image'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 9
|
||||
id: plugin-pwa
|
||||
title: '📦 plugin-pwa'
|
||||
slug: '/api/plugins/@docusaurus/plugin-pwa'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 10
|
||||
id: plugin-sitemap
|
||||
title: '📦 plugin-sitemap'
|
||||
slug: '/api/plugins/@docusaurus/plugin-sitemap'
|
||||
|
|
2
website/docs/api/themes/_category_.yml
Normal file
2
website/docs/api/themes/_category_.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
label: Themes
|
||||
position: 3
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 0
|
||||
id: themes-overview
|
||||
title: 'Docusaurus themes'
|
||||
sidebar_label: Themes overview
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
id: theme-classic
|
||||
title: '📦 theme-classic'
|
||||
slug: '/api/themes/@docusaurus/theme-classic'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
id: theme-configuration
|
||||
title: 'Theme configuration'
|
||||
slug: '/api/themes/configuration'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 3
|
||||
id: theme-live-codeblock
|
||||
title: '📦 theme-live-codeblock'
|
||||
slug: '/api/themes/@docusaurus/theme-live-codeblock'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
sidebar_position: 4
|
||||
id: theme-search-algolia
|
||||
title: '📦 theme-search-algolia'
|
||||
slug: '/api/themes/@docusaurus/theme-search-algolia'
|
||||
|
|
|
@ -134,4 +134,4 @@ For themes that supports TypeScript theme components, you can add the `--typescr
|
|||
npm run swizzle @docusaurus/theme-classic Footer -- --typescript
|
||||
```
|
||||
|
||||
At this moment, the only official Docusaurus theme that supports TypeScript theme components is `@docusaurus/theme-classic`. If you are a Docusaurus theme package author who wants to add TypeScript support, see the [Lifecycle APIs docs](./lifecycle-apis.md#gettypescriptthemepath).
|
||||
At this moment, the only official Docusaurus theme that supports TypeScript theme components is `@docusaurus/theme-classic`. If you are a Docusaurus theme package author who wants to add TypeScript support, see the [Lifecycle APIs docs](./api/lifecycle-apis.md#gettypescriptthemepath).
|
||||
|
|
|
@ -121,7 +121,7 @@ Docusaurus' implementation of the plugins system provides us with a convenient w
|
|||
|
||||
A plugin is a function that takes two parameters: `context` and `options`.
|
||||
|
||||
It returns a plugin instance object, containing plugin [lifecycle APIs](./lifecycle-apis.md).
|
||||
It returns a plugin instance object, containing plugin [lifecycle APIs](./api/lifecycle-apis.md).
|
||||
|
||||
It can be defined as a function or a module.
|
||||
|
||||
|
@ -206,4 +206,4 @@ interface LoadContext {
|
|||
|
||||
#### Return value {#return-value}
|
||||
|
||||
The returned object value should implement the [lifecycle APIs](lifecycle-apis.md).
|
||||
The returned object value should implement the [lifecycle APIs](./api/lifecycle-apis.md).
|
||||
|
|
|
@ -210,13 +210,13 @@ website
|
|||
|
||||
There are two lifecycle methods that are essential to theme implementation:
|
||||
|
||||
- [`getThemePath()`](lifecycle-apis.md#getthemepath)
|
||||
- [`getClientModules()`](lifecycle-apis.md#getclientmodules)
|
||||
- [`getThemePath()`](./api/lifecycle-apis.md#getthemepath)
|
||||
- [`getClientModules()`](./api/lifecycle-apis.md#getclientmodules)
|
||||
|
||||
These lifecycle methods are not essential but recommended:
|
||||
|
||||
- [`validateThemeConfig({themeConfig, validate})`](lifecycle-apis.md#validatethemeconfigthemeconfig-validate)
|
||||
- [`validateOptions({options, validate})`](lifecycle-apis.md#validateoptionsoptions-validate)
|
||||
- [`validateThemeConfig({themeConfig, validate})`](./api/lifecycle-apis.md#validatethemeconfigthemeconfig-validate)
|
||||
- [`validateOptions({options, validate})`](./api/lifecycle-apis.md#validateoptionsoptions-validate)
|
||||
|
||||
<!--
|
||||
|
||||
|
@ -231,7 +231,7 @@ Related pieces
|
|||
---
|
||||
|
||||
- [Advanced Guides – Themes](using-themes.md)
|
||||
- [Lifecycle APIs](lifecycle-apis.md)
|
||||
- [Lifecycle APIs](./api/lifecycle-apis.md)
|
||||
|
||||
References
|
||||
---
|
||||
|
|
|
@ -109,35 +109,9 @@ const sidebars = {
|
|||
api: [
|
||||
'cli',
|
||||
'docusaurus-core',
|
||||
'api/docusaurus.config.js',
|
||||
'lifecycle-apis',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Plugins',
|
||||
items: [
|
||||
'api/plugins/plugins-overview',
|
||||
'api/plugins/plugin-content-docs',
|
||||
'api/plugins/plugin-content-blog',
|
||||
'api/plugins/plugin-content-pages',
|
||||
'api/plugins/plugin-client-redirects',
|
||||
'api/plugins/plugin-debug',
|
||||
'api/plugins/plugin-google-analytics',
|
||||
'api/plugins/plugin-google-gtag',
|
||||
'api/plugins/plugin-ideal-image',
|
||||
'api/plugins/plugin-pwa',
|
||||
'api/plugins/plugin-sitemap',
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Themes',
|
||||
items: [
|
||||
'api/themes/themes-overview',
|
||||
'api/themes/theme-configuration',
|
||||
'api/themes/theme-classic',
|
||||
'api/themes/theme-live-codeblock',
|
||||
'api/themes/theme-search-algolia',
|
||||
],
|
||||
type: 'autogenerated',
|
||||
dirName: 'api',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue