Hacker News new | ask | show | jobs
by coldtea 2657 days ago
So, because we have a JS library, we should drop an effort to natively support first class math rendering in the browser?

That's why we can't have nice things.

3 comments

It’s not first class. It’s cross-browser-inconsistent garbage layout largely unsuitable for anything but the simplest mathematical expressions, and a horrible markup syntax for authors.

If MathJax or KaTeX is too slow for some purpose, someone should try to compile a more streamlined TeX renderer to wasm.

> garbage layout largely unsuitable

I dunno. Looking at the math rendering torture test at https://mdn.mozillademos.org/en-US/docs/Mozilla/MathML_Proje...

I prefer the MathML version in 15 of the examples and the LaTex in 11. (No preference in the others.)

I think the MathML sizing, positioning, and spacing of glyphs is strictly worse in every example at your link, sometimes quite dramatically. In a few cases (like the deeply nested fraction) the LaTeX is also not great.

This would be a fairer comparison if they saved the LaTeX as SVG outlines, or as a higher resolution bitmap. As it is the LaTeX version looks fuzzy on my high DPI display.

First of all, it can be used as a target for any markup syntax if authors don't like it. The syntax is an irrelevant part of the feature (in fact MathJax already supports it).

Second, it is first class. "cross-browser-inconsistent" is not an argument that it's not first class, tons of things are inconsistent (JS features, CSS implementations, etc).

Third, you missed the whole idea that the proposal is about enhancing the rendering, and also has buy-in from Mozilla people.

>If MathJax or KaTeX is too slow for some purpose, someone should try to compile a more streamlined TeX renderer to wasm.

That's not even wrong. It's beyond right and wrong, into the realm of crazy.

It’s confusing to use the term “first class” when what you mean is “mediocre but built in”. The standard English definition of that term is “highest quality”. There are certainly many parts of CSS that I would not consider first class.

> The syntax is an irrelevant part of the feature

This viewpoint explains a lot about web technology. The syntax doesn’t matter. The visual output doesn’t matter. Practical adoption by users doesn’t matter. All that matters is ticking features down on a checklist somewhere.

>It’s confusing to use the term “first class” when what you mean is “mediocre but built in”

"First class" in computing terms means strictly "built in", "supported as a native object" -- it doesn't say anything about quality (as opposed to e.g. "first class" airplane seats).

>This viewpoint explains a lot about web technology. The syntax doesn’t matter. The visual output doesn’t matter. Practical adoption by users doesn’t matter. All that matters is ticking features down on a checklist somewhere.

Sounds like a generic lament.

What matters here is: (a) performance, which is and always will be better than some plain-js implementation. (b) being native (which means it will eventually be on all browsers, without asking the users to load anything extra, and will mean writers can just depend on it), (c) the visual output will be better (for one, it will be native vector fonts laid out, not a canvas drawing which is not infinitely zoomable or non-math aware SVG where it's just pretty pictures), (d) it will be able to interact with all other browser capabilities better than any pure-JS implementation.

The syntax is irrelevant, as it can be a target for any other syntax one prefers. In fact MathJax already delegates to MathML rendering where it can.

The article is about fixing all those issues.
Yes, because JS is superior to C++ in terms of security.

I am in favor of bundling MathJax's MathML implementation in browsers though.

>Yes, because JS is superior to C++ in terms of security.

Yeah, because moving 1/100th of web rendering (the math rendering part) to JS is going to make things more secure...

Is it? Keep in mind that the JavaScript is likely running on a C++ interpreter, and has mostly unfettered access to the page's content by design.
Yes it is. Bundled JS won't add new use-after-free, new C++ code will.
I've been coding C++ for 15 years and I've never seen a use-after-free in the wild. (I've seen lots of other bugs and security problems, but not use-after-free.)

Use-after-free is a C thing, not a C++ thing. Granted, C++ makes is super easy to code in C, but that's an organization problem that is already solved in any sane project.

Not to mention something that almost any static analyzer will catch on the first run...
Can you recommend a static analyzer to Chromium developers? They appear to have problems with basic C++ programming; such a pity that Google cannot afford to hire competent developers like otabdeveloper2.

https://bugs.chromium.org/p/chromium/issues/list?can=2&q=%22...

Having first-class tex/postscript support in the browser would certainly be better than having to support the MathML monstrosity.