mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-22 23:39:50 +08:00
22 lines
531 B
JavaScript
22 lines
531 B
JavaScript
import parser from './parser';
|
|
|
|
const install = function (hook, vm) {
|
|
// Used to remove front matter from embedded pages if installed.
|
|
vm.config.frontMatter = {};
|
|
vm.config.frontMatter.installed = true;
|
|
vm.config.frontMatter.parseMarkdown = function (content) {
|
|
const { body } = parser(content);
|
|
return body;
|
|
};
|
|
|
|
hook.beforeEach(content => {
|
|
const { attributes, body } = parser(content);
|
|
|
|
vm.frontmatter = attributes;
|
|
|
|
return body;
|
|
});
|
|
};
|
|
|
|
$docsify.plugins = [].concat(install, $docsify.plugins);
|