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

backtick math #27602

Closed
nschloe opened this issue Oct 13, 2023 · 4 comments
Closed

backtick math #27602

nschloe opened this issue Oct 13, 2023 · 4 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@nschloe
Copy link

nschloe commented Oct 13, 2023

Feature Description

GitLab and GitHub both have support for backtick math, i.e.,

The Pythagorean theorem can be written as an equation
relating the lengths of the sides $`a`$, $`b`$ and the
hypotenuse $`c`$:

```math
a^2 + b^2 = c^2.
```

The Pythagorean theorem can be written as an equation relating the lengths of the sides $a$, $b$ and the hypotenuse $c$:

$$a^2 + b^2 = c^2.$$

The backticks avoid problems with accidental markdown sanitation in math content (which causes many problems for GitHub). The backticks suggests to the sanitizer that this is "code", not be touched.

GitLab started out with only the backticked mode in 2016. (They've added an imperfect dollar mode now.)

Right now, Gitea has no proper support for backticked math. Inline backticks

$`a + b = c`$

are literally rendered as backticks,

screenshot_2023-10-13-141058

and display-block backticks are rendered, but not centralized:

```math
abc
```

$$
abc
$$

screenshot_2023-10-13-141140

Using backticks in math also has the advantage that other Markdown software, e.g., linters or formatters, can be run on the file without modification.

It'd be great if Gitea could support backticked math as well.

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.

@nschloe nschloe added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Oct 13, 2023
@nschloe
Copy link
Author

nschloe commented Oct 14, 2023

I see there is some discussion on this on the corresponding PR from Sep 2022. One of the participants repeats some points I've made concerning the GitHub $-math implementation (see here). GitHub struggles with their math implementation to this day (see here), but Gitea got many things right straight away. Great! Still, I believe using the $-syntax is a mistake; you'll always find yourself fighting with Markdown, and things like

The $n$th apple costs $$(n+1)$.

will probably never render correctly. (LaTeX has \$, Markdown doesn't.) Compare that with backticks:

The $`n`$th apple costs $$`(n+1)`$.

The $n$th apple costs $$(n+1)$.

Using backticks plays nicely with Markdown and avoids all kinds of problems. And this doesn't mention the straightforward implementation of it.

@eeyrjmr
Copy link
Contributor

eeyrjmr commented Oct 14, 2023

These mathblocks exist for gitea, does this help?

(...), [...], $...$ and $$...$$

@nschloe
Copy link
Author

nschloe commented Oct 14, 2023

@eeyrjmr Sorry for not being clear enough. These don't help at all, no, and that's what I'm trying to say. Markdown interferes with this syntax and will never be reliable.

Edit: Maybe \(\)/\[\] can help with rendering. Still worried about interoperability though.

Edit:: This syntax looks a little weird:

\[
\begin{align*}
a = b
\end{align*}
\]

@nschloe
Copy link
Author

nschloe commented Dec 20, 2024

It's supported now.

@nschloe nschloe closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

2 participants