-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Change katex limits #27823
Change katex limits #27823
Conversation
Add MAX_CHARS.
@@ -15,18 +15,28 @@ export async function renderMath() { | |||
import(/* webpackChunkName: "katex" */'katex/dist/katex.css'), | |||
]); | |||
|
|||
const MAX_CHARS = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want a setting for this like with Mermaid?
gitea/web_src/js/markup/mermaid.js
Line 5 in 5a76759
const {mermaidMaxSourceCharacters} = window.config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this addition.
Isn't 1000 chars too restrictive?
That's only four tweets, and there are many comments larger than that.
Even more so if they contain latex code which spikes char usage up tremendously.
Especially as that is per comment instead of per recognized latex string.
As I see it, we can either remove it, or we choose the value that GitLab for example uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitLab uses 1000. Why do you think it's the whole comment? source
is just the <code>
block with the math code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I should have expanded the code a little.
The el.textContent
looked to me like it would be the whole comment, not the math block.
@@ -15,18 +15,28 @@ export async function renderMath() { | |||
import(/* webpackChunkName: "katex" */'katex/dist/katex.css'), | |||
]); | |||
|
|||
const MAX_CHARS = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I should have expanded the code a little.
The el.textContent
looked to me like it would be the whole comment, not the math block.
* giteaofficial/main: List all Debian package versions in `Packages` (go-gitea#27786) Fix merge base commit for fast-forwarded GitLab PRs (go-gitea#27825) Fix bad method call when deleting user secrets via API (go-gitea#27829) Change katex limits (go-gitea#27823) Dockerfile small refactor (go-gitea#27757) Use GitLab's squash_commit_sha when available (go-gitea#27824) [skip ci] Updated translations via Crowdin Upgrade xorm to 1.3.4 (go-gitea#27807)
Just noting that there are math expressions out there that are more than a thousand characters long. Just hit
(1108 chars.) |
I'm sure there are long expressions but I'm not sure if Gitea comments are the correct place for them. In this case you could just split the block into two blocks with two lines. |
Those appear in the README, as a translation of a scientific article, not in comments. I have no control over the size of the math blocks. |
Happy to accept a PR that increases these limits further. As I understand it there should be some limit to prevent performance impact from malicious comments etc, no other reason for those limits. |
Fixes go-gitea#27812 Use higher defaults again but limit the input size. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/23cdf572-de30-4799-b9cf-ef386b1623b9)
Backport #27823 by @KN4CK3R Fixes #27812 Use higher defaults again but limit the input size. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/23cdf572-de30-4799-b9cf-ef386b1623b9) Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Fixes go-gitea#27812 Use higher defaults again but limit the input size. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/23cdf572-de30-4799-b9cf-ef386b1623b9)
Fixes #27812
Use higher defaults again but limit the input size.