Skip to content

KaTeX (4/n): Ignore classes that don't have CSS definition #1601

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

Merged
merged 2 commits into from
Jul 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/model/katex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,19 @@ class _KatexParser {
case 'mop':
case 'mclose':
case 'minner':
case 'mbin':
case 'mpunct':
case 'nobreak':
case 'allowbreak':
case 'mathdefault':
Comment on lines +360 to +364
Copy link
Member

Choose a reason for hiding this comment

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

This change looks good, but leaves it still a bit mysterious why these classes are there in the KaTeX output if we really don't need to do anything about them.

As it happens, while I was reviewing #1609 earlier today I came across a couple of threads in the KaTeX tracker that basically answer that question. So I've just pushed a commit on top which adds a comment linking to those:
cbeef34 content [nfc]: Explain why some KaTeX CSS classes are unused in its CSS

// Ignore these classes because they don't have a CSS definition
// in katex.scss, but we encounter them in the generated HTML.
// (Why are they there if they're not used? The story seems to be:
// they were used in KaTeX's CSS in the past, before 2020 or so; and
// they're still used internally by KaTeX in producing the HTML.
// https://github.com/KaTeX/KaTeX/issues/2194#issuecomment-584703052
// https://github.com/KaTeX/KaTeX/issues/3344
// )
break;

default:
Expand Down