mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
29 lines
803 B
JavaScript
29 lines
803 B
JavaScript
/**
|
|
* This is a module for storing settings passed into KaTeX. It correctly handles
|
|
* default settings.
|
|
*/
|
|
|
|
/**
|
|
* Helper function for getting a default value if the value is undefined
|
|
*/
|
|
function get(option, defaultValue) {
|
|
return option === undefined ? defaultValue : option;
|
|
}
|
|
|
|
/**
|
|
* The main Settings object
|
|
*
|
|
* The current options stored are:
|
|
* - displayMode: Whether the expression should be typeset by default in
|
|
* textstyle or displaystyle (default false)
|
|
*/
|
|
function Settings(options) {
|
|
// allow null options
|
|
options = options || {};
|
|
this.displayMode = get(options.displayMode, false);
|
|
this.breakOnUnsupportedCmds = get(options.breakOnUnsupportedCmds, true);
|
|
this.errorColor = get(options.errorColor, "#cc0000");
|
|
}
|
|
|
|
module.exports = Settings;
|