mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
docs(v2): minor tweaks (#4981)
This commit is contained in:
parent
bfd33dc63a
commit
d7e4e422a2
14 changed files with 25 additions and 21 deletions
|
@ -36,14 +36,14 @@ module.exports = {
|
|||
*/
|
||||
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}) => {
|
||||
return `https://github.com/facebook/docusaurus/edit/master/website/${blogDirPath}/${blogPath}`;
|
||||
},
|
||||
/**
|
||||
* 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.
|
||||
* Note: this option is ignored when editUrl is a function
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
*/
|
||||
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 ({
|
||||
locale,
|
||||
|
@ -49,7 +49,7 @@ module.exports = {
|
|||
},
|
||||
/**
|
||||
* 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.
|
||||
* Note: this option is ignored when editUrl is a function
|
||||
*/
|
||||
|
|
|
@ -142,7 +142,7 @@ website/i18n/<locale>/docusaurus-theme-classic
|
|||
|
||||
### `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:
|
||||
|
||||
|
|
|
@ -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.
|
||||
- `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: `/`.
|
||||
- `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.
|
||||
- `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.
|
||||
|
@ -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.
|
||||
|
||||
```js {9} title="docusaurus.config.js"
|
||||
```js {10} title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
// ...
|
||||
presets: [
|
||||
|
@ -180,7 +180,7 @@ module.exports = {
|
|||
{
|
||||
blog: {
|
||||
blogTitle: 'Docusaurus blog!',
|
||||
blogDescription: 'A docusaurus powered blog!',
|
||||
blogDescription: 'A Docusaurus powered blog!',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Create a Markdown Document
|
|||
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
|
||||
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
|
||||
- multiple times
|
||||
|
||||
<h3 id="custom-id">Custom id headers</h3>
|
||||
|
||||
With <code>{#custom-id}</code> syntax you can set your own header id.
|
||||
|
||||
</BrowserWindow>
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Docusaurus Markdown features that are specific to the docs plugin
|
|||
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}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ module.exports = {
|
|||
|
||||
## 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
|
||||
|
||||
|
@ -495,7 +495,7 @@ docs
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
||||
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
|
||||
- import Foo from '../src/components/Foo';
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Handling assets in Docusaurus Markdown
|
|||
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.
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ slug: /markdown-features/inline-toc
|
|||
|
||||
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.
|
||||
|
||||
|
|
|
@ -52,11 +52,11 @@ By default, tabs are rendered eagerly, but it is possible to load them lazily by
|
|||
|
||||
## 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.
|
||||
|
||||
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}
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ module.exports = function (context, options) {
|
|||
|
||||
## `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:
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
|
||||
## 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
|
||||
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}
|
||||
|
||||
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 |
|
||||
| ---------------------------------- | ------------------------------------- |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue