|
|
|
@ -55,10 +55,6 @@ mkdown.renderer.rules.emoji = function(token, idx) {
|
|
|
|
|
return '<i class="twa twa-' + token[idx].markup + '"></i>';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mkdown.inline.ruler.push('internal_link', (state) => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parse markdown content and build TOC tree
|
|
|
|
|
*
|
|
|
|
@ -159,10 +155,23 @@ const parseContent = (content) => {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const parseMeta = (content) => {
|
|
|
|
|
|
|
|
|
|
let commentMeta = new RegExp('<!-- ?([a-zA-Z]+):(.*)-->','g');
|
|
|
|
|
let results = {}, match;
|
|
|
|
|
while(match = commentMeta.exec(content)) {
|
|
|
|
|
results[_.toLower(match[1])] = _.trim(match[2]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
|
|
parse(content) {
|
|
|
|
|
return {
|
|
|
|
|
meta: parseMeta(content),
|
|
|
|
|
html: parseContent(content),
|
|
|
|
|
tree: parseTree(content)
|
|
|
|
|
};
|
|
|
|
|