Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline MathJax accidentally trigger when talking about money #24

Open
AccaliaDeElementia opened this issue Aug 7, 2015 · 3 comments
Open

Comments

@AccaliaDeElementia
Copy link

When fed the raw text:

[quote]It costs a lot of money for Soldiers to train on an M1 Abrams tank. Not only does it cost about $67 per mile to operate, but Sabot ammunition rounds cost about $1,175 each, and HEAT rounds cost about $830 each.[/quote]

MathJax will be triggered for this substring: $67 per mile to operate, but Sabot ammunition rounds cost about $

This is unexpected and confusing, paticularly because it is difficult to prevent. I would expect that the inline mathjax would enforce a word boundary before and after the inline section. Or expressed Via Regex: /\b$[^$]+$\b/

Examples:
https://what.thedailywtf.com/t/lighting-logic/2754/9?u=accalia
https://what.thedailywtf.com/t/mathjax-playground/50449/10?u=accalia

@pauljherring
Copy link

If it matters, the configuration is currently the default:

mathjax url: //cdn.mathjax.org/mathjax/latest/MathJax.js
mathjax config: TeX-AMS-MML_HTMLorMML

@dpvc
Copy link

dpvc commented Aug 15, 2015

The dollar-sing delimiters are not enabled in MathJax by default for just this reason. If dollar signs are being processed, that would have to be due to your configuration adding them as inline math delimiters. Your page no longer loads MathJax, so I can't check the configuration, but one way to avoid the problem is to not enable dollar signs as delimiters. If you enable dollar-sign delimiters it is customary also to enable processEscapes so that you can use \$ to prevent the dollar from being treated as a delimiter.

Note that your suggested regular expression will not help, since /\b$/ is true for any dollar sign (the dollar sign is itself a word break).

@pauljherring
Copy link

at would have to be due to your configuration adding them as inline math delimiters.

As pointed out on the other bug, and in my comment from 10 days ago, it's not at all clear where such configuration options are actually... configured, for Discourse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants