DEV: apply coding standards (#20)

This commit is contained in:
Joffrey JAFFEUX
2020-09-04 13:22:43 +02:00
committed by GitHub
parent 926fbdbb3d
commit e3068bb476
8 changed files with 1623 additions and 11 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-discourse"
}
+3
View File
@@ -1 +1,4 @@
.DS_Store
node_modules
yarn-error.log
.rubocop-https---raw-githubusercontent-com-discourse-*
+4
View File
@@ -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() {
return loadScript("/plugins/discourse-math/katex/katex.min.js").then(() => {
return loadScript("/plugins/discourse-math/katex/katex.min.css", {
css: true
css: true,
}).then(() => {
return loadScript("/plugins/discourse-math/katex/mhchem.min.js");
});
@@ -45,7 +45,7 @@ function katex($elem) {
function initializeMath(api) {
api.decorateCooked(
function(elem) {
function (elem) {
katex(elem);
},
{ id: "katex" }
@@ -60,9 +60,9 @@ export default {
siteSettings.discourse_math_enabled &&
siteSettings.discourse_math_provider === "katex"
) {
withPluginApi("0.5", function(api) {
withPluginApi("0.5", function (api) {
initializeMath(api);
});
}
}
},
};
@@ -20,7 +20,7 @@ function initMathJax(opts) {
TeX: { extensions: ["AMSmath.js", "AMSsymbols.js", "autoload-all.js"] },
extensions: extensions,
showProcessingMessages: false,
root: getURLWithCDN("/plugins/discourse-math/mathjax")
root: getURLWithCDN("/plugins/discourse-math/mathjax"),
};
if (opts.zoom_on_hover) {
@@ -118,7 +118,7 @@ function mathjax($elem, opts) {
function initializeMath(api, discourse_math_opts) {
api.decorateCooked(
function(elem) {
function (elem) {
mathjax(elem, discourse_math_opts);
},
{ id: "mathjax" }
@@ -132,15 +132,15 @@ export default {
let discourse_math_opts = {
zoom_on_hover: siteSettings.discourse_math_zoom_on_hover,
enable_accessibility: siteSettings.discourse_math_enable_accessibility,
enable_asciimath: siteSettings.discourse_math_enable_asciimath
enable_asciimath: siteSettings.discourse_math_enable_asciimath,
};
if (
siteSettings.discourse_math_enabled &&
siteSettings.discourse_math_provider === "mathjax"
) {
withPluginApi("0.5", function(api) {
withPluginApi("0.5", function (api) {
initializeMath(api, discourse_math_opts);
});
}
}
},
};
@@ -170,13 +170,13 @@ export function setup(helper) {
enable_asciimath = siteSettings.discourse_math_enable_asciimath;
});
helper.registerPlugin(md => {
helper.registerPlugin((md) => {
if (enable_asciimath) {
md.inline.ruler.after("escape", "asciimath", asciiMath);
}
md.inline.ruler.after("escape", "math", inlineMath);
md.block.ruler.after("code", "math", blockMath, {
alt: ["paragraph", "reference", "blockquote", "list"]
alt: ["paragraph", "reference", "blockquote", "list"],
});
});
}
+7
View File
@@ -0,0 +1,7 @@
{
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "latest"
}
}
+1595
View File
File diff suppressed because it is too large Load Diff