BuptStEve / vuepress-plugin-demo-code

📝 Demo and code plugin for vuepress
https://buptsteve.github.io/vuepress-plugin-demo-code/
MIT License
124 stars 28 forks source link

feat: support jsfiddle framework API parameter #34

Closed mrspence closed 3 years ago

mrspence commented 3 years ago

JSFiddle has a parameter where you can specify if your code is plain or uses a framework. This is useful if you'd like to use Vue for example.

I've added the ability to specify the framework via the config parameters, for example:

module.exports = {
    plugins: [
        ['demo-code', {
            jsLibs: [
                // umd
                'https://unpkg.com/tua-storage/dist/TuaStorage.umd.js',
            ],
            cssLibs: [
                'https://unpkg.com/animate.css@3.7.0/animate.min.css',
            ],
            showText: 'show code',
            hideText: 'hide',
            styleStr: 'text-decoration: underline;',
            minHeight: 200,
            onlineBtns: {
                codepen: true,
                jsfiddle: true,
                codesandbox: true,
            },
            codesandbox: {
                deps: { 'lodash': 'latest' },
                json: '',
                query: '',
                embed: '',
            },
            jsfiddle: {
                framework: "library/pure", // default
                // framework: "vue/2.6.11",
            },
            demoCodeMark: 'demo-code',
            copyOptions: { ... },
        }]
    ],
}
BuptStEve commented 3 years ago

Thank you for your PR~, I'll take it into consideration.

BuptStEve commented 3 years ago

@all-contributors please add @mrspence for code

allcontributors[bot] commented 3 years ago

@BuptStEve

I've put up a pull request to add @mrspence! :tada: