mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
misc: add command to run prettier on docs (#2102)
* misc: add command to run prettier on docs * Fix GH issue template * Fix tests * Add prettier-docs command to precommit
This commit is contained in:
parent
cfc313d7c7
commit
55e676cb25
141 changed files with 1181 additions and 968 deletions
|
@ -30,15 +30,16 @@ A sidebar object is defined like this.
|
|||
|
||||
```typescript
|
||||
type Sidebar = {
|
||||
[sidebarId: string]: {
|
||||
[sidebarCategory: string]: SidebarItem[];
|
||||
} | SidebarItem[];
|
||||
}
|
||||
[sidebarId: string]:
|
||||
| {
|
||||
[sidebarCategory: string]: SidebarItem[];
|
||||
}
|
||||
| SidebarItem[];
|
||||
};
|
||||
```
|
||||
|
||||
Below is an example of a sidebar object. The key `docs` is the id of the sidebar (can be renamed to something else) and `Getting Started` is a category within the sidebar. `greeting` and `doc1` are both [sidebar item](#sidebar-item).
|
||||
|
||||
|
||||
```js
|
||||
// sidebars.js
|
||||
module.exports = {
|
||||
|
@ -121,10 +122,12 @@ As the name implies, `SidebarItem` is an item defined in a Sidebar. There are a
|
|||
### Doc
|
||||
|
||||
```typescript
|
||||
type SidebarItemDoc = string | {
|
||||
type: 'doc';
|
||||
id: string;
|
||||
};
|
||||
type SidebarItemDoc =
|
||||
| string
|
||||
| {
|
||||
type: 'doc';
|
||||
id: string;
|
||||
};
|
||||
```
|
||||
|
||||
Sidebar item type that links to a doc page. Example:
|
||||
|
@ -204,7 +207,7 @@ type SidebarItemCategory = {
|
|||
type: 'category';
|
||||
label: string; // Sidebar label text.
|
||||
items: SidebarItem[]; // Array of sidebar items.
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
As an example, here's how we created the subcategory for "Docs" under "Guides" in this site:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue