docusaurus/packages/docusaurus-remark-plugin-npm2yarn
Joshua Chen e8a07633ba
chore: upgrade dependencies (#8534)
* chore: upgrade dependencies

* FIxes

* Bump again
2023-01-10 13:23:16 -05:00
..
src chore: upgrade dependencies (#8534) 2023-01-10 13:23:16 -05:00
.npmignore misc: make copyUntypedFiles work for watch mode (#7445) 2022-05-18 19:18:32 +08:00
example.png
package.json chore: upgrade dependencies (#8534) 2023-01-10 13:23:16 -05:00
README.md docs: normalize capitalization (#7613) 2022-06-14 14:01:06 +08:00
tsconfig.json chore: upgrade to TS 4.7, compile with NodeNext (#7586) 2022-06-15 19:15:11 +02:00

Remark plugin npm2yarn

Motivation:

Transforms npm bash command code blocks to Docusaurus tabs:

The following (remove the //):

// ```bash npm2yarn
// npm run build
// ```

Becomes:

npm2yarn tabs example

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://docusaurus.io/docs/markdown-features/#syncing-tab-choices for details.