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

bracket syntax \(\)\[\] for math problematic #27645

Open
nschloe opened this issue Oct 16, 2023 · 6 comments
Open

bracket syntax \(\)\[\] for math problematic #27645

nschloe opened this issue Oct 16, 2023 · 6 comments
Labels

Comments

@nschloe
Copy link

nschloe commented Oct 16, 2023

Description

Here's another issue with the bracket syntax: \[ and \] are actually valid Markdown characters (see Markdown definition here), rendering to [ and ], respectively. The escaping is to set brackets apart from Markdown links à la [abc](https://example.com). Markdown formatters like prettier or mdformat escape brackets in various places, accidentally producing Gitea math. (See here for the corresponding mdformat bug.)

Related to #27602.

Edit: I've surveyed math syntaxes and performance on GitHub, Gitea, GitLab.. Gitea's bracket-syntax is unique and hence not compatible. The backticked syntax is sorely missing from Gitea, especially given its great performance on the other platforms.

Gitea Version

1.22.0+dev-188-g1be49fdda

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

https://try.gitea.io/

Database

None

@jamesbraza
Copy link

@nschloe did you try using the mdformat-myst plugin? See hukkin/mdformat#334

@nschloe
Copy link
Author

nschloe commented Oct 16, 2023

Yeah, same result with

import mdformat

print(mdformat.text("[a]", extensions={"myst"}))
\[a\]

@jamesbraza
Copy link

Thought it was worth a shot haha, sorry. Hope this gets resolved! You can also try prettier while mdformat isn't compatible

@nschloe
Copy link
Author

nschloe commented Oct 16, 2023

As mentioned in my original post, prettier also escapes square brackets (though not always, as mdformat does).

@nschloe
Copy link
Author

nschloe commented Dec 20, 2024

We now have backtick math, which is much preferred. I'm not sure if the docs should not mention or discourage the bracket math notation.

@deltamualpha
Copy link

deltamualpha commented Jan 13, 2025

I think this might also be a good place to document that the \[...\] syntax tends to crop up often in release notes that tools like renovate add to automated MRs. Some discussion of the results is here: renovatebot/renovate#33587 but here's some messy KaTeX errors all over some harmless, well-escaped markdown:

Screenshot 2025-01-12 at 10 42 29 PM

I've just set GITEA__markdown__ENABLE_MATH=false on my self-hosted instance because of noise like this.

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

No branches or pull requests

3 participants