mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 10:48:05 +02:00
docs: normalize capitalization (#7613)
This commit is contained in:
parent
56e7c3102e
commit
aeb6c971c0
22 changed files with 43 additions and 43 deletions
|
@ -6,9 +6,9 @@ sidebar_position: 1
|
|||
|
||||
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
||||
|
||||
- `src/pages/index.js` -> `localhost:3000/`
|
||||
- `src/pages/foo.md` -> `localhost:3000/foo`
|
||||
- `src/pages/foo/bar.js` -> `localhost:3000/foo/bar`
|
||||
- `src/pages/index.js` → `localhost:3000/`
|
||||
- `src/pages/foo.md` → `localhost:3000/foo`
|
||||
- `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
|
||||
|
||||
## Create your first React Page
|
||||
|
||||
|
|
|
@ -62,4 +62,4 @@ module.exports = {
|
|||
|
||||
| Property | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `sync` | `boolean` | `false` | Syncing tab choices (yarn and npm). See https://docusaurus.io/docs/markdown-features/#syncing-tab-choices for details. |
|
||||
| `sync` | `boolean` | `false` | Syncing tab choices (Yarn and npm). See https://docusaurus.io/docs/markdown-features/#syncing-tab-choices for details. |
|
||||
|
|
|
@ -160,7 +160,7 @@ function Clock(props) {
|
|||
}
|
||||
```
|
||||
|
||||
## Custom heading id {#custom}
|
||||
## Custom heading ID {#custom}
|
||||
|
||||
## Pipe
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ Last but not least, we implemented a plugins architecture and turned the repo in
|
|||
|
||||
## GitHub Activity
|
||||
|
||||
- Stars: 10050 -> 14632 (+45.6% y/y)
|
||||
- Total Contributors: 182 -> 303 (+66.4% y/y). Most of which are non-Facebook contributors
|
||||
- Daily npm Downloads: 728 -> 2320 (+218.7% y/y). The peak was in November
|
||||
- Stars: 10050 → 14632 (+45.6% y/y)
|
||||
- Total Contributors: 182 → 303 (+66.4% y/y). Most of which are non-Facebook contributors
|
||||
- Daily npm Downloads: 728 → 2320 (+218.7% y/y). The peak was in November
|
||||
- D1 is currently used by 3872 projects on GitHub while D2 is used by 247 projects on GitHub
|
||||
- We now have 4 active core contributors! (+100% y/y)
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@ We also saw the **[first right-to-left](https://datagit.ir/)** Docusaurus 2 site
|
|||
|
||||
## GitHub Activity
|
||||
|
||||
- **Stars**: 14632 -> 20946 (+43.2% y/y)
|
||||
- **Total Contributors**: 303 -> 512 (+68.9% y/y). Most of which are non-Facebook contributors
|
||||
- **Weekly npm Downloads**: 2356 -> 25592 (+986% y/y)
|
||||
- **Stars**: 14632 → 20946 (+43.2% y/y)
|
||||
- **Total Contributors**: 303 → 512 (+68.9% y/y). Most of which are non-Facebook contributors
|
||||
- **Weekly npm Downloads**: 2356 → 25592 (+986% y/y)
|
||||
- **On GitHub**, Docusaurus 1 is used by 6311 projects (+62.9% y/y) while Docusaurus 2 is used by 5039 projects (+1940% y/y)
|
||||
|
||||
## Collaboration with Major League Hacking
|
||||
|
|
|
@ -81,7 +81,7 @@ When writing links in Markdown, you could either mean a _file path_, or a _URL p
|
|||
- If the path has an `.md(x)` extension, Docusaurus would try to resolve that Markdown file to a URL, and replace the file path with a URL path.
|
||||
- If the path has any other extension, Docusaurus would treat it as [an asset](../guides/markdown-features/markdown-features-assets.mdx) and bundle it.
|
||||
|
||||
The following directory structure may help you visualize this file -> URL mapping. Assume that there's no slug customization in any page.
|
||||
The following directory structure may help you visualize this file → URL mapping. Assume that there's no slug customization in any page.
|
||||
|
||||
<details>
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ Accepted fields:
|
|||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `id` | `string` | file path (including folders, without the extension) | A unique document id. |
|
||||
| `id` | `string` | file path (including folders, without the extension) | A unique document ID. |
|
||||
| `title` | `string` | Markdown title or `id` | The text title of your document. Used for the page metadata and as a fallback value in multiple places (sidebar, next/previous buttons...). Automatically added at the top of your doc if it does not contain any Markdown title. |
|
||||
| `pagination_label` | `string` | `sidebar_label` or `title` | The text used in the document next/previous buttons for this document. |
|
||||
| `sidebar_label` | `string` | `title` | The text shown in the document sidebar for this document. |
|
||||
|
|
|
@ -70,7 +70,7 @@ If your browser supports it, you should be able to install a Docusaurus site as
|
|||
|
||||
:::note
|
||||
|
||||
App installation requires the https protocol and a valid manifest.
|
||||
App installation requires the HTTPS protocol and a valid manifest.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ module.exports = {
|
|||
|
||||
If you use docs with versioning, this special navbar item type that will render a dropdown with all your site's available versions.
|
||||
|
||||
The user will be able to switch from one version to another, while staying on the same doc (as long as the doc id is constant across versions).
|
||||
The user will be able to switch from one version to another, while staying on the same doc (as long as the doc ID is constant across versions).
|
||||
|
||||
Accepted fields:
|
||||
|
||||
|
|
|
@ -608,7 +608,7 @@ By default, the classic theme assumes only one blog per website and hence includ
|
|||
|
||||
Set the `routeBasePath` to the URL route that you want your second blog to be accessed on. Note that the `routeBasePath` here has to be different from the first blog or else there could be a collision of paths! Also, set `path` to the path to the directory containing your second blog's entries.
|
||||
|
||||
As documented for [multi-instance plugins](./using-plugins.md#multi-instance-plugins-and-plugin-ids), you need to assign a unique id to the plugins.
|
||||
As documented for [multi-instance plugins](./using-plugins.md#multi-instance-plugins-and-plugin-ids), you need to assign a unique ID to the plugins.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
|
|
|
@ -71,7 +71,7 @@ And browsers used in development are:
|
|||
|
||||
- The latest version of Chrome _or_ Firefox _or_ Safari.
|
||||
|
||||
You can "evaluate" any config with the `browserslist` cli to obtain the actual list:
|
||||
You can "evaluate" any config with the `browserslist` CLI to obtain the actual list:
|
||||
|
||||
```bash
|
||||
npx browserslist --env="production"
|
||||
|
|
|
@ -374,7 +374,7 @@ Add these two workflow files:
|
|||
|
||||
:::warning Tweak the parameters for your setup
|
||||
|
||||
These files assume you are using yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
|
||||
These files assume you are using Yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
|
||||
|
||||
If your Docusaurus project is not at the root of your repo, you may need to configure a [default working directory](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-set-the-default-shell-and-working-directory), and adjust the paths accordingly.
|
||||
|
||||
|
@ -474,7 +474,7 @@ A cross-repo publish is more difficult to set up, because you need to push to an
|
|||
|
||||
Please make sure that you replace `actions@github.com` with your GitHub email and `gh-actions` with your name.
|
||||
|
||||
This file assumes you are using yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
|
||||
This file assumes you are using Yarn. If you use npm, change `cache: yarn`, `yarn install --frozen-lockfile`, `yarn build` to `cache: npm`, `npm ci`, `npm run build` accordingly.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -585,9 +585,9 @@ After creating this simple pipeline, each new commit pushed to the branch you se
|
|||
### Using Azure Pipelines {#using-azure-pipelines}
|
||||
|
||||
1. Sign Up at [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) if you haven't already.
|
||||
2. Create an organization and within the organization create a project and connect your repository from GitHub.
|
||||
2. Create an organization. Within the organization, create a project and connect your repository from GitHub.
|
||||
3. Go to https://github.com/settings/tokens and generate a new [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) with the `repo` scope.
|
||||
4. In the project page (which looks like `https://dev.azure.com/ORG_NAME/REPO_NAME/_build` create a new pipeline with the following text. Also, click on edit and add a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username). Make sure to mark them as secret. Alternatively, you can also add a file named `azure-pipelines.yml` at your repository root.
|
||||
4. In the project page (which looks like `https://dev.azure.com/ORG_NAME/REPO_NAME/_build`), create a new pipeline with the following text. Also, click on edit and add a new environment variable named `GH_TOKEN` with your newly generated token as its value, then `GH_EMAIL` (your email address) and `GH_NAME` (your GitHub username). Make sure to mark them as secret. Alternatively, you can also add a file named `azure-pipelines.yml` at your repository root.
|
||||
|
||||
```yml title="azure-pipelines.yml"
|
||||
trigger:
|
||||
|
@ -621,7 +621,7 @@ steps:
|
|||
|
||||
### Using Drone {#using-drone}
|
||||
|
||||
1. Create a new ssh key that will be the [deploy key](https://docs.github.com/en/free-pro-team@latest/developers/overview/managing-deploy-keys#deploy-keys) for your project.
|
||||
1. Create a new SSH key that will be the [deploy key](https://docs.github.com/en/free-pro-team@latest/developers/overview/managing-deploy-keys#deploy-keys) for your project.
|
||||
2. Name your private and public keys to be specific and so that it does not overwrite your other [ssh keys](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
|
||||
3. Go to `https://github.com/USERNAME/REPO/settings/keys` and add a new deploy key by pasting in the public key you just generated.
|
||||
4. Open your Drone.io dashboard and log in. The URL looks like `https://cloud.drone.io/USERNAME/REPO`.
|
||||
|
|
|
@ -45,9 +45,9 @@ The headers are well-spaced so that the hierarchy is clear.
|
|||
- and you may nest them
|
||||
- multiple times
|
||||
|
||||
## Custom id headers {#custom-id}
|
||||
## Custom ID headers {#custom-id}
|
||||
|
||||
With `{#custom-id}` syntax you can set your own header id.
|
||||
With `{#custom-id}` syntax you can set your own header ID.
|
||||
```
|
||||
|
||||
:::note
|
||||
|
@ -92,7 +92,7 @@ How the Markdown files are arranged under the `docs` folder can have multiple im
|
|||
|
||||
Every document has a unique `id`. By default, a document `id` is the name of the document (without the extension) relative to the root docs directory.
|
||||
|
||||
For example, `greeting.md` id is `greeting` and `guide/hello.md` id is `guide/hello`.
|
||||
For example, the ID of `greeting.md` is `greeting`, and the ID of `guide/hello.md` is `guide/hello`.
|
||||
|
||||
```bash
|
||||
website # Root directory of your site
|
||||
|
|
|
@ -135,7 +135,7 @@ Don't forget to assign a unique `id` attribute to plugin instances.
|
|||
|
||||
:::note
|
||||
|
||||
We consider that the `product` instance is the most important one, and make it the "default" instance by not assigning any id.
|
||||
We consider that the `product` instance is the most important one, and make it the "default" instance by not assigning any ID.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -165,7 +165,7 @@ The instance paths will be simpler, and retro-compatible with a single-instance
|
|||
|
||||
## Tagging new versions {#tagging-new-versions}
|
||||
|
||||
Each plugin instance will have its own cli command to tag a new version. They will be displayed if you run:
|
||||
Each plugin instance will have its own CLI command to tag a new version. They will be displayed if you run:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run docusaurus -- --help
|
||||
|
|
|
@ -198,7 +198,7 @@ A real-world example from the Docusaurus site:
|
|||
```mdx-code-block
|
||||
import CodeBlock from '@theme/CodeBlock';
|
||||
|
||||
<CodeBlock className="language-js" title="sidebars.js">
|
||||
<CodeBlock language="js" title="sidebars.js">
|
||||
{require('!!raw-loader!@site/sidebars.js')
|
||||
.default
|
||||
.split('\n')
|
||||
|
|
|
@ -34,7 +34,7 @@ Each heading has an ID that can be automatically generated or explicitly specifi
|
|||
<Link to="#heading-id">link</Link>
|
||||
```
|
||||
|
||||
By default, Docusaurus will generate heading IDs for you, based on the heading text. For example, `### Hello World` will have id `hello-world`.
|
||||
By default, Docusaurus will generate heading IDs for you, based on the heading text. For example, `### Hello World` will have ID `hello-world`.
|
||||
|
||||
Generated IDs have **some limitations**:
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ This manual migration process should be run after the [automated migration proce
|
|||
|
||||
In Docusaurus 2, we use scoped package names:
|
||||
|
||||
- `docusaurus` -> `@docusaurus/core`
|
||||
- `docusaurus` → `@docusaurus/core`
|
||||
|
||||
This provides a clear distinction between Docusaurus' official packages and community maintained packages. In another words, all Docusaurus' official packages are namespaced under `@docusaurus/`.
|
||||
|
||||
|
@ -476,7 +476,7 @@ If you want to keep the `.html` extension as the canonical url of a page, docs c
|
|||
|
||||
### Sidebar {#sidebar}
|
||||
|
||||
In previous version, nested sidebar category is not allowed and sidebar category can only contain doc id. However, v2 allows infinite nested sidebar and we have many types of [Sidebar Item](../guides/docs/sidebar/items.md) other than document.
|
||||
In previous version, nested sidebar category is not allowed and sidebar category can only contain doc ID. However, v2 allows infinite nested sidebar and we have many types of [Sidebar Item](../guides/docs/sidebar/items.md) other than document.
|
||||
|
||||
You'll have to migrate your sidebar if it contains category type. Rename `subcategory` to `category` and `ids` to `items`.
|
||||
|
||||
|
@ -579,7 +579,7 @@ This feature is replaced by [inline table of content](../guides/markdown-feature
|
|||
|
||||
In Docusaurus 2, the markdown syntax has been changed to [MDX](https://mdxjs.com/). Hence there might be some broken syntax in the existing docs which you would have to update. A common example is self-closing tags like `<img>` and `<br>` which are valid in HTML would have to be explicitly closed now ( `<img/>` and `<br/>`). All tags in MDX documents have to be valid JSX.
|
||||
|
||||
Front matter is parsed by [gray-matter](https://github.com/jonschlinkert/gray-matter). If your front matter use special characters like `:`, you now need to quote it: `title: Part 1: my part1 title` -> `title: Part 1: "my part1 title"`.
|
||||
Front matter is parsed by [gray-matter](https://github.com/jonschlinkert/gray-matter). If your front matter use special characters like `:`, you now need to quote it: `title: Part 1: my part1 title` → `title: "Part 1: my part1 title"`.
|
||||
|
||||
**Tips**: You might want to use some online tools like [HTML to JSX](https://transform.tools/html-to-jsx) to make the migration easier.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ slug: /migration
|
|||
|
||||
This doc guides you through migrating an existing Docusaurus 1 site to Docusaurus 2.
|
||||
|
||||
We try to make this as easy as possible, and provide a migration cli.
|
||||
We try to make this as easy as possible, and provide a migration CLI.
|
||||
|
||||
## Main differences {#main-differences}
|
||||
|
||||
|
@ -66,7 +66,7 @@ You are free to put the `/docs` folder anywhere you want after having migrated t
|
|||
There are multiple things to migrate to obtain a fully functional Docusaurus 2 website:
|
||||
|
||||
- packages
|
||||
- cli commands
|
||||
- CLI commands
|
||||
- site configuration
|
||||
- markdown files
|
||||
- sidebars file
|
||||
|
@ -76,13 +76,13 @@ There are multiple things to migrate to obtain a fully functional Docusaurus 2 w
|
|||
|
||||
## Automated migration process {#automated-migration-process}
|
||||
|
||||
The [migration cli](./migration-automated.md) will handle many things of the migration for you.
|
||||
The [migration CLI](./migration-automated.md) will handle many things of the migration for you.
|
||||
|
||||
However, some parts can't easily be automated, and you will have to fallback to the manual process.
|
||||
|
||||
:::note
|
||||
|
||||
We recommend running the migration cli, and complete the missing parts thanks to the manual migration process.
|
||||
We recommend running the migration CLI, and complete the missing parts thanks to the manual migration process.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ The Crowdin Markdown parser is evolving other time and each Crowdin project has
|
|||
|
||||
This parser version is undocumented, and you will have to ask the Crowdin support to know your project's parser version and fix one specific version.
|
||||
|
||||
Using the same cli version and parser version across the 2 Crowdin projects might give better results.
|
||||
Using the same CLI version and parser version across the 2 Crowdin projects might give better results.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ The versioned docs should normally be migrated correctly by the [migration CLI](
|
|||
|
||||
## Migrate your `versioned_docs` front matter {#migrate-your-versioned_docs-front-matter}
|
||||
|
||||
Unlike v1, The markdown header for each versioned doc is no longer altered by using `version-${version}-${original_id}` as the value for the actual id field. See scenario below for better explanation.
|
||||
Unlike v1, The markdown header for each versioned doc is no longer altered by using `version-${version}-${original_id}` as the value for the actual ID field. See scenario below for better explanation.
|
||||
|
||||
For example, if you have a `docs/hello.md`.
|
||||
|
||||
|
@ -66,9 +66,9 @@ Hi, Endilie here :)
|
|||
|
||||
## Migrate your `versioned_sidebars` {#migrate-your-versioned_sidebars}
|
||||
|
||||
- Refer to `versioned_docs` id as `version-${version}/${id}` (v2) instead of `version-${version}-${original_id}` (v1).
|
||||
- Refer to `versioned_docs` ID as `version-${version}/${id}` (v2) instead of `version-${version}-${original_id}` (v1).
|
||||
|
||||
Because in v1 there is a good chance someone created a new file with front matter id `"version-${version}-${id}"` that can conflict with `versioned_docs` id.
|
||||
Because in v1 there is a good chance someone created a new file with front matter ID `"version-${version}-${id}"` that can conflict with `versioned_docs` ID.
|
||||
|
||||
For example, Docusaurus 1 can't differentiate `docs/xxx.md`
|
||||
|
||||
|
@ -139,7 +139,7 @@ website
|
|||
│ └── version-1.0.0-sidebars.json
|
||||
```
|
||||
|
||||
In v2, you have to populate the missing `versioned_docs` and `versioned_sidebars` (with the right front matter and id reference too).
|
||||
In v2, you have to populate the missing `versioned_docs` and `versioned_sidebars` (with the right front matter and ID reference too).
|
||||
|
||||
```bash {3-5,12}
|
||||
website
|
||||
|
|
|
@ -241,7 +241,7 @@ Moreover, internal components may simply disappear. If a component is called `Si
|
|||
For each theme component, the swizzle CLI will indicate **3 different levels of safety** declared by theme authors:
|
||||
|
||||
- **Safe**: this component is safe to be swizzled, its public API is considered stable, and no breaking changes should happen within a theme **major version**
|
||||
- **Unsafe**: this component is a theme implementation detail, not safe to be swizzled, and breaking changes might happen withing a theme **minor version**
|
||||
- **Unsafe**: this component is a theme implementation detail, not safe to be swizzled, and breaking changes might happen within a theme **minor version**
|
||||
- **Forbidden**: the swizzle CLI will prevent you from swizzling this component, because it is not designed to be swizzled at all
|
||||
|
||||
:::note
|
||||
|
|
|
@ -81,7 +81,7 @@ module.exports = {
|
|||
|
||||
## Multi-instance plugins and plugin ids {#multi-instance-plugins-and-plugin-ids}
|
||||
|
||||
All Docusaurus content plugins can support multiple plugin instances. For example, it may be useful to have [multiple docs plugin instances](./guides/docs/docs-multi-instance.mdx) or [multiple blogs](./blog.mdx#multiple-blogs). It is required to assign a unique id to each plugin instance, and by default, the plugin id is `default`.
|
||||
All Docusaurus content plugins can support multiple plugin instances. For example, it may be useful to have [multiple docs plugin instances](./guides/docs/docs-multi-instance.mdx) or [multiple blogs](./blog.mdx#multiple-blogs). It is required to assign a unique ID to each plugin instance, and by default, the plugin ID is `default`.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Reference in a new issue