@starzkg/vuepress-plugin-copy-code
Version:
Copy Code plugin for vuepress
32 lines (31 loc) • 1.46 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const vuepress_shared_1 = require("@starzkg/vuepress-shared");
const utils_1 = require("@vuepress/utils");
const vuepress_plugin_sass_palette_1 = require("vuepress-plugin-sass-palette");
const i18n_1 = require("./i18n");
__exportStar(require("../shared"), exports);
const copyCodePlugin = (options, app) => {
(0, vuepress_plugin_sass_palette_1.usePalettePlugin)(app, { id: 'hope' });
return {
name: '@starzkg/vuepress-plugin-copy-code',
define: () => ({
CODE_COPY_OPTIONS: Object.keys(options).length > 0
? options
: app.options.themeConfig.copyCode || {},
CODE_COPY_I18N: (0, vuepress_shared_1.getLocales)(app, i18n_1.i18n, options.locale),
}),
clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
};
};
exports.default = copyCodePlugin;