Code Tabs
Less than 1 minute
The plugin provides you code tabs support.
Settings
TS
// .vuepress/config.ts
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";
export default {
plugins: [
mdEnhancePlugin({
// adds code tabs support
codetabs: true,
}),
],
};
JS
// .vuepress/config.js
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance";
export default {
plugins: [
mdEnhancePlugin({
// adds code tabs support
codetabs: true,
}),
],
};
Usage
This is the same as tabs feature, but it's special built for code blocks.
Only code fence after @tab
marker is allowed inside code tabs, other Markdown content will be ignored.
Demo
Install VuePress Theme Hope:
pnpm
pnpm add -D vuepress-theme-hope
yarn
yarn add -D vuepress-theme-hope
npm
npm i -D vuepress-theme-hope
Install VuePress Plugin Markdown Enhance:
pnpm
pnpm add -D vuepress-plugin-md-enhance
yarn
yarn add -D vuepress-plugin-md-enhance
npm
npm i -D vuepress-plugin-md-enhance
Install VuePress Theme Hope:
::: code-tabs#shell
@tab pnpm
```bash
pnpm add -D vuepress-theme-hope
```
@tab yarn
```bash
yarn add -D vuepress-theme-hope
```
@tab:active npm
```bash
npm i -D vuepress-theme-hope
```
:::
Install VuePress Plugin Markdown Enhance:
::: code-tabs#shell
@tab pnpm
```bash
pnpm add -D vuepress-plugin-md-enhance
```
@tab yarn
```bash
yarn add -D vuepress-plugin-md-enhance
```
@tab:active npm
```bash
npm i -D vuepress-plugin-md-enhance
```
:::