mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 21:03:47 +02:00
chore: publish v2.0.0 docs (#7862)
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
40827c6c72
commit
111b4cdcd2
96 changed files with 134 additions and 48 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,5 +1,15 @@
|
|||
# Docusaurus 2 Changelog
|
||||
|
||||
#### :nail_care: Polish
|
||||
|
||||
- `docusaurus`
|
||||
- [#7781](https://github.com/facebook/docusaurus/pull/7781) refactor(core): log Docusaurus & Node version before exiting ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
|
||||
#### Committers: 2
|
||||
|
||||
- Joshua Chen ([@Josh-Cena](https://github.com/Josh-Cena))
|
||||
- Sébastien Lorber ([@slorber](https://github.com/slorber))
|
||||
|
||||
## 2.0.0-rc.1 (2022-07-14)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
|
|
|
@ -23,6 +23,8 @@ const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(
|
|||
|
||||
// This probably only makes sense for the alpha/beta/rc phase, temporary
|
||||
function getNextVersionName() {
|
||||
return 'Canary';
|
||||
/*
|
||||
const expectedPrefix = '2.0.0-rc.';
|
||||
|
||||
const lastReleasedVersion = versions[0];
|
||||
|
@ -33,6 +35,8 @@ function getNextVersionName() {
|
|||
}
|
||||
const version = parseInt(lastReleasedVersion.replace(expectedPrefix, ''), 10);
|
||||
return `${expectedPrefix}${version + 1}`;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
const allDocHomesPaths = [
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
slug: /api/themes/@docusaurus/theme-classic
|
||||
---
|
||||
|
||||
# 📦 theme-classic
|
||||
|
||||
The classic theme for Docusaurus.
|
||||
|
||||
You can refer to the [theme configuration page](theme-configuration.md) for more details on the configuration.
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save @docusaurus/theme-classic
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
If you have installed `@docusaurus/preset-classic`, you don't need to install it as a dependency.
|
||||
|
||||
:::
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
sidebar_position: 2
|
||||
slug: /api/themes/@docusaurus/theme-classic
|
||||
---
|
||||
|
||||
# 📦 theme-classic
|
||||
|
||||
The classic theme for Docusaurus.
|
||||
|
||||
You can refer to the [theme configuration page](theme-configuration.md) for more details on the configuration.
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save @docusaurus/theme-classic
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
If you have installed `@docusaurus/preset-classic`, you don't need to install it as a dependency.
|
||||
|
||||
:::
|
||||
|
||||
## Configuration {#configuration}
|
||||
|
||||
Accepted fields:
|
||||
|
||||
```mdx-code-block
|
||||
<APITable>
|
||||
```
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `customCss` | <code>string[] \| string</code> | `[]` | Stylesheets to be imported globally as [client modules](../../advanced/client.md#client-modules). Relative paths are resolved against the site directory. |
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
:::note
|
||||
|
||||
Most configuration for the theme is done in `themeConfig`, which can be found in [theme configuration](./theme-configuration.md).
|
||||
|
||||
:::
|
||||
|
||||
### Example configuration {#ex-config}
|
||||
|
||||
You can configure this theme through preset options or plugin options.
|
||||
|
||||
:::tip
|
||||
|
||||
Most Docusaurus users configure this plugin through the preset options.
|
||||
|
||||
:::
|
||||
|
||||
```js config-tabs
|
||||
// Preset Options: theme
|
||||
// Plugin Options: @docusaurus/theme-classic
|
||||
|
||||
const config = {
|
||||
customCss: require.resolve('./src/css/custom.css'),
|
||||
};
|
||||
```
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
@ -320,14 +320,14 @@ GIT_USER=<GITHUB_USERNAME> yarn deploy
|
|||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
```
|
||||
|
||||
````mdx-code-block
|
||||
```mdx-code-block
|
||||
</TabItem>
|
||||
<TabItem value="powershell" label="PowerShell">
|
||||
```mdx-code-block
|
||||
```
|
||||
|
||||
```powershell
|
||||
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
|
||||
````
|
||||
```
|
||||
|
||||
```mdx-code-block
|
||||
</TabItem>
|
|
@ -11,7 +11,7 @@ import Tabs from '@theme/Tabs';
|
|||
import TabItem from '@theme/TabItem';
|
||||
import Admonition from '@theme/Admonition';
|
||||
|
||||
In addition to the basic Markdown syntax, we use [remark-admonitions](https://github.com/elviswolcott/remark-admonitions) alongside MDX to add support for admonitions. Admonitions are wrapped by a set of 3 colons.
|
||||
In addition to the basic Markdown syntax, we have a special admonitions syntax by wrapping text with a set of 3 colons, followed by a label denoting its type.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -107,7 +107,7 @@ Hello world
|
|||
|
||||
## Specifying title {#specifying-title}
|
||||
|
||||
You may also specify an optional title
|
||||
You may also specify an optional title.
|
||||
|
||||
```md
|
||||
:::note Your Title
|
||||
|
@ -204,3 +204,53 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf
|
|||
</Admonition>
|
||||
</BrowserWindow>
|
||||
```
|
||||
|
||||
## Customizing admonitions {#customizing-admonitions}
|
||||
|
||||
There are two kinds of customizations possible with admonitions: **parsing** and **rendering**.
|
||||
|
||||
### Customizing rendering behavior {#customizing-rendering-behavior}
|
||||
|
||||
You can customize how each individual admonition type is rendered through [swizzling](../../swizzling.md). You can often achieve your goal through a simple wrapper. For example, in the follow example, we swap out the icon for `info` admonitions only.
|
||||
|
||||
```jsx title="src/theme/Admonition.js"
|
||||
import React from 'react';
|
||||
import Admonition from '@theme-original/Admonition';
|
||||
import MyIcon from '@site/static/img/info.svg';
|
||||
|
||||
export default function AdmonitionWrapper(props) {
|
||||
if (props.type !== 'info') {
|
||||
return <Admonition {...props} />;
|
||||
}
|
||||
return <Admonition icon={<MyIcon />} {...props} />;
|
||||
}
|
||||
```
|
||||
|
||||
### Customizing parsing behavior {#customizing-parsing-behavior}
|
||||
|
||||
Admonitions are implemented with a [Remark plugin](./markdown-features-plugins.mdx). The plugin is designed to be configurable. To customize the Remark plugin for a specific content plugin (docs, blog, pages), pass the options through the `admonitions` key.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
admonitions: {
|
||||
tag: ':::',
|
||||
keywords: ['note', 'tip', 'info', 'caution', 'danger'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
The plugin accepts two options:
|
||||
|
||||
- `tag`: The tag that encloses the admonition. Defaults to `:::`.
|
||||
- `keywords`: An array of keywords that can be used as the type for the admonition. Note that if you override this, the default values will not be applied.
|
||||
|
||||
The `keyword` will be passed as the `type` prop of the `Admonition` component. If you register more types than the default, you are also responsible for providing their implementation—including the container's style, icon, default title text, etc. You would usually need to [eject](../../swizzling.md#ejecting) the `@theme/Admonition` component, so you could re-use the same infrastructure as the other types.
|
|
@ -25,7 +25,7 @@ If you play with the [MDX playground](https://mdx-git-renovate-babel-monorepo-md
|
|||
|
||||
:::tip
|
||||
|
||||
Use plugins to introduce shorter syntax for the most commonly used JSX elements in your project. The [admonition](./markdown-features-admonitions.mdx) syntax that we offer is also generated by a [Remark plugin](https://github.com/elviswolcott/remark-admonitions), and you could do the same for your own use case.
|
||||
Use plugins to introduce shorter syntax for the most commonly used JSX elements in your project. The [admonition](./markdown-features-admonitions.mdx) syntax that we offer is also generated by a Remark plugin, and you could do the same for your own use case.
|
||||
|
||||
:::
|
||||
|
|
@ -180,26 +180,6 @@ module.exports = {
|
|||
};
|
||||
```
|
||||
|
||||
In addition to these plugins and themes, `@docusaurus/theme-classic` adds [`remark-admonitions`](https://github.com/elviswolcott/remark-admonitions) as a remark plugin to `@docusaurus/plugin-content-blog` and `@docusaurus/plugin-content-docs`.
|
||||
|
||||
The `admonitions` key will be passed as the [options](https://github.com/elviswolcott/remark-admonitions#options) to `remark-admonitions`. Passing `false` will prevent the plugin from being added to MDX.
|
||||
|
||||
```js title="docusaurus.config.js"
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
// options for remark-admonitions
|
||||
admonitions: {},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Installing presets {#installing-presets}
|
||||
|
||||
A preset is usually an npm package, so you install them like other npm packages using npm.
|
|
@ -1,4 +1,4 @@
|
|||
[
|
||||
"2.0.0-rc.1",
|
||||
"2.0.0-beta.22"
|
||||
"2.0.0",
|
||||
"2.0.0-rc.1"
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"2.0.0-beta.22": "https://62e6a82f2c09f60009c53522--docusaurus-2.netlify.app/docs/2.0.0-beta.22",
|
||||
"2.0.0-beta.21": "https://62d02ff810c1170009a4fa0c--docusaurus-2.netlify.app/docs/2.0.0-beta.21",
|
||||
"2.0.0-beta.20": "https://62c814ff3641af00082fe735--docusaurus-2.netlify.app/docs/2.0.0-beta.20",
|
||||
"2.0.0-beta.19": "https://6290e4c00805dd0009fb3080--docusaurus-2.netlify.app/docs/2.0.0-beta.19",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue