calebman / vuepress-plugin-demo-container

Vuepress plugin for demo block.
https://calebman.github.io/vuepress-plugin-demo-container/
MIT License
119 stars 38 forks source link

支持 vuepress 代码块导入 #15

Closed winyh closed 9 months ago

winyh commented 4 years ago

代码块书写方式:

:::demo <<< @/examples/ButtonExample/index.vue :::

改动位置:

const fs = require("fs)

if (
            !content &&
            tokens[idx + 1].type === "fence" &&
            tokens[idx + 1].src
) {
            const filepath = tokens[idx + 1].src;
            source = fs.readFileSync(filepath).toString();
            content = source;
}