diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 39939f306..3dfc6c348 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -46,6 +46,27 @@ const mathParser = new MathParser({ array : false, fndef : false } }); +// Add absolute function +mathParser.functions.abs = function (a) { + return Math.abs(a); +}; +// Add sign function +mathParser.functions.sign = function (a) { + if(a == 0) return ''; + if(a > 0) { + return '\\+'; + } else { + return '\\-'; + } +}; +// Add signed function +mathParser.functions.signed = function (a) { + if(a >= 0) { + return `\\+${a}`; + } else { + return `\\${a}`; + } +}; //Processes the markdown within an HTML block if it's just a class-wrapper renderer.html = function (html) {