Skip to content

Commit

Permalink
KaTeX#3853: hide character metrics console warnings on production
Browse files Browse the repository at this point in the history
  • Loading branch information
borriglione committed Sep 1, 2023
1 parent 4f1d916 commit d130cb9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/buildCommon.js
Expand Up @@ -71,9 +71,13 @@ const makeSymbol = function(
value, metrics.height, metrics.depth, italic, metrics.skew,
metrics.width, classes);
} else {
// TODO(emily): Figure out a good way to only print this in development
typeof console !== "undefined" && console.warn("No character metrics " +
const nodeEnv = typeof process !== 'undefined' && process.env.NODE_ENV
const isProduction = nodeEnv === 'production'
const showCharacterMetricsWarning = !isProduction && typeof console !== 'undefined'
if (showCharacterMetricsWarning) {
console.warn("No character metrics " +
`for '${value}' in style '${fontName}' and mode '${mode}'`);
}
symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
}

Expand Down

0 comments on commit d130cb9

Please sign in to comment.