Skip to content
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

Incorrect KaTex markdown rendering with \[ sequence #24006

Open
silverwind opened this issue Apr 8, 2023 · 2 comments
Open

Incorrect KaTex markdown rendering with \[ sequence #24006

silverwind opened this issue Apr 8, 2023 · 2 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.

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

No branches or pull requests

2 participants