08-27-周三_17-09-29
This commit is contained in:
30
node_modules/gitbook-plugin-mermaid-gb3/index.js
generated
vendored
Normal file
30
node_modules/gitbook-plugin-mermaid-gb3/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var mermaidRegex = /^```mermaid((.*[\r\n]+)+?)?```$/im;
|
||||
|
||||
function processMermaidBlockList(page) {
|
||||
|
||||
var match;
|
||||
|
||||
while ((match = mermaidRegex.exec(page.content))) {
|
||||
var rawBlock = match[0];
|
||||
var mermaidContent = match[1];
|
||||
page.content = page.content.replace(rawBlock, '<div class="mermaid">' +
|
||||
mermaidContent + '</div>');
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
website: {
|
||||
assets: './dist',
|
||||
css: [
|
||||
'mermaid/mermaid.css'
|
||||
],
|
||||
js: [
|
||||
'book/plugin.js'
|
||||
]
|
||||
},
|
||||
hooks: {
|
||||
'page:before': processMermaidBlockList
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user