Skip to content

Conversation

rajveermalviya
Copy link
Member

Fixes: #1716

@rajveermalviya rajveermalviya added a-tex TeX/LaTeX content, as rendered by KaTeX integration review Added by maintainers when PR may be ready for integration labels Sep 1, 2025
Comment on lines 359 to 361
// We ignore the styling for .vlist-t2 CSS class on the root vlist
// span, and also the styling for .vlist-s CSS class on the empty span
// in the first .vlist-r span, because in KaTeX they only exists as a
Copy link
Member

Choose a reason for hiding this comment

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

The vlist-t2 and vlist-s classes should always appear in tandem, right? And I think that's a critical part of the reasoning here — each of them does have an effect, of 2px, but those effects cancel each other out.

So as I said on the issue (#1716 (comment)), we should verify that the vlist-t2 class appears exactly when a .vlist-s span is present.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the comment with a link to KaTeX implementation showing both classes are always present in tandem, and also mentioning that I verified that tehy cancel each others effect out.

@rajveermalviya
Copy link
Member Author

Thanks for the review @gnprice! Pushed an update, PTAL.

@gnprice
Copy link
Member

gnprice commented Sep 5, 2025

Cool, that's helpful, thanks.

What I really had in mind by "verify" was to have the parser verify that the HTML it sees matches that description, like we do already for facts like "there's at most two rows; any second row has one cell; that one cell has no inline styles other than height". But the KaTeX JS here seems clear enough that I'm OK with a comment explaining the analysis (with that handy link to the code) instead.

I feel like the reasoning, and its relationship to the logic in this parser method, can still be clearer, though. So I've just pushed a couple of added commits to try to do that:
7763deb katex [nfc]: Rename a local to hasVlistT2
32d2096 katex [nfc]: Clarify structure of "vlist" HTML and our reasoning about it

PTAL and fact-check that the details in those comments all look right to you.

(I also made a commit-message tweak: the first/existing commit is NFC, since it only touches comments.)

@rajveermalviya
Copy link
Member Author

Thanks for doing this, those comments LGTM!

rajveermalviya and others added 3 commits September 8, 2025 14:43
This reflects the condition that's directly encoded by this boolean.
(Through several conditionals in the rest of the function, we end up
confirming that this value is true just if the element does in fact
have two `.vlist-r` children, as the old name suggests.  But that
comes later and more indirectly.)
…t it

Mostly this moves and revises comments.  Also rename one local to
"depthStrut" to match its name in the KaTeX JS, which we also now use
in the explanatory comment.
@gnprice
Copy link
Member

gnprice commented Sep 8, 2025

Thanks! Merging.

@gnprice gnprice merged commit ce8802b into zulip:main Sep 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-tex TeX/LaTeX content, as rendered by KaTeX integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle styling for .vlist-t2 spans in KaTeX HTML
2 participants