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:
Yangshun Tay 2019-12-07 21:56:30 -08:00 committed by GitHub
parent cfc313d7c7
commit 55e676cb25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
141 changed files with 1181 additions and 968 deletions

View file

@ -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: