Skip to content

content: Include inline styles (italic etc.) in what we pass to WidgetSpans #1821

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

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

Conversation

chrisbobbe
Copy link
Collaborator

@chrisbobbe chrisbobbe commented Aug 20, 2025

Fixes #1813.
Fixes #1819.
Fixes #1823.

I've left out further testing because we have other pressing priorities; please let me know if something's missing or not well-explained.


Before After
image image

@chrisbobbe chrisbobbe added the maintainer review PR ready for review by Zulip maintainers label Aug 20, 2025
Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @chrisbobbe! LGTM, couple of small comments below.

// Remove link color, but
// TODO(design) do we want to do that?
color: baseColor,
// italic and strikethrough are removed below, but
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I did a quick test and it looks like strikethrough seems to work:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yeah that's right:

  • The strikethrough is not applied to the katex in the WidgetSpan
  • …but it is applied to an ancestor span, and the inline-katex implementation doesn't obscure it by setting an opaque background :) so it shows through

// Just for completeness, remove "wght", but it wouldn't do anything anyway
// since KaTeX_Main is not a variable-weight font.
fontVariations: [],
// Remove link color, but
Copy link
Member

Choose a reason for hiding this comment

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

Looks like web client currently applies the link color over inline TeX, so we probably want to handle it similarly.

Copy link
Member

Choose a reason for hiding this comment

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

Filed #1823 for that, so probably add a TODO pointing to that.

In the inline-math case, we're about to pass the actual ambient text
style, which may have italic, strikethrough, bold, or link
formatting. Consolidate the code that overrides each of those, so
that it reads as intentional, and add TODOs for overrides that we
might not want to keep.
…tSpans

Fixes zulip#1813.
Fixes zulip#1819.

This is NFC for inline math, since all the inline styles are
overridden there. But see the previous commit for where we
consolidated those overrides, making a natural place to add more if
needed in the future, with TODOs for some existing ones we might not
want to keep.
@chrisbobbe chrisbobbe force-pushed the pr-widget-span-not-getting-inline-styles-fix branch from f24d250 to 8310d37 Compare August 20, 2025 23:04
@chrisbobbe
Copy link
Collaborator Author

Thanks! Revision pushed, expanding the comment about strikethrough and adding a commit for #1823. Here are screenshots before and after that new commit:

Before After
image image

Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

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

Thanks @chrisbobbe! LGTM, moving over to Greg's review.

@rajveermalviya rajveermalviya added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Aug 21, 2025
@rajveermalviya rajveermalviya requested a review from gnprice August 21, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
3 participants