DEV: apply coding standards (#20)
This commit is contained in:
parent
926fbdbb3d
commit
e3068bb476
|
@ -1 +1,4 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
yarn-error.log
|
||||||
|
.rubocop-https---raw-githubusercontent-com-discourse-*
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
plugins: ["ember-template-lint-plugin-discourse"],
|
||||||
|
extends: "discourse:recommended",
|
||||||
|
};
|
|
@ -4,7 +4,7 @@ import loadScript from "discourse/lib/load-script";
|
||||||
function ensureKaTeX() {
|
function ensureKaTeX() {
|
||||||
return loadScript("/plugins/discourse-math/katex/katex.min.js").then(() => {
|
return loadScript("/plugins/discourse-math/katex/katex.min.js").then(() => {
|
||||||
return loadScript("/plugins/discourse-math/katex/katex.min.css", {
|
return loadScript("/plugins/discourse-math/katex/katex.min.css", {
|
||||||
css: true
|
css: true,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return loadScript("/plugins/discourse-math/katex/mhchem.min.js");
|
return loadScript("/plugins/discourse-math/katex/mhchem.min.js");
|
||||||
});
|
});
|
||||||
|
@ -64,5 +64,5 @@ export default {
|
||||||
initializeMath(api);
|
initializeMath(api);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,7 @@ function initMathJax(opts) {
|
||||||
TeX: { extensions: ["AMSmath.js", "AMSsymbols.js", "autoload-all.js"] },
|
TeX: { extensions: ["AMSmath.js", "AMSsymbols.js", "autoload-all.js"] },
|
||||||
extensions: extensions,
|
extensions: extensions,
|
||||||
showProcessingMessages: false,
|
showProcessingMessages: false,
|
||||||
root: getURLWithCDN("/plugins/discourse-math/mathjax")
|
root: getURLWithCDN("/plugins/discourse-math/mathjax"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (opts.zoom_on_hover) {
|
if (opts.zoom_on_hover) {
|
||||||
|
@ -132,7 +132,7 @@ export default {
|
||||||
let discourse_math_opts = {
|
let discourse_math_opts = {
|
||||||
zoom_on_hover: siteSettings.discourse_math_zoom_on_hover,
|
zoom_on_hover: siteSettings.discourse_math_zoom_on_hover,
|
||||||
enable_accessibility: siteSettings.discourse_math_enable_accessibility,
|
enable_accessibility: siteSettings.discourse_math_enable_accessibility,
|
||||||
enable_asciimath: siteSettings.discourse_math_enable_asciimath
|
enable_asciimath: siteSettings.discourse_math_enable_asciimath,
|
||||||
};
|
};
|
||||||
if (
|
if (
|
||||||
siteSettings.discourse_math_enabled &&
|
siteSettings.discourse_math_enabled &&
|
||||||
|
@ -142,5 +142,5 @@ export default {
|
||||||
initializeMath(api, discourse_math_opts);
|
initializeMath(api, discourse_math_opts);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -170,13 +170,13 @@ export function setup(helper) {
|
||||||
enable_asciimath = siteSettings.discourse_math_enable_asciimath;
|
enable_asciimath = siteSettings.discourse_math_enable_asciimath;
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.registerPlugin(md => {
|
helper.registerPlugin((md) => {
|
||||||
if (enable_asciimath) {
|
if (enable_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"],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"author": "Discourse",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint-config-discourse": "latest"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue