mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 13:17:23 +02:00
* chore(v2): upgrade dependencies * Set minimum Node.js version to 12.13 * Fix test * Upgrade copy-text-to-clipboard * Bump Node versions * Update .nvmrc * mark cacheTime as forbidded field * Downgrade jest to v25.2.7 * Increase Node version for Windows CI * Test fix * Attempt to fix Windows CI * Downgrade execa * fix async test errors * Upgrade execa Co-authored-by: slorber <lorber.sebastien@gmail.com> |
||
---|---|---|
.. | ||
src | ||
example.png | ||
package.json | ||
README.md |
Remark plugin npm2yarn
Motivation:
Transforms npm bash command code blocks to Docusaurus tabs:
The following (remove the //
):
// ```bash npm2yarn
// npm run build
// ```
Becomes:
Note: it only works when used with Docusaurus themes that have the Tabs
and TabItems
components.
Install
npm install @docusaurus/remark-plugin-npm2yarn
It is a Remark plugin, not a Docusaurus plugin, so you have to install it as a Remark plugin in the config of your Docusaurus plugins.
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
// ...
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
],
},
blog: {
// ...
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
],
},
pages: {
// ...
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
],
},
// ...
},
],
],
// ...
};
Options
Property | Type | Default | Description |
---|---|---|---|
sync |
boolean |
false |
Syncing tab choices (yarn and npm). See https://v2.docusaurus.io/docs/markdown-features/#syncing-tab-choices for details. |