2017-06-08 18:02:30 -04:00
|
|
|
const rule = {
|
2018-06-15 12:42:20 -04:00
|
|
|
tag: "details",
|
2021-11-13 08:01:55 -05:00
|
|
|
before(state, tagInfo) {
|
2017-07-21 16:16:07 -04:00
|
|
|
const attrs = tagInfo.attrs;
|
2018-06-15 12:42:20 -04:00
|
|
|
state.push("bbcode_open", "details", 1);
|
|
|
|
state.push("bbcode_open", "summary", 1);
|
2017-06-08 18:02:30 -04:00
|
|
|
|
2018-06-15 12:42:20 -04:00
|
|
|
let token = state.push("text", "", 0);
|
|
|
|
token.content = attrs["_default"] || "";
|
2017-06-08 18:02:30 -04:00
|
|
|
|
2018-06-15 12:42:20 -04:00
|
|
|
state.push("bbcode_close", "summary", -1);
|
2017-06-08 18:02:30 -04:00
|
|
|
},
|
|
|
|
|
2021-11-13 08:01:55 -05:00
|
|
|
after(state) {
|
2018-06-15 12:42:20 -04:00
|
|
|
state.push("bbcode_close", "details", -1);
|
2017-06-08 18:02:30 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-06-14 14:31:51 -04:00
|
|
|
export function setup(helper) {
|
2020-10-27 22:22:06 -04:00
|
|
|
helper.allowList([
|
2018-06-15 12:42:20 -04:00
|
|
|
"summary",
|
|
|
|
"summary[title]",
|
|
|
|
"details",
|
|
|
|
"details[open]",
|
|
|
|
"details.elided",
|
2016-07-06 13:12:21 -04:00
|
|
|
]);
|
|
|
|
|
2017-07-14 08:27:28 -04:00
|
|
|
helper.registerPlugin((md) => {
|
2018-06-15 12:42:20 -04:00
|
|
|
md.block.bbcode.ruler.push("details", rule);
|
2017-07-14 08:27:28 -04:00
|
|
|
});
|
2016-06-14 14:31:51 -04:00
|
|
|
}
|