Increase maxExpand option for KaTeX / LaTeX / math rendering
What does this MR do and why?
Currently the KaTeX maxExpand
is set to 20
, which is very low. This inhibits complex math from being displayed. For example, just using \mod e
three times, by itself, is enough to go over the limit.
```math
\mod e
\mod e
\mod e
```
The default for the option is 1000
, which was changed by this PR.
We have a limit on the number of characters in a particular block (MAX_MATH_CHARS
) and a limit on the amount of time all math blocks can be rendered (MAX_RENDER_TIME_MS
).
A math block of 142 \mod e
is just under the 1000 character limit. 143 actually puts is over the expansion limit. Rendering is fast.
Because we have both a character and rendering time limit across all blocks, it should be safe to increase the maxExpand
to 1000. In addition we can add an error message indicating to the user to use multiple blocks if the expansion limit is reached.
Interestingly, the pathological case detailed in gitlab-foss#61410 (closed), which uses \sqrt
, is not effected by the expansion limit. character and rendering time limits continue to protect against DoS.
How to set up and validate locally
-
Paste the following markdown in a description or comment and click Preview. The math formula should display
```math \begin{aligned} ed &= 1 \mod \phi(N)\\ \implies ed &= k \phi(N) + 1\\ \implies k \phi(N) + 1 &= 0 \mod e\\ \implies k (N + 1 - p - q) + 1 &= 0 \mod e\\ \implies 2k \left(\frac{N + 1}2 + \frac{-p-q}2\right) + 1 &= 0 \mod e \end{aligned} ```
-
Use the file expansion_limit.md to insert into an issue/comment, you should get the error
There were too many expansions, consider using multiple math blocks
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #328103 (closed)
Merge request reports
Activity
added devopsplan groupproject management markdown sectiondev severity3 typebug vintage labels
assigned to @digitalmoksha
- A deleted user
added frontend label
1 Warning featureaddition and featureenhancement merge requests normally have a documentation change. Consider adding a documentation update or confirming the documentation plan with the Technical Writer counterpart.
For more information, see:
- The Handbook page on merge request types.
- The definition of done documentation.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer frontend Andrei Zubov (
@andrei.zubov
) (UTC+1, 7 hours ahead of@digitalmoksha
)Zack Cuddy (
@zcuddy
) (UTC-6, same timezone as@digitalmoksha
)test for spec/features/*
Désirée Chevalier (
@dchevalier2
) (UTC-5, 1 hour ahead of@digitalmoksha
)Maintainer review is optional for test for spec/features/*
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by Ghost User- Resolved by Costel Maxim
@cmaxim when you have a chance, could you validate my reasoning above? You can pull the MR and test it out as the changes are there. I want to make sure I'm not inadvertently opening something up.
requested review from @cmaxim
Bundle size analysis [beta]
This compares changes in bundle size for entry points between the commits 3dd714d5 and c0080787
Special assetsEntrypoint / Name Size before Size after Diff Diff in percent average 3.48 MB 3.49 MB +1.06 KB 0.0 % mainChunk 1.99 MB 1.99 MB +1.06 KB 0.1 %
Note: We do not have exact data for 3dd714d5. So we have used data from: a00d3c30.
The target commit was too new, so we used the latest commit from master we have info on.
It might help to rerun thebundle-size-review
job
This might mean that you have a few false positives in this report. If something unrelated to your code changes is reported, you can check this comparison in order to see if they caused this change.Please look at the full report for more details
Read more about how this report works.
Generated by
DangerEdited by Ghost UserAllure report
allure-report-publisher
generated test report!e2e-review-qa:
test report for c0080787expand test summary
+-----------------------------------------------------------------------+ | suites summary | +------------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +------------------+--------+--------+---------+-------+-------+--------+ | Plan | 49 | 0 | 1 | 0 | 50 | ✅ | | Manage | 33 | 0 | 3 | 0 | 36 | ✅ | | Create | 28 | 0 | 1 | 0 | 29 | ✅ | | Govern | 27 | 0 | 5 | 0 | 32 | ✅ | | Framework sanity | 9 | 0 | 1 | 0 | 10 | ✅ | | Package | 0 | 0 | 1 | 0 | 1 | ➖ | | Verify | 12 | 0 | 0 | 0 | 12 | ✅ | | Monitor | 4 | 0 | 0 | 0 | 4 | ✅ | +------------------+--------+--------+---------+-------+-------+--------+ | Total | 162 | 0 | 12 | 0 | 174 | ✅ | +------------------+--------+--------+---------+-------+-------+--------+
Edited by Ghost Useradded 146 commits
-
b40f5b06...0bcb2ca8 - 145 commits from branch
master
- 270fb4a6 - Increase KaTeX expansion limit
-
b40f5b06...0bcb2ca8 - 145 commits from branch
changed milestone to %15.9
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
added featureenhancement typefeature labels and removed typebug label