Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -33,6 +35,8 @@ function getNextVersionName() {
}
const version = parseInt(lastReleasedVersion.replace(expectedPrefix, ''), 10);
return `${expectedPrefix}${version + 1}`;

*/
}

const allDocHomesPaths = [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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'),
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions website/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"2.0.0-rc.1",
"2.0.0-beta.22"
"2.0.0",
"2.0.0-rc.1"
]
1 change: 1 addition & 0 deletions website/versionsArchived.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down