-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature request: limit scope of TeX macro definitions #186
Comments
I understand the need for what you are asking for, and would not tell you to stop what you are doing (I think the StackExchange model is a really interesting one). There is a solution included in v2.0 that allows for localized macro definitions. I have added two (non-standard) macros, This is new in v2.0, so you can't use it in v1.1, but you can try it out using the Davide |
PS, version 2.0 has some important performance improvements, particularly for IE, so I think you will find that the results for longer posts are better in this version. |
What if a malicious user write this:
|
@Menci, There are no security issues involved, here, and if there were, there would be no need to use |
I think there needs to be a way to completely isolate every 'document' in a single webpage to prevent one from affecting the following. Bigger issue is in MathJax-Node and mathjax-node-page than in browser -- if a server runs MathJax with Node.js to serve rendered documents, a malicious input can affect all following requests. And, where can I find 'more robust solutions' you mentioned? |
One discussion is here in particular this comment and the code it links to, and another (that I see you already have seen) is here, where I will provide an extension that may be what you are looking for. |
We're seeing some problems with MathJax's handling of TeX macros (
\def
,\newcommand
, etc.) on math.stackexchange.com. Basically, there are two issues:I realize that these issues basically arise from the way we're using MathJax on math.SE, and that an obvious solution would be to "stop doing that, then". However, this is not as practical as it sounds: StackExchange websites are fundamentally collaborative, so having a mixture of content from multiple authors on a page is unavoidable. The live preview is also a standard StackExchange feature, and an extremely convenient one too. I doubt most users would be willing to give it up. I suppose we could disable MathJax parsing in the live preview, but the lack of feedback would make writing LaTeX formulas much more difficult.
I suppose one solution would be to just disable macro definitions (e.g. by redefining
\def
et al. themselves) on math.SE, but I'd hesitate to do that, since clearly some of our users do find this feature useful (even if most probably aren't even aware of it). What I'd prefer to see would be some features in MathJax to limit the scope of the definitions. As I suggested in the meta.math.SE discussion, that would mean either:Typeset
call and to roll them back afterwards, orI suppose either of these features would be good enough for us: if we had the latter, we could wrap our posts and preview panes in such HTML elements, while if we had the former, we could implement the latter manually by finding all such elements on the page and typesetting them one by one. (We don't really need nested scopes, although it's an obvious generalization of the second feature.)
Ps. If MathJax already has some way to achieve what I've described above, please let us know (and sorry for bothering you, if that's the case).
The text was updated successfully, but these errors were encountered: