Run Prettier
This commit is contained in:
parent
9810a98d21
commit
024ea27fb9
|
@ -3,7 +3,9 @@ import loadScript from "discourse/lib/load-script";
|
|||
|
||||
function ensureKaTeX() {
|
||||
return loadScript("/plugins/discourse-math/katex/katex.min.js").then(() => {
|
||||
return loadScript("/plugins/discourse-math/katex/katex.min.css", { css: true }).then(() => {
|
||||
return loadScript("/plugins/discourse-math/katex/katex.min.css", {
|
||||
css: true
|
||||
}).then(() => {
|
||||
return loadScript("/plugins/discourse-math/katex/mhchem.min.js");
|
||||
});
|
||||
});
|
||||
|
@ -11,7 +13,7 @@ function ensureKaTeX() {
|
|||
|
||||
function decorate(elem) {
|
||||
const $elem = $(elem);
|
||||
const displayMode = elem.tagName === 'DIV';
|
||||
const displayMode = elem.tagName === "DIV";
|
||||
|
||||
if ($elem.data("applied-katex")) {
|
||||
return;
|
||||
|
@ -20,7 +22,7 @@ function decorate(elem) {
|
|||
|
||||
if ($elem.hasClass("math")) {
|
||||
const text = $elem.text();
|
||||
$elem.text('');
|
||||
$elem.text("");
|
||||
window.katex.render(text, elem, { displayMode });
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +51,10 @@ export default {
|
|||
name: "apply-math-katex",
|
||||
initialize(container) {
|
||||
const siteSettings = container.lookup("site-settings:main");
|
||||
if (siteSettings.discourse_math_enabled && siteSettings.discourse_math_provider === 'katex') {
|
||||
if (
|
||||
siteSettings.discourse_math_enabled &&
|
||||
siteSettings.discourse_math_provider === "katex"
|
||||
) {
|
||||
withPluginApi("0.5", function(api) {
|
||||
initializeMath(api);
|
||||
});
|
||||
|
|
|
@ -116,7 +116,10 @@ export default {
|
|||
enable_accessibility: siteSettings.discourse_math_enable_accessibility,
|
||||
enable_asciimath: siteSettings.discourse_math_enable_asciimath
|
||||
};
|
||||
if (siteSettings.discourse_math_enabled && siteSettings.discourse_math_provider === 'mathjax') {
|
||||
if (
|
||||
siteSettings.discourse_math_enabled &&
|
||||
siteSettings.discourse_math_provider === "mathjax"
|
||||
) {
|
||||
withPluginApi("0.5", function(api) {
|
||||
initializeMath(api, discourse_math_opts);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue