News for hackers. Stuff that matters.
Re:Math on GitHub: The Good, the Bad and the Ugly by hprotagonist on Saturday May 21, 2022 @08:44AM (#31457369)
A source block type would have been a very natural fit, it’s surprising that isn’t how they chose to go.

  ```equation
  e^{i\pi}+1\eq0
  ```
feels like what i’d try to do right off the bat.
Re:Math on GitHub: The Good, the Bad and the Ugly by ajnin on Saturday May 21, 2022 @09:51AM (#31457908)
A code block is used to display text literally, except adding syntax coloring. You would use it to display TeX source notation for example. A math block transforms TeX into something else, it's entirely different. I think it's correct that they did not use the code block syntax for this.
Re:Math on GitHub: The Good, the Bad and the Ugly by edflsafoiewq on Saturday May 21, 2022 @09:57AM (#31457975)
It's how Github already handles Mermaid diagrams, so there's precedent, although you're correct that logically there should be a distinction between "display highlighted Mermaid source" and "render Mermaid diagram".
Re:Math on GitHub: The Good, the Bad and the Ugly by ajnin on Saturday May 21, 2022 @10:07PM (#31464252)
Yes, and now they've reached a dead since they have no way to render mermaid source code except as plain text or by introducing a new name like mermaid-src. It's minor but it's unsatisfying conceptually. I'd rather have them introduce a new "run delimited text into external program and replace by output" tag.
Re:Math on GitHub: The Good, the Bad and the Ugly by nschloe on Sunday May 22, 2022 @07:14AM (#31466923)
Author here.

The main idea of using code blocks for math is to protect its content from being messed with. Markdown parsers do that by default, so that's how it's "natural". As you mention, the drawback is that you can't have a codeblock with syntax highlighting for a language called "math" (should there ever be one), but that seems like a small price to pay.

Re:Math on GitHub: The Good, the Bad and the Ugly by ly on Saturday May 21, 2022 @08:58AM (#31457458)
I prefer the $ $ way, as it makes it possible to do inline equations, while keeping the source easily readable.
Re:Math on GitHub: The Good, the Bad and the Ugly by hprotagonist on Saturday May 21, 2022 @09:10AM (#31457560)
you can do both, the normal markdown way:

  `$a$` squared is `$a^2$`, which is good to know for the pythagorean theorem:
  ```equation
  a^2+b^2\eq c^2
  ```
Re:Math on GitHub: The Good, the Bad and the Ugly by IshKebab on Saturday May 21, 2022 @12:55PM (#31459527)
That doesn't work because then how do you display $a$ as literal inline code?
Re:Math on GitHub: The Good, the Bad and the Ugly by runarberg on Saturday May 21, 2022 @01:22PM (#31459841)
What about:

    Inline code is ` $a$ ` automatically trimmed
But I think $`a+b`$ makes more sense (or even $$a+b$$; I mean this is markdown after all, not LaTeX).
Re:Math on GitHub: The Good, the Bad and the Ugly by JadeNB on Saturday May 21, 2022 @04:09PM (#31461349)
> But I think $`a+b`$ makes more sense (or even $$a+b$$; I mean this is markdown after all, not LaTeX).

True, but it is TeX notation, and `$$ $$` for inline math goes deeply against the experienced TeXnician's intuition. Why intentionally use notation that violates some users' domain intuition when there's an alternative that's no worse?

Re:Math on GitHub: The Good, the Bad and the Ugly by ly on Saturday May 21, 2022 @09:26AM (#31457683)
Ah yes, agreed, then that does indeed seem like to optimal solution here.
Re:Math on GitHub: The Good, the Bad and the Ugly by samwillis on Saturday May 21, 2022 @09:03AM (#31457501)
They suggest this for inline using combination of the code back tick and dollar syntaxes:

Inline math: $`a^2 + b^2 = c^2`$.

Re:Math on GitHub: The Good, the Bad and the Ugly by Hendrikto on Saturday May 21, 2022 @08:55AM (#31457435)
Especially since this approach has already been tried and proven by competitors like GitLab.
Re:Math on GitHub: The Good, the Bad and the Ugly by darkscape on Saturday May 21, 2022 @12:09PM (#31459094)
Yes, could use different tags for literal display and rendering eg ```tex and ```eq.