mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 10:22:30 +02:00
feat(v2): add remark-admonitions to @docusaurus/preset-classic (#2224)
* feat(v2): add remark-admonitions * feat(v2): add admonitions to style guide * style: cleanup changes * docs(v2): document how to use admonitions * docs(v2): use proper package name * docs(v2): add link to remark-admonitions docs * style(v2): clean up addAdmonitions
This commit is contained in:
parent
b7a2ad2904
commit
0fa080c39c
8 changed files with 125 additions and 6 deletions
|
@ -16,7 +16,9 @@ Docusaurus 2 uses modern tooling to help you compose your interactive documentat
|
|||
|
||||
In this section, we'd like to introduce you to the tools we've picked that we believe will help you build powerful documentation. Let us walk you through with an example.
|
||||
|
||||
**Note:** All the following content assumes you are using `docusaurus-preset-classic`.
|
||||
:::important
|
||||
All the following content assumes you are using `@docusaurus/preset-classic`.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
|
@ -467,3 +469,20 @@ class HelloWorld {
|
|||
</Tabs>
|
||||
|
||||
You may want to implement your own `<MultiLanguageCode />` abstraction if you find the above approach too verbose. We might just implement one in future for convenience.
|
||||
|
||||
### Callouts/admonitions
|
||||
|
||||
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.
|
||||
|
||||
Example:
|
||||
|
||||
```markdown
|
||||
:::tip Title
|
||||
The and title *can* include markdown.
|
||||
:::
|
||||
```
|
||||
|
||||
:::tip Title
|
||||
The content and title *can* include markdown.
|
||||
:::
|
|
@ -112,6 +112,27 @@ 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
|
||||
// docusaurus.config.js
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
// options for remark-admonitions
|
||||
admonitions: {},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Advanced guide on using and configuring presets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue