qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

HTML page title shows raw mathjax

Open cellio opened this issue 5 years ago • 5 comments

https://math.codidact.com/questions/278174

When someone includes TeX-like math between dollar signs ($) in a title, the title renders nicely but the HTML title renders raw (with the dollar signs and all). The latter is terrible for readability — and, I assume, screenreaders. This affects, presumably, wherever the HTML title appears: browser tab/window titles, search-engine results, etc.

Can we do anything to convert the mathjax into something that won't look confusing in a title? Or is this something to live with and/or avoid?

cellio avatar Nov 05 '20 03:11 cellio

That should be doable. The HTML title can be modified by JavaScript, so one could after rendering the title, set the HTML title to the title.

Trilarion avatar Jan 11 '22 10:01 Trilarion

I now think it might not be doable. MathJax replaces $text$ with a series of HTML tags using CSS. That's not something that can be used in the page title. The page title is pure, unformatted text, I think. I searched and did not find a way to add formatting to the title tag.

Math.SE seems not to do it too (for example https://math.stackexchange.com/questions/21199/is-frac-textrmdy-textrmdx-not-a-ratio).

This means that for example search engines will have to live with this too. Google seems to strip some elements away though from the title, kind of alleviating the effect. See for example https://www.google.com/search?q=Is+dy%252Fdx+not+a+ratio

We could probably sanitize the page title a bit in order to improve. I could look into it. But first I would check if Google doesn't already do it for us too.

Trilarion avatar Jan 20 '22 19:01 Trilarion

Yes, google sanitizes titles by its own:

https://www.google.com/search?q=Why+does+the+decimal+expansion+of+have+this+neat+pattern%3F+site%3Amath.codidact.com

when displaying search results.

Trilarion avatar Jan 20 '22 20:01 Trilarion

Maybe we should discourage/replace wherever possible $$ expressions in titles.

Currently I'm searching for the equivalent of a screen reader for blind people for mathematical expressions. I want to know what they are doing with this kind of content.

Trilarion avatar Jan 20 '22 20:01 Trilarion

Thanks for looking into what screenreaders do with math. That's gotta be a hard problem and now I'm curious.

cellio avatar Jan 21 '22 01:01 cellio