Files
webawesome/docs/plugins/code-blocks.js
2020-02-16 18:23:29 -05:00

27 lines
579 B
JavaScript

window.$docsify.plugins.push(function(hook, vm) {
hook.beforeEach(function(content) {
//
// Convert custom preview blocks to previews + code blocks before markdown processing.
//
// ```lang preview
// [code]
// ```
//
// =>
//
// [code]
//
// ```lang
// [code]
// ```
//
content = content
.replace(/(```([a-z0-9-_]+) preview\s+(.*?)```)/gis, `$3\n$1`)
.replace(/(```[a-z0-9-_]+) preview/g, '$1');
content = content.replace(/{{year}}/g, new Date().getFullYear());
return content;
});
});