Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide character metrics console warnings on production - fixes #3853 #3854

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

borriglione
Copy link

What is the previous behavior before this PR?

It logs console warnings if no metric was found for the character in the current font and mode.

What is the new behavior after this PR?

It logs console warnings only in non-production NODE_ENV

Fixes #3853

Copy link
Member

@edemaine edemaine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing this. In addition to the style issues now highlighted below, there seems to a problem: process.env.NODE_ENV is getting evaluated and replaced at build time instead of at runtime. I see the following in dist/katex.js after running yarn build:

    const nodeEnv = typeof process !== 'undefined' && "production";

Presumably this is a feature of our build process (Webpack), and there's a way around it. Are you able to explore workarounds?

@kalvdans
Copy link

I think we can get rid of the warning completely, regardless of environment.

@edemaine
Copy link
Member

@kalvdans The warning serves a purpose: it tells you that the height of the character is unknown, so there's a decent chance it will be placed incorrectly. (A good example is within a \sqrt.)

@kalvdans
Copy link

@kalvdans The warning serves a purpose: it tells you that the height of the character is unknown, so there's a decent chance it will be placed incorrectly. (A good example is within a \sqrt.)

Yes but what should the user (document writer) do about it?

If the message is aimed for font developers, a full list of missing metrics is more useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't render character metrics console warnings on production
3 participants