This commit is contained in:
amehime
2020-05-01 19:52:15 +08:00
parent b138300c02
commit f398c7a1e5

View File

@@ -79,14 +79,16 @@ module.exports = function (data, options) {
}
if (plugins.name == 'markdown-it-container') {
return parser.use(plugin, 'segment', {
return parser.use(plugin, 'note', {
validate: function (params) {
return params.trim().match(/^note\s+(default|primary|success|info|warning|danger)$/);
},
render: function (tokens, idx) {
var m = tokens[idx].info.trim().match(/^segment\s+(.*)$/);
var m = tokens[idx].info.trim().match(/^note\s+(.*)$/);
if (tokens[idx].nesting === 1) {
// opening tag
return '<div class="' + m[1] + '">\n';
return '<div class="note ' + m[1] + '">\n';
} else {
// closing tag