FIX: prevents md processing if plugin is disabled (#31)
This commit is contained in:
parent
152a7b5c60
commit
c925f7e2a3
|
@ -164,19 +164,20 @@ export function setup(helper) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let enable_asciimath;
|
|
||||||
helper.registerOptions((opts, siteSettings) => {
|
helper.registerOptions((opts, siteSettings) => {
|
||||||
opts.features.math = siteSettings.discourse_math_enabled;
|
opts.features.math = siteSettings.discourse_math_enabled;
|
||||||
enable_asciimath = siteSettings.discourse_math_enable_asciimath;
|
opts.features.asciimath = siteSettings.discourse_math_enable_asciimath;
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.registerPlugin((md) => {
|
helper.registerPlugin((md) => {
|
||||||
if (enable_asciimath) {
|
if (md.options.discourse.features.math) {
|
||||||
|
if (md.options.discourse.features.asciimath) {
|
||||||
md.inline.ruler.after("escape", "asciimath", asciiMath);
|
md.inline.ruler.after("escape", "asciimath", asciiMath);
|
||||||
}
|
}
|
||||||
md.inline.ruler.after("escape", "math", inlineMath);
|
md.inline.ruler.after("escape", "math", inlineMath);
|
||||||
md.block.ruler.after("code", "math", blockMath, {
|
md.block.ruler.after("code", "math", blockMath, {
|
||||||
alt: ["paragraph", "reference", "blockquote", "list"],
|
alt: ["paragraph", "reference", "blockquote", "list"],
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue