Giter VIP home page Giter VIP logo

vitepress-plugin-npm2yarn's Introduction

vitepress-plugin-npm2yarn

该插件的作用是当你在写一些文档或者教程时,可以很方便的将 npm bash 代码转化为 yarn bash,反之亦然。

wait vitepress new theme vuejs/vitepress#232

现在可以使用 vitepress-plugin-code-group 来进行支持了,而不用等待官方的 new theme 来支持。

安装

npm install vitepress-plugin-npm2yarn
// 若theme没有支持 codeGroup 还需要安装
npm install vitepress-plugin-code-group

使用

//.vitepress/config.js
const { npm2yarnPlugin } = require("vitepress-plugin-npm2yarn");
module.exports = {
  markdown: {
    config: (md) => {
      // use more markdown-it plugins!
      md.use(npm2yarnPlugin);
    },
  },
};

// 若theme没有支持 codeGroup 还需要配置
// .vitepress/theme/index.js

import DefaultTheme from "vitepress/theme";
import { CodeGroup, CodeGroupItem } from "vitepress-plugin-code-group";
import "vitepress-plugin-code-group/dist/style.css";
export default {
  ...DefaultTheme,
  enhanceApp({ app }) {
    // add
    app.component("CodeGroup", CodeGroup);
    app.component("CodeGroupItem", CodeGroupItem);
    // end
  },
};

当你需要在 md 文件中使用时,仅需要添加npm2yarn即可识别。

// ```bash npm2yarn

// yarn run start

// ```

vitepress-plugin-npm2yarn's People

Contributors

berber1016 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.