mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 21:32:38 +02:00
misc(v2): nitpicky formatting
This commit is contained in:
parent
e0425358ee
commit
4927f764e5
8 changed files with 45 additions and 32 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Website
|
# Website
|
||||||
|
|
||||||
This website is built using Docusaurus 2, a modern static website generator.
|
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ This command generates static content into the `build` directory and can be serv
|
||||||
### Deployment
|
### Deployment
|
||||||
|
|
||||||
```
|
```
|
||||||
$ GIT_USER=<Your GitHub username> USE_SSH=1 yarn deploy
|
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# dependencies
|
# Dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
# production
|
# Production
|
||||||
/build
|
/build
|
||||||
|
|
||||||
# generated files
|
# Generated files
|
||||||
.docusaurus
|
.docusaurus
|
||||||
.cache-loader
|
.cache-loader
|
||||||
|
|
||||||
# misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env.local
|
.env.local
|
||||||
.env.development.local
|
.env.development.local
|
||||||
|
@ -17,4 +17,4 @@
|
||||||
|
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
|
@ -137,11 +137,11 @@ Small pull requests are much easier to review and more likely to get merged. Mak
|
||||||
Please make sure the following is done when submitting a pull request:
|
Please make sure the following is done when submitting a pull request:
|
||||||
|
|
||||||
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`.
|
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`.
|
||||||
2. Add the copyright notice to the top of any code new files you've added.
|
1. Add the copyright notice to the top of any code new files you've added.
|
||||||
3. Describe your [test plan](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md)!
|
1. Describe your [test plan](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md)!
|
||||||
4. Make sure your code lints (`yarn prettier && yarn lint`).
|
1. Make sure your code lints (`yarn prettier && yarn lint`).
|
||||||
5. Make sure your Jest tests pass (`yarn test`).
|
1. Make sure your Jest tests pass (`yarn test`).
|
||||||
6. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
|
1. If you haven't already, [sign the CLA](https://code.facebook.com/cla).
|
||||||
|
|
||||||
All pull requests should be opened against the `master` branch.
|
All pull requests should be opened against the `master` branch.
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ my-website
|
||||||
|
|
||||||
## Using React
|
## Using React
|
||||||
|
|
||||||
React is used as the UI library to create pages. Every page component should export a React component and you can leverage on the expressibility of React to build rich and interactive content.
|
React is used as the UI library to create pages. Every page component should export a React component and you can leverage on the expressiveness of React to build rich and interactive content.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
TODO:
|
TODO:
|
||||||
|
|
|
@ -7,7 +7,7 @@ title: Lifecycle APIs
|
||||||
|
|
||||||
Lifecycle APIs are shared by Themes and Plugins.
|
Lifecycle APIs are shared by Themes and Plugins.
|
||||||
|
|
||||||
## getPathsToWatch()
|
## `getPathsToWatch()`
|
||||||
|
|
||||||
Specifies the paths to watch for plugins and themes. The paths are watched by the dev server so that the plugin lifecycles are reloaded when contents in the watched paths change. Note that the plugins and themes modules are initially called with `context` and `options` from Node, which you may use to find the necessary directory information about the site.
|
Specifies the paths to watch for plugins and themes. The paths are watched by the dev server so that the plugin lifecycles are reloaded when contents in the watched paths change. Note that the plugins and themes modules are initially called with `context` and `options` from Node, which you may use to find the necessary directory information about the site.
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## async loadContent()
|
## `async loadContent()`
|
||||||
|
|
||||||
Plugins should use this lifecycle to fetch from data sources (filesystem, remote API, headless CMS, etc) or doing some server processing.
|
Plugins should use this lifecycle to fetch from data sources (filesystem, remote API, headless CMS, etc) or doing some server processing.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## async contentLoaded({content, actions})
|
## `async contentLoaded({content, actions})`
|
||||||
|
|
||||||
Plugins should use the data loaded in `loadContent` and construct the pages/routes that consume the loaded data (optional).
|
Plugins should use the data loaded in `loadContent` and construct the pages/routes that consume the loaded data (optional).
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## configureWebpack(config, isServer, utils)
|
## `configureWebpack(config, isServer, utils)`
|
||||||
|
|
||||||
Modifies the internal webpack config. If the return value is a JavaScript object, it will be merged into the final config using [`webpack-merge`](https://github.com/survivejs/webpack-merge). If it is a function, it will be called and receive `config` as the first argument and an `isServer` flag as the argument argument.
|
Modifies the internal webpack config. If the return value is a JavaScript object, it will be merged into the final config using [`webpack-merge`](https://github.com/survivejs/webpack-merge). If it is a function, it will be called and receive `config` as the first argument and an `isServer` flag as the argument argument.
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## extendCli(cli)
|
## `extendCli(cli)`
|
||||||
|
|
||||||
Register an extra command to enhance the CLI of docusaurus. `cli` is [commander](https://www.npmjs.com/package/commander) object.
|
Register an extra command to enhance the CLI of docusaurus. `cli` is [commander](https://www.npmjs.com/package/commander) object.
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## injectHtmlTags()
|
## `injectHtmlTags()`
|
||||||
|
|
||||||
Inject head and/or body html tags to Docusaurus generated html.
|
Inject head and/or body html tags to Docusaurus generated html.
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ module.exports = function(context, options) {
|
||||||
tagName: 'script',
|
tagName: 'script',
|
||||||
attributes: {
|
attributes: {
|
||||||
charset: 'utf-8',
|
charset: 'utf-8',
|
||||||
src: '/noflash.js'
|
src: '/noflash.js',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -292,7 +292,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## getThemePath()
|
## `getThemePath()`
|
||||||
|
|
||||||
Returns the path to the directory where the theme components can be found. When your users calls `swizzle`, `getThemePath` is called and its returned path is used to find your theme components.
|
Returns the path to the directory where the theme components can be found. When your users calls `swizzle`, `getThemePath` is called and its returned path is used to find your theme components.
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ module.exports = function(context, options) {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## getClientModules()
|
## `getClientModules()`
|
||||||
|
|
||||||
Returns an array of paths to the modules that are to be imported in the client bundle. These modules are imported globally before React even renders the initial UI.
|
Returns an array of paths to the modules that are to be imported in the client bundle. These modules are imported globally before React even renders the initial UI.
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ For example, the in docusaurus-plugin-content-docs:
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Mind model for a presumptuous plugin implementation.
|
Here's a mind model for a presumptuous plugin implementation.
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
const DEFAULT_OPTIONS = {
|
const DEFAULT_OPTIONS = {
|
||||||
|
|
|
@ -30,7 +30,7 @@ themeConfig: {
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
|
|
||||||
### Customizing the Algolia Search Bar
|
### Customizing the Algolia search bar
|
||||||
|
|
||||||
If you prefer to customize Algolia's search bar React component, swizzle the `SearchBar` component in `@docusaurus/theme-search-algolia`:
|
If you prefer to customize Algolia's search bar React component, swizzle the `SearchBar` component in `@docusaurus/theme-search-algolia`:
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ function MyComponent() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### CSS Modules
|
### CSS modules
|
||||||
|
|
||||||
To style your components using [CSS Modules](https://github.com/css-modules/css-modules), name your stylesheet files with the `.module.css` suffix (e.g. `welcome.module.css`). webpack will load such CSS files as CSS modules and you have to reference the class names from the imported CSS module (as opposed to using plain strings). This is similar to the convention used in [Create React App](https://facebook.github.io/create-react-app/docs/adding-a-css-modules-stylesheet).
|
To style your components using [CSS Modules](https://github.com/css-modules/css-modules), name your stylesheet files with the `.module.css` suffix (e.g. `welcome.module.css`). webpack will load such CSS files as CSS modules and you have to reference the class names from the imported CSS module (as opposed to using plain strings). This is similar to the convention used in [Create React App](https://facebook.github.io/create-react-app/docs/adding-a-css-modules-stylesheet).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: theme-classic
|
id: theme-classic
|
||||||
title: "@docusaurus/theme-classic"
|
title: '@docusaurus/theme-classic'
|
||||||
---
|
---
|
||||||
|
|
||||||
> :warning: _This section is a work in progress._
|
> :warning: _This section is a work in progress._
|
||||||
|
@ -14,9 +14,12 @@ To remove the ability to switch on dark mode, there is an option `themeConfig.di
|
||||||
```js
|
```js
|
||||||
// docusaurus.config.js
|
// docusaurus.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
...
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
disableDarkMode: false,
|
disableDarkMode: false,
|
||||||
}
|
...
|
||||||
|
},
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### Meta image
|
### Meta image
|
||||||
|
@ -26,13 +29,15 @@ You can configure a default image that will be used for your meta tag, in partic
|
||||||
```js
|
```js
|
||||||
// docusaurus.config.js
|
// docusaurus.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
...
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
/**
|
/**
|
||||||
* relative to your site's "static" directory
|
* Relative to your site's "static" directory.
|
||||||
* cannot be svg
|
* Cannot be SVGs. Can be external URLs too.
|
||||||
* can be external url too
|
|
||||||
*/
|
*/
|
||||||
image: 'img/docusaurus.png',
|
image: 'img/docusaurus.png',
|
||||||
|
...
|
||||||
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -45,6 +50,7 @@ You can add a logo and title to the navbar via `themeConfig.navbar`. Logo can be
|
||||||
```js
|
```js
|
||||||
// docusaurus.config.js
|
// docusaurus.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
...
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
title: 'Site Title',
|
title: 'Site Title',
|
||||||
|
@ -52,7 +58,9 @@ module.exports = {
|
||||||
alt: 'Site Logo',
|
alt: 'Site Logo',
|
||||||
src: 'img/logo.svg',
|
src: 'img/logo.svg',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
...
|
||||||
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -63,6 +71,7 @@ You can add links to the navbar via `themeConfig.navbar.links`:
|
||||||
```js
|
```js
|
||||||
// docusaurus/config.js
|
// docusaurus/config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
...
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
navbar: {
|
navbar: {
|
||||||
links: [
|
links: [
|
||||||
|
@ -73,7 +82,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
// ... other links
|
// ... other links
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
|
...
|
||||||
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -107,10 +118,12 @@ You can set a default language for code blocks if no language is added after the
|
||||||
```js
|
```js
|
||||||
// docusaurus/config.js
|
// docusaurus/config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
...
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
prism: {
|
prism: {
|
||||||
defaultLanguage: 'javascript',
|
defaultLanguage: 'javascript',
|
||||||
},
|
},
|
||||||
|
...
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue