MCPcopy Create free account
hub / github.com/TruthHun/BookStack / mathsym

Function mathsym

static/katex/katex.mjs:5330–5349  ·  view source on GitHub ↗
(value, mode, options, classes)

Source from the content-addressed store, hash-verified

5328
5329
5330const mathsym = function mathsym(value, mode, options, classes) {
5331 if (classes === void 0) {
5332 classes = [];
5333 }
5334
5335 // Decide what font to render the symbol in by its entry in the symbols
5336 // table.
5337 // Have a special case for when the value = \ because the \ is used as a
5338 // textord in unsupported command errors but cannot be parsed as a regular
5339 // text ordinal and is therefore not present as a symbol in the symbols
5340 // table for text, as well as a special case for boldsymbol because it
5341 // can be used for bold + and -
5342 if (options && options.font && options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) {
5343 return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
5344 } else if (value === "\\" || symbols[mode][value].font === "main") {
5345 return makeSymbol(value, "Main-Regular", mode, options, classes);
5346 } else {
5347 return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
5348 }
5349};
5350/**
5351 * Determines which of the two font names (Main-Italic and Math-Italic) and
5352 * corresponding style tags (maindefault or mathit) to use for default math font,

Callers

nothing calls this directly

Calls 2

lookupSymbolFunction · 0.85
makeSymbolFunction · 0.85

Tested by

no test coverage detected