Conversation
Greptile SummaryThis PR fixes Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["\\sout{...} encountered"] --> B{parser.mode?}
B -->|text| C["handler: no strict check\nReturn enclose node"]
B -->|math| D{parser.settings.strict?}
D -->|false / falsy| E["Silently return enclose node\n(non-breaking backward compat)"]
D -->|'warn'| F["reportNonstrict → console.warn\nReturn enclose node"]
D -->|true / 'error'| G["reportNonstrict → throw ParseError\n(\\sout not valid in math mode)"]
D -->|'ignore'| H["reportNonstrict → returns early\nReturn enclose node"]
C --> I[htmlBuilder / mathmlBuilder\nshared with cancel group]
E --> I
F --> I
H --> I
Reviews (2): Last reviewed commit: "Merge branch 'main' into sout" | Re-trigger Greptile |
|
Thanks! It looks like your changes are from an old commit though.
I would prefer to match LaTeX's behavior, yes. So math mode should trigger strict, unless some LaTeX package adds it. I don't think it's breaking given that the default |
|
The latest commit writes an error message if |
|
I've edited the screenshotter input to put the Unfortunately, screenshotter is failing and I am also getting an error message that there are merge conflicts. Both failures are inscrutable to me. I think that I have taken this PR as far as I can. |
|
OK, I can pick it up from here. Next time, synchronize your fork and pull the latest |
|
I did pull the latest |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4173 +/- ##
==========================================
+ Coverage 93.15% 93.30% +0.14%
==========================================
Files 91 91
Lines 6795 6810 +15
Branches 1582 1589 +7
==========================================
+ Hits 6330 6354 +24
- Misses 429 454 +25
+ Partials 36 2 -34
... and 15 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
src/functions/enclose.ts
Outdated
| allowedInText: true, | ||
| }, | ||
| handler({parser, funcName}, args) { | ||
| if (parser.mode === "math" && parser.settings.strict) { |
There was a problem hiding this comment.
Maybe it's worth to create type guard like hasHtmlDomChildren?
Something like
export const isMathMode = (mode: Mode): mode is "math" => mode === "math";
I'm not sure if it's worth it, as for now it could be reused only once in https://github.com/KaTeX/KaTeX/blob/main/src/functions/kern.ts#L31
There was a problem hiding this comment.
Hmm... I'm not sure I see advantage to a type guard - until we see a context where narrowing would help inference.
|
Looks good! |
|
@greptileai Another review? |
|
By the way, I noticed that Greptile now edits the original review instead of posting a new one. Took me a while to find. 🙂 Thanks @ronkok for implementing this! |
|
🎉 This PR is included in version 0.16.41 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [0.16.41](KaTeX/KaTeX@v0.16.40...v0.16.41) (2026-03-24) ### Bug Fixes * \sout in text mode ([KaTeX#4173](KaTeX#4173)) ([e748578](KaTeX@e748578))
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [katex](https://katex.org) ([source](https://github.com/KaTeX/KaTeX)) | [`0.16.40` → `0.16.44`](https://renovatebot.com/diffs/npm/katex/0.16.40/0.16.44) |  |  | --- ### Release Notes <details> <summary>KaTeX/KaTeX (katex)</summary> ### [`v0.16.44`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01644-2026-03-27) [Compare Source](KaTeX/KaTeX@v0.16.43...v0.16.44) ##### Bug Fixes - remove extra \jot space at bottom of align/gather/etc. ([#​4184](KaTeX/KaTeX#4184)) ([3870ee9](KaTeX/KaTeX@3870ee9)) ### [`v0.16.43`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01643-2026-03-26) [Compare Source](KaTeX/KaTeX@v0.16.42...v0.16.43) ##### Bug Fixes - use makeEm() consistently to truncate long CSS decimals ([#​4181](KaTeX/KaTeX#4181)) ([0967dcc](KaTeX/KaTeX@0967dcc)) ### [`v0.16.42`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01642-2026-03-24) [Compare Source](KaTeX/KaTeX@v0.16.41...v0.16.42) ##### Features - \underbracket and \overbracket ([#​4147](KaTeX/KaTeX#4147)) ([5be9abb](KaTeX/KaTeX@5be9abb)) ### [`v0.16.41`](https://github.com/KaTeX/KaTeX/blob/HEAD/CHANGELOG.md#01641-2026-03-24) [Compare Source](KaTeX/KaTeX@v0.16.40...v0.16.41) ##### Bug Fixes - \sout in text mode ([#​4173](KaTeX/KaTeX#4173)) ([e748578](KaTeX/KaTeX@e748578)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44Ni4wIiwidXBkYXRlZEluVmVyIjoiNDMuOTkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Renovate Bot <renovate@zarantonello.dev> Co-committed-by: Renovate Bot <renovate@zarantonello.dev>
Make
\soutwork in text mode. Fixes #4166.This PR makes
\soutwork in both text mode and math mode. That way, it's not a breaking change.@edemaine, If you would prefer to put math mode behind a
strictsetting, let me know. I would prefer to avoid a breaking change.