This commit is contained in:
amehime
2020-08-23 19:10:26 +08:00
parent 4092fae8c4
commit 71fb032a08
2 changed files with 21 additions and 1 deletions

View File

@@ -19,4 +19,24 @@ module.exports = function (md, options) {
}
}
});
md.use(plugin, 'tab', {
validate: function(params) {
return params.trim().match(/^tab\s+(.*)\|\|(.*)$/);
},
render: function (tokens, idx) {
var m = tokens[idx].info.trim().match(/^tab\s+(.*)\|\|(.*)$/);
if (tokens[idx].nesting === 1) {
// opening tag
return '<div class="tab" data-id="'+m[1].trim()+'" data-title="'+m[2].trim()+'">\n';
} else {
// closing tag
return '</div>\n';
}
}
});
}

View File

@@ -1,6 +1,6 @@
{
"name": "hexo-renderer-multi-markdown-it",
"version": "0.0.8",
"version": "0.0.9",
"description": "A Markdown parser for Hexo and auto Minify HTML, CSS, JS.",
"main": "index.js",
"repository": "https://github.com/amehime/hexo-renderer-multi-markdown-it.git",