docs(v2): minor tweaks (#4981)

This commit is contained in:
Alexey Pyltsyn 2021-06-16 12:04:40 +03:00 committed by GitHub
parent bfd33dc63a
commit d7e4e422a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 21 deletions

View file

@ -36,14 +36,14 @@ module.exports = {
*/ */
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/', editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
/** /**
* For advanced cases, compute the edit url for each markdown file yourself. * For advanced cases, compute the edit url for each Markdown file yourself.
*/ */
editUrl: ({locale, blogDirPath, blogPath, permalink}) => { editUrl: ({locale, blogDirPath, blogPath, permalink}) => {
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`; return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
}, },
/** /**
* Useful if you commit localized files to git. * Useful if you commit localized files to git.
* When markdown files are localized, the edit url will target the localized file, * When Markdown files are localized, the edit url will target the localized file,
* instead of the original unlocalized file. * instead of the original unlocalized file.
* Note: this option is ignored when editUrl is a function * Note: this option is ignored when editUrl is a function
*/ */

View file

@ -36,7 +36,7 @@ module.exports = {
*/ */
editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/', editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/',
/** /**
* For advanced cases, compute the edit url for each markdown file yourself. * For advanced cases, compute the edit url for each Markdown file yourself.
*/ */
editUrl: function ({ editUrl: function ({
locale, locale,
@ -49,7 +49,7 @@ module.exports = {
}, },
/** /**
* Useful if you commit localized files to git. * Useful if you commit localized files to git.
* When markdown files are localized, the edit url will target the localized file, * When Markdown files are localized, the edit url will target the localized file,
* instead of the original unlocalized file. * instead of the original unlocalized file.
* Note: this option is ignored when editUrl is a function * Note: this option is ignored when editUrl is a function
*/ */

View file

@ -142,7 +142,7 @@ website/i18n/<locale>/docusaurus-theme-classic
### `useThemeContext` {#usethemecontext} ### `useThemeContext` {#usethemecontext}
React hook to access theme context. This context contains functions for setting light and dark mode and boolean property, indicating which mode is currently in use. React hook to access theme context. This context contains functions for setting light and dark mode and exposes boolean variable, indicating which mode is currently in use.
Usage example: Usage example:

View file

@ -61,7 +61,7 @@ The only required field is `title`; however, we provide options to add author in
- `author_title`: A description of the author. - `author_title`: A description of the author.
- `title`: The blog post title. - `title`: The blog post title.
- `slug`: Allows to customize the blog post url (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-blog-post`, `slug: /my/path/to/blog/post`, slug: `/`. - `slug`: Allows to customize the blog post url (`/<routeBasePath>/<slug>`). Support multiple patterns: `slug: my-blog-post`, `slug: /my/path/to/blog/post`, slug: `/`.
- `date`: The blog post creation date. If not specified, this could be extracted from the file name, e.g, `2021-04-15-blog-post.mdx`. By default, it is the markdown file creation time. - `date`: The blog post creation date. If not specified, this could be extracted from the file name, e.g, `2021-04-15-blog-post.mdx`. By default, it is the Markdown file creation time.
- `tags`: A list of strings or objects of two string fields `label` and `permalink` to tag to your post. - `tags`: A list of strings or objects of two string fields `label` and `permalink` to tag to your post.
- `draft`: A boolean flag to indicate that the blog post is work-in-progress and therefore should not be published yet. However, draft blog posts will be displayed during development. - `draft`: A boolean flag to indicate that the blog post is work-in-progress and therefore should not be published yet. However, draft blog posts will be displayed during development.
- `description`: The description of your post, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. If this field is not present, it will default to the first line of the contents. - `description`: The description of your post, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. If this field is not present, it will default to the first line of the contents.
@ -145,7 +145,7 @@ https://{your-domain}/blog/atom.xml
You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `'/'` to indicate it's the root path. You can run your Docusaurus 2 site without a landing page and instead have your blog's post list page as the index page. Set the `routeBasePath` to be `'/'` to indicate it's the root path.
```js {9} title="docusaurus.config.js" ```js {10} title="docusaurus.config.js"
module.exports = { module.exports = {
// ... // ...
presets: [ presets: [
@ -180,7 +180,7 @@ module.exports = {
{ {
blog: { blog: {
blogTitle: 'Docusaurus blog!', blogTitle: 'Docusaurus blog!',
blogDescription: 'A docusaurus powered blog!', blogDescription: 'A Docusaurus powered blog!',
}, },
}, },
], ],

View file

@ -56,7 +56,7 @@ Please note that some functionality (for example, anchor links) will not work in
::: :::
#### Enabling HTTPS` {#enabling-https} #### Enabling HTTPS {#enabling-https}
There are multiple ways to obtain a certificate. We will use [mkcert](https://github.com/FiloSottile/mkcert) as an example. There are multiple ways to obtain a certificate. We will use [mkcert](https://github.com/FiloSottile/mkcert) as an example.

View file

@ -5,7 +5,7 @@ description: Create a Markdown Document
slug: /create-doc slug: /create-doc
--- ---
Create a markdown file, `greeting.md`, and place it under the `docs` directory. Create a Markdown file, `greeting.md`, and place it under the `docs` directory.
```bash ```bash
website # root directory of your site website # root directory of your site
@ -76,4 +76,8 @@ The headers are well-spaced so that the hierarchy is clear.
- and you may nest them - and you may nest them
- multiple times - multiple times
<h3 id="custom-id">Custom id headers</h3>
With <code>{#custom-id}</code> syntax you can set your own header id.
</BrowserWindow> </BrowserWindow>

View file

@ -5,7 +5,7 @@ description: Docusaurus Markdown features that are specific to the docs plugin
slug: /docs-markdown-features slug: /docs-markdown-features
--- ---
Docs can use any [Markdown feature](../markdown-features/markdown-features-intro.mdx), and have a few additional Docs-specific markdown features. Docs can use any [Markdown feature](../markdown-features/markdown-features-intro.mdx), and have a few additional docs-specific Markdown features.
## Markdown frontmatter {#markdown-frontmatter} ## Markdown frontmatter {#markdown-frontmatter}

View file

@ -116,7 +116,7 @@ module.exports = {
## Using multiple sidebars {#using-multiple-sidebars} ## Using multiple sidebars {#using-multiple-sidebars}
You can create a sidebar for each **set of markdown files** that you want to **group together**. You can create a sidebar for each **set of Markdown files** that you want to **group together**.
:::tip :::tip
@ -495,7 +495,7 @@ docs
To make it **easier to adopt**, Docusaurus supports **multiple number prefix patterns**. To make it **easier to adopt**, Docusaurus supports **multiple number prefix patterns**.
By default, Docusaurus will **remove the number prefix** from the doc id, title, label and url paths. By default, Docusaurus will **remove the number prefix** from the doc id, title, label and URL paths.
:::caution :::caution

View file

@ -180,7 +180,7 @@ As a good rule of thumb, try to keep the number of your versions below 10. **It
### Use absolute import within the docs {#use-absolute-import-within-the-docs} ### Use absolute import within the docs {#use-absolute-import-within-the-docs}
Don't use relative paths import within the docs. Because when we cut a version the paths no longer work (the nesting level is different, among other reasons). You can utilize the `@site` alias provided by docusaurus, that points to the `website` directory. Example: Don't use relative paths import within the docs. Because when we cut a version the paths no longer work (the nesting level is different, among other reasons). You can utilize the `@site` alias provided by Docusaurus, that points to the `website` directory. Example:
```diff ```diff
- import Foo from '../src/components/Foo'; - import Foo from '../src/components/Foo';

View file

@ -5,7 +5,7 @@ description: Handling assets in Docusaurus Markdown
slug: /markdown-features/assets slug: /markdown-features/assets
--- ---
Sometimes you want to link to static assets directly from Markdown files, and it is convenient to co-locate the asset next to the markdown file using it. Sometimes you want to link to static assets directly from Markdown files, and it is convenient to co-locate the asset next to the Markdown file using it.
We have setup Webpack loaders to handle most common file types, so that when you import a file, you get its url, and the asset is automatically copied to the output folder. We have setup Webpack loaders to handle most common file types, so that when you import a file, you get its url, and the asset is automatically copied to the output folder.

View file

@ -7,7 +7,7 @@ slug: /markdown-features/inline-toc
import BrowserWindow from '@site/src/components/BrowserWindow'; import BrowserWindow from '@site/src/components/BrowserWindow';
Each markdown document displays a tab of content on the top-right corner. Each Markdown document displays a tab of content on the top-right corner.
But it is also possible to display an inline table of contents directly inside a markdown document, thanks to MDX. But it is also possible to display an inline table of contents directly inside a markdown document, thanks to MDX.

View file

@ -52,11 +52,11 @@ By default, tabs are rendered eagerly, but it is possible to load them lazily by
## Displaying a default tab ## Displaying a default tab
Set the `defaultValue` property in the `Tabs` component to the label value of your choice to show the matching tab by default. Set the `defaultValue` prop in the `Tabs` component to the label value of your choice to show the matching tab by default.
For example, in the example above, `defaultValue="apple"` forces the `Apple` tab to be open by default. For example, in the example above, `defaultValue="apple"` forces the `Apple` tab to be open by default.
If the `defaultValue` property is not provided or refers to an non-existing value, only the tab headings appear until the user clicks on a tab. If the `defaultValue` prop is not provided or refers to an non-existing value, only the tab headings appear until the user clicks on a tab.
## Syncing tab choices {#syncing-tab-choices} ## Syncing tab choices {#syncing-tab-choices}

View file

@ -419,7 +419,7 @@ module.exports = function (context, options) {
## `extendCli(cli)` {#extendclicli} ## `extendCli(cli)` {#extendclicli}
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.
Example: Example:

View file

@ -35,7 +35,7 @@ module.exports = {
## Presets -> themes and plugins {#presets---themes-and-plugins} ## Presets -> themes and plugins {#presets---themes-and-plugins}
Presets in some way are a shorthand function to add plugins and themes to your docusaurus config. For example, you can specify a preset that includes the following themes and plugins, Presets in some way are a shorthand function to add plugins and themes to your Docusaurus config. For example, you can specify a preset that includes the following themes and plugins,
```js ```js
module.exports = function preset(context, opts = {}) { module.exports = function preset(context, opts = {}) {
@ -73,7 +73,7 @@ This is especially useful when some plugins and themes are intended to be used t
### `@docusaurus/preset-classic` {#docusauruspreset-classic} ### `@docusaurus/preset-classic` {#docusauruspreset-classic}
The classic preset that is usually shipped by default to new docusaurus website. It is a set of plugins and themes. The classic preset that is usually shipped by default to new Docusaurus website. It is a set of plugins and themes.
| Themes | Plugins | | Themes | Plugins |
| ---------------------------------- | ------------------------------------- | | ---------------------------------- | ------------------------------------- |