discourse/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6

Failed to ignore revisions in .git-blame-ignore-revs.

32 lines
661 B
Plaintext
Raw Normal View History

const rule = {
2018-06-15 12:42:20 -04:00
tag: "details",
2017-07-21 16:16:07 -04:00
before: function(state, tagInfo) {
const attrs = tagInfo.attrs;
2018-06-15 12:42:20 -04:00
state.push("bbcode_open", "details", 1);
state.push("bbcode_open", "summary", 1);
2018-06-15 12:42:20 -04:00
let token = state.push("text", "", 0);
token.content = attrs["_default"] || "";
2018-06-15 12:42:20 -04:00
state.push("bbcode_close", "summary", -1);
},
after: function(state) {
2018-06-15 12:42:20 -04:00
state.push("bbcode_close", "details", -1);
}
};
export function setup(helper) {
helper.whiteList([
2018-06-15 12:42:20 -04:00
"summary",
"summary[title]",
"details",
"details[open]",
"details.elided"
]);
helper.registerPlugin(md => {
2018-06-15 12:42:20 -04:00
md.block.bbcode.ruler.push("details", rule);
});
}