Skip to content

Incorrect KaTex markdown rendering with \[ sequence #24006

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

Closed
silverwind opened this issue Apr 8, 2023 · 5 comments
Closed

Incorrect KaTex markdown rendering with \[ sequence #24006

silverwind opened this issue Apr 8, 2023 · 5 comments

Comments

@silverwind
Copy link
Member

silverwind commented Apr 8, 2023

Description

Given this markdown:

-   \[CSS] - Nested atRule's `@media` or `@supports` now properly are replaced with unique identifiers by [@​noreiller](https://github.com/noreiller) in https://github.com/webpack/webpack/pull/15812

It renders

image

It should render like GitHub

image

Gitea Version

main

Can you reproduce the bug on the Gitea demo site?

Yes

@silverwind
Copy link
Member Author

silverwind commented Apr 8, 2023

So I think the bug is in the backend where it detects \[CSS] as math content. I think we need to be more strict and require the $$ wrapping around math, like below:

$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

@nschloe
Copy link

nschloe commented Nov 17, 2023

Gitea was one of the first services to offer math support using a \(...\)/\[...\] syntax. Unfortunatly, it has not been adopted by any other platform, perhaps also because of the fact that it collides with standard Markdown syntax. (More about this in #27645.)

Right now, GitLab, GitHub, and Pandoc support two syntaxes:

  • $...$/$$...$$ (traditional TeX),
  • $`...`$/ ```math... ``` (originally introduced by GitLab in 2016).

In a survey across GitHub, GitLab, Gitea, and Pandoc, I've found that the $-syntax is error prone, also because it's non-native to Markdown. The backticked syntax (not supported by Gitea right now) is a great practical alternative.

For full compatibility with other platform, perhaps Gitea can think about sunsetting the bracket syntax for math, and add the backticked syntax. This would also fix this bug here.

@wxiaoguang
Copy link
Contributor

Will be fixed by #32831

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Dec 14, 2024

The \[ ... ] has been fixed in #32831, but the \[ ... \] is still problematic, I have left a TODO in code, we should drop this "math" syntax in the future by a config option.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 14, 2025
@wxiaoguang
Copy link
Contributor

The complete fix is Fix markdown render behaviors #34122

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants