Settings.js (940B)
1 /** 2 * This is a module for storing settings passed into KaTeX. It correctly handles 3 * default settings. 4 */ 5 6 const utils = require("./utils"); 7 8 /** 9 * The main Settings object 10 * 11 * The current options stored are: 12 * - displayMode: Whether the expression should be typeset as inline math 13 * (false, the default), meaning that the math starts in 14 * \textstyle and is placed in an inline-block); or as display 15 * math (true), meaning that the math starts in \displaystyle 16 * and is placed in a block with vertical margin. 17 */ 18 function Settings(options) { 19 // allow null options 20 options = options || {}; 21 this.displayMode = utils.deflt(options.displayMode, false); 22 this.throwOnError = utils.deflt(options.throwOnError, true); 23 this.errorColor = utils.deflt(options.errorColor, "#cc0000"); 24 this.macros = options.macros || {}; 25 } 26 27 module.exports = Settings;