remark plugin to transform standard markdown headings to docusaurus(v2) JSX tabs.
npm install remark-docusaurus-tabs[remark][https://github.com/remarkjs/remark] plugin to transform standard markdown headings to [docusaurus][https://github.com/facebook/docusaurus] (v2) JSX tabs.
> This package expects [remark-slug][https://github.com/remarkjs/remark-slug] to be used before it, which is already the case for docusaurus, but may need to be considered if used outside docusaurus.
``sh`
npm install remark-docusaurus-tabs
Then add it to your site's docusaurus.config.js plugins option:
``
module.exports = {
// ...
plugins: ['remark-docusaurus-tabs'],
};
Annotate the markdown with a tabs comment prior to the first tab heading. For example, the following markdown file:
`mdApple
This is an apple 🍎
This is an orange 🍊
This is a banana 🍌
`
will be transformed to:
`mdx
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This is an apple 🍎
This is an orange 🍊
This is a banana 🍌
`
The first heading after the tabs comment becomes the first tab, with the other tabs taken from the headings with the same level as the first heading. The tab body is the content between the headings. The tabs finish when there is a higher level heading, or may be terminated explicitly with a /tabs` comment.
[MIT][LICENSE] © [Paul McClean][author]