lukeorth / poison

Professional Hugo theme for dev bloggers. Based on Mdo's classic Hyde theme.
https://poison.lukeorth.com
GNU General Public License v3.0
230 stars 107 forks source link

Katex support causes display issues #21

Closed lolbat closed 1 year ago

lolbat commented 1 year ago

If you add content in post or page that uses $ to indicate currency and there is more than one on a line it triggers renderMathInElement() and converts the text to mathml.

So this content

They do qualify the comment by saying "As mobile games go," but the idea that paying $120 US a 
year to play a game like Marvel Snap is "standard" is shocking. I think that I spent less than $10 Cnd 
on [Core Defense and its single DLC](https://zacgaming.wordpress.com/2023/01/06/core-defense-an-appreciation/) 
and while this is probably not a price that reflects that quality of the game 
(and a topic for another post?) it is a long jump from $10US  to $120US. And this is for a game that 
has ridiculously priced IAPs as well. Marvel Snap is yet another in a long, long, long, long line of 
"games" that have $100+ purchases you can make. 

starts to have sections of it rendered as mathml starting and ending with the currency characters.

Even if you try to escape them the content still gets rendered as mathml

lukeorth commented 1 year ago

Hi @lolbat, sorry for my late reply, and thanks for reporting this.

Yes, this is definitely an issue. I thought KaTeX escaped $ with a backslash by default, but I was either mistaken or that's not working.

I added a line of JavaScript that fixes the issue. It replaces all instances of \\$ with <span>$</span>. So going forward, you should be able to escape KaTeX by putting a double backslash in front of your dollar signs (like \\$) to represent a normal dollar sign.

Hopefully that helps! Let me know if you have any questions.

lukeorth commented 1 year ago

Nevermind - I should have tested it some more. I had to rollback my fix. The solution does fix your issue, but it has the unintended consequence of disabling the light/dark button.

I am re-opening this issue and will play with it some more to try to get a permanent fix for it soon.

lukeorth commented 1 year ago

@lolbat this should be fixed now. Can you pull the latest updates and confirm?

Thanks!

lolbat commented 1 year ago

I downloaded it and tested. Works fine now. Thanks