Skip to content

katex: Remove renderKaTex experimental flag #1742

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 3 commits into from
Jul 28, 2025

Conversation

rajveermalviya
Copy link
Member

This flag has been enabled since v0.0.29 (beta) release, and we don't plan to disable it. So remove the flag completely, simplifying related code.

Fixes: #1728

Copy link
Member

@gnprice gnprice 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 cleaning this up! Generally all looks good; small comments below.

Comment on lines -1028 to -1038
}, skip: true // TODO(#46): adapt this test
// (it needs a more complex targetFontSizeFinder;
// see other uses in this file for examples.)
Copy link
Member

Choose a reason for hiding this comment

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

nit:

content test [nfc]: Drop duplicate skipped KaTeX font-size ratio test

rather, it's a skipped duplicate such test — there's another KaTeX font-size ratio test, which this is a duplicate of, but there's no other skipped KaTeX font-size ratio test, so it can't be a duplicate within that category.

Copy link
Member

Choose a reason for hiding this comment

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

Also please add a sentence to the commit message clarifying that the existing test this duplicates is the one above it, not the one below. I initially read it as the latter (because the descriptions match — my conflict-resolution error, probably, somewhere in the chain of cherry-picking that led to b073c6b / #1270), and was going to comment that it's not actually a duplicate of that 🙂

});

testWidgets('displays KaTeX content; experimental flag enabled', (tester) async {
Copy link
Member

Choose a reason for hiding this comment

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

nit: make summary line more specific

content test [nfc]: Reorder KaTeX widget tests

With renderKatex flag enabled (and soon to be default behaviour)
being first.

There's room in that summary line to put some of that information from the body, to give an idea of what the reordering is about. Like:

content test [nfc]: Reorder KaTeX widget tests, enabled before disabled

Comment on lines 531 to 533
static final mathInlineUnknown = ContentExample.inline(
'inline math',
r"$$ \lambda $$",
Copy link
Member

Choose a reason for hiding this comment

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

Since this HTML isn't something the server actually generates, this markdown field should be null. See its doc:

  /// The Zulip Markdown source, if any, that the server renders as [html].
  ///
  /// This is useful for reproducing the example content for live use in the
  /// app, and as a starting point for variations on it.
  ///
  /// Currently the test suite does not verify the relationship between
  /// [markdown] and [html].
  ///
  /// If there is no known Markdown that a Zulip server can render as [html],
  /// then this should be null and a comment should explain why the test uses
  /// such an example.
  final String? markdown;

So e.g., following the example emojiUnicodeClassesFlipped:

Suggested change
static final mathInlineUnknown = ContentExample.inline(
'inline math',
r"$$ \lambda $$",
static final mathInlineUnknown = ContentExample.inline(
'inline math',
null, // r"$$ \lambda $$" (hypothetical server variation)

await globalSettings.setBool(BoolGlobalSetting.renderKatex, false);

const html = '<span class="katex">'
testWidgets('maintains font-size ratio with surrounding text, when fallback to TeX source', (tester) async {
Copy link
Member

Choose a reason for hiding this comment

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

nit: "fallback" is a noun, "fall back" the verb:

Suggested change
testWidgets('maintains font-size ratio with surrounding text, when fallback to TeX source', (tester) async {
testWidgets('maintains font-size ratio with surrounding text, when falling back to TeX source', (tester) async {

@rajveermalviya rajveermalviya force-pushed the pr-tex-drop-experimental-flag branch 2 times, most recently from a52a1e2 to 8ad5c0d Compare July 24, 2025 22:20
@rajveermalviya
Copy link
Member Author

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

@rajveermalviya rajveermalviya added the integration review Added by maintainers when PR may be ready for integration label Jul 24, 2025
@rajveermalviya rajveermalviya requested a review from gnprice July 24, 2025 22:21
Comment on lines 511 to 513
static final mathInline = ContentExample.inline(
'inline math',
r"$$ \lambda $$",
null, // r"$$ \lambda $$" (hypothetical server variation)
Copy link
Member

Choose a reason for hiding this comment

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

I think you made this edit on a different example than intended 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, should be fixed now.

@rajveermalviya rajveermalviya force-pushed the pr-tex-drop-experimental-flag branch 2 times, most recently from 3187f68 to ccf262f Compare July 25, 2025 09:46
@rajveermalviya rajveermalviya requested a review from gnprice July 25, 2025 09:49
@rajveermalviya
Copy link
Member Author

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

This skipped test is a duplicate of the one above it, but
incorrectly has the description of the one below it. Probably a
result of conflict-resolution error in b073c6b which introduced
this duplicate, or another in the chain of cherry-picks that led to
that commit.
With renderKatex flag enabled (and soon to be default behaviour)
being first.
This flag has been enabled since v0.0.29 (beta) release, and we
don't plan to disable it. So remove the flag completely,
simplifying related code.

Fixes: zulip#1728
@gnprice
Copy link
Member

gnprice commented Jul 28, 2025

Thanks! Merging, with a tweak in one commit message (cf #1742 (comment)):

$ git range-diff origin pr/1742 @
1:  edfb68198 ! 1:  8c9a7b0ce content test [nfc]: Drop skipped duplicate KaTeX font-size ratio test
    @@ Commit message
         This skipped test is a duplicate of the one above it, but
         incorrectly has the description of the one below it. Probably a
         result of conflict-resolution error in b073c6b26 which introduced
    -    this duplicate.
    +    this duplicate, or another in the chain of cherry-picks that led to
    +    that commit.
     
      ## test/widgets/content_test.dart ##
     @@ test/widgets/content_test.dart: void main() {
2:  95c25c6c3 = 2:  6459af689 content test [nfc]: Reorder KaTeX widget tests, enabled before disabled
3:  ccf262f4c = 3:  da5c1f706 katex: Remove renderKaTex experimental flag

@gnprice gnprice force-pushed the pr-tex-drop-experimental-flag branch from ccf262f to da5c1f7 Compare July 28, 2025 22:25
@gnprice gnprice merged commit da5c1f7 into zulip:main Jul 28, 2025
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
Development

Successfully merging this pull request may close these issues.

Remove renderKatex feature flag, and simplify code
2 participants