# Links in comments do not work if they contain space before dollar and also square brackets inside MathJax

The format [text](url) is the standard format for using links in the comments. And it works just fine even if the text contains MathJax.

Normally, adding spaces inside MathJax do not influence the end result. However, it seems that if inside the MathJax we have [...] then spaces can cause link not to be rendered correctly. (I have noticed this when there is space before the last dollar in the title of the link. But possible there are also some other situations.) I will also explicitly mention that I am aware of the fact that if [ or ] are used outside of MathJax, they have to be escaped.

To include some example: Both [Divisibility in $\mathbb{Z}[X]$](https://math.stackexchange.com/q/3179896) Divisibility in $$\mathbb{Z}[X]$$ and [Divisibility in $\mathbb{Z}[X]$](https://math.stackexchange.com/q/3179896) Divisibility in $$\mathbb{Z}[X]$$ both work correctly in a post, but in a comment the latter does not work. (See the comments below this post and also a screenshot showing how they are displayed at the moment.)

Even if this is not going to be fixed, at least I would like to know whether I can count on the fact that the comments that work correctly now will be rendered the same in the future. (Not too long ago there was change in the Stack Exchange software which caused many comments to be rendered rather differently than they looked at the time when they were posted. So I am basically asking for assurance that similar problem will not come up with comments with hyperlinks containing MathJax.)

EDIT: It's possible that this is related to this problem with MarkDown in comments: Trailing spaces on comment link format. (See also: Why is mini-markdown working in some of my comments, but broken in others? An answer there says: "you have extra leading or trailing spaces in some of them, which are no longer allowed. It's by design because of tricksters who wish to subvert the minimum character comment input.".)

• Test: [Divisibility in $\mathbb{Z}[X]$](https://math.stackexchange.com/q/3179896) works: Divisibility in $\mathbb{Z}[X]$. However: [Divisibility in $\mathbb{Z}[X]$](https://math.stackexchange.com/q/3179896) [Divisibility in $\mathbb{Z}[X]$](math.stackexchange.com/q/3179896). – Martin Sleziak Aug 22 '19 at 9:50
• Test without MathJax: Although these formats both work in a post, in comments we have to escape square brackets: [Divisibility in Z$X$](https://math.stackexchange.com/q/3179896) Divisibility in Z[X] and [Divisibility in Z[X]](https://math.stackexchange.com/q/3179896) [Divisibility in Z[X]](math.stackexchange.com/q/3179896). – Martin Sleziak Aug 22 '19 at 9:51
• Test what happens to links from the first comment if we add backslash: [Divisibility in $\mathbb{Z}$X$$](https://math.stackexchange.com/q/3179896) Divisibility in $\mathbb{Z}$X$$ and [Divisibility in $\mathbb{Z}$X$$](https://math.stackexchange.com/q/3179896) Divisibility in $\mathbb{Z}[X]$. – Martin Sleziak Aug 22 '19 at 9:52
• $$\text{Divisibility in }\mathbb{Z},\left [X\right ]$$ – user645636 Sep 15 '19 at 22:19
• ${\text{Divisibility in }\mathbb{Z},\left [X\right ]}$ second one in case my first didn't leave the space. – user645636 Sep 17 '19 at 12:54