docusaurus/packages/docusaurus-remark-plugin-npm2yarn/README.md
Fanny 4760e1225b
feat(v2): Extract npm2yarn plugin (#3469)
* chore(v2): add dependency

* test(v2): Add npm2yarn tests

* feat(v2): Move npm2yarn to a new remark plugin

* remark npm2yarn plugin => ready to release

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-10-15 19:30:12 +02:00

1 KiB

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')],
        },
        blog: {
          // ...
          remarkPlugins: [require('@docusaurus/remark-plugin-npm2yarn')],
        },
        pages: {
          // ...
          remarkPlugins: [require('@docusaurus/remark-plugin-npm2yarn')],
        },
        // ...
      },
    ],
  ],
  // ...
};