mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 03:13:48 +08:00
27 lines
627 B
JavaScript
27 lines
627 B
JavaScript
export function setup(helper) {
|
|
helper.registerOptions((opts, siteSettings) => {
|
|
opts.features["footnotes"] =
|
|
window.markdownitFootnote && !!siteSettings.enable_markdown_footnotes;
|
|
});
|
|
|
|
helper.allowList([
|
|
"ol.footnotes-list",
|
|
"hr.footnotes-sep",
|
|
"li.footnote-item",
|
|
"a.footnote-backref",
|
|
"sup.footnote-ref",
|
|
]);
|
|
|
|
helper.allowList({
|
|
custom(tag, name, value) {
|
|
if ((tag === "a" || tag === "li") && name === "id") {
|
|
return !!value.match(/^fn(ref)?\d+$/);
|
|
}
|
|
},
|
|
});
|
|
|
|
if (window.markdownitFootnote) {
|
|
helper.registerPlugin(window.markdownitFootnote);
|
|
}
|
|
}
|