Live data from Hacker News

Render mathematical expressions in Markdown On GitHub

github.blog

101–110 of 114 posts

Re: Render mathematical expressions in Markdown On GitHub

#101
post #3

Finally a long-awaited feature. Works nicely in dark mode too. However, it simply uses MathJax. Also there are some minor annoyances. For example you need to escape the backslashes, so it takes 4 backslashes to make a newline in your matrix. $$\begin{bmatrix} a & b \\\\ c & d\end{bmatrix}$$ I found that the inline math doesn't quite match the font size of the surrounding text too (it's smaller).

> For example you need to escape the backslashes, so it takes 4 backslashes to make a newline in your matrix. > $$\begin{bmatrix} a & b \\\\ c & d\end{bmatrix}$$ This example doesn't make sense. You need to escape the backslashes in the end-of-row command \\, but you don't need to escape the backslashes in \begin and \end? The post clearly shows that backslashes in \left, \right, \sum, and \sqrt do not need to be esc…

Maybe in GitHub Markdown, backslashes have to be escaped only if they could be interpreted as an escape character?

Re: Render mathematical expressions in Markdown On GitHub

#102
post #79

Complex equations is still broken. Too sad. e.g., https://github.com/chazeon/notes/blob/master/docs/notes/ml-p...

I wonder if aligned multi line equations would work (I mean eqnarray or aligned environments in latex)

Kind of. See my other note here. The aligned environment work, but there should a curly braces around that are not shown, not sure the cause. https://github.com/chazeon/notes/blob/master/docs/notes/ml-p...

Re: Render mathematical expressions in Markdown On GitHub

#103
post #30

Math doesn't render inside a bullet list item. I don't know how to file an issue against Github itself, somewhat ironically.

(I work at GitHub.) We've started using our Discussions product for feedback. You can post a discussion here: https://github.com/github/feedback/discussions/categories/ge...

When we're at it, why isn't GitHub open source?

Re: Render mathematical expressions in Markdown On GitHub

#104
post #56

Earlier quoted context omitted.

If I was building this feature, I'd also pick client side rendering, simply because at GitHub's scale, rendering on the server side will require a bunch of servers, which will need to be managed and looked after. By offloading the rendering to the client, you make use of the spare capacity that exists on most client machines today, with no noticable slowdown for the user (it may even end up doing the "first paint" fa…

> while no noticable slowdown for the user (it may even end up doing the "first paint" faster in the browser if GitHub are careful about their implementation). Have you visited math.stackexchange? Pop by their MathJax reference page[0], and observe how long all the mathematical notation takes to render fully —it takes at least six seconds on my recent notebook, plugged in. On my 2018 iPad Pro, it takes well over thir…

> [...] observe how long all the mathematical notation takes to render fully—it takes at least six seconds on my recent notebook, plugged in.

Does this really matter though? When I've encountered math-heavy pages that have been slow to fully render the math has also been slow for my brain to processes. As long as the math rendering is faster than my brain's math understanding it has been fine.

Re: Render mathematical expressions in Markdown On GitHub

#105
post #79

Complex equations is still broken. Too sad. e.g., https://github.com/chazeon/notes/blob/master/docs/notes/ml-p...

That first one doesn't compile in LaTeX (assuming \ce is from mhchem?). Perhaps the inline mode $'s shouldn't be in there? i.e.

$$ \ce{ \underset{global coordinate}{(x,y,z)} ->[\mathcal{R}][rotation] \underset{local coordinate}{(x',y',z')} -> \underset{descriptor}{\{\mathcal{D}_{ij}\} } -> E_i } $$

There does appear to be a bug though where the LaTeX expressions don't render if they're in markdown lists or tables.

Re: Render mathematical expressions in Markdown On GitHub

#106

Earlier quoted context omitted.

I wonder if aligned multi line equations would work (I mean eqnarray or aligned environments in latex)

Kind of. See my other note here. The aligned environment work, but there should a curly braces around that are not shown, not sure the cause. https://github.com/chazeon/notes/blob/master/docs/notes/ml-p...

I would guess that the markdown parser does some overly eager escaping before handing off the input to the latex renderer. If I change the "\left\{" into "\left\\{" and the "\," into "\\," it renders like with LaTeX.

Re: Render mathematical expressions in Markdown On GitHub

#107
post #33

My one complaint about these new mark down features with github is the lock-in. I’m trying to build a gist compatible service and theres quite a bit to cover. MathJax is fine, but now I (and gitlab, bitbucket, etc) will need to support it

Fyi, GitLab has supported[0] this since quite a while[1]. [0]: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/doc/... [1]: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8...

I really like how GitLab has implemented this. Using code blocks but just with "math" as the language is so much clearer, and avoids having to do awkward dollar sign escaping.

Re: Render mathematical expressions in Markdown On GitHub

#108
post #88
post #56

Earlier quoted context omitted.

If I was building this feature, I'd also pick client side rendering, simply because at GitHub's scale, rendering on the server side will require a bunch of servers, which will need to be managed and looked after. By offloading the rendering to the client, you make use of the spare capacity that exists on most client machines today, with no noticable slowdown for the user (it may even end up doing the "first paint" fa…

Sorry, but I find this approach very rude to your customers. It's kinda your job to make it work on your side and don't transfer the burdens to clients. I don't know what your SAAS does (maybe it's not really applicable here), but in the case of github, it's very wastefull. Yes, it would take some work, some servers, etc but they have the skill, the money and everything they need to do it. They could do it once (well…

Interesting point of view, but I feel you're missing the point.

Do you find all native applications rude to customers?

Re: Render mathematical expressions in Markdown On GitHub

#109
post #99
post #56

Earlier quoted context omitted.

If I was building this feature, I'd also pick client side rendering, simply because at GitHub's scale, rendering on the server side will require a bunch of servers, which will need to be managed and looked after. By offloading the rendering to the client, you make use of the spare capacity that exists on most client machines today, with no noticable slowdown for the user (it may even end up doing the "first paint" fa…

So use KaTeX on the client side. It's still much faster than MathJax.

Yes, agreed. I was just saying that client side rendering makes more sense; which library you choose is up to you.

Re: Render mathematical expressions in Markdown On GitHub

#110
post #108
post #88

Earlier quoted context omitted.

Sorry, but I find this approach very rude to your customers. It's kinda your job to make it work on your side and don't transfer the burdens to clients. I don't know what your SAAS does (maybe it's not really applicable here), but in the case of github, it's very wastefull. Yes, it would take some work, some servers, etc but they have the skill, the money and everything they need to do it. They could do it once (well…

Interesting point of view, but I feel you're missing the point. Do you find all native applications rude to customers?

No. I'm absolutely expecting local native app to do all the work, it makes sense. With SAAS running in the browser I expect all the heavy lifting is done somewhere else...you know, as a service.
Post reply on HN