4

On all Stack Exchange websites, using square brackets in a hyperlink like in the following Markdown code is correctly translated into HTML in questions and answers, but not in comments:

[[class.access]](http://eel.is/c++draft/class.access).

10
  • Related: Escape square brackets in comment links. The linked post suggests to use \[ and \], for example., [\[class.access\]](http://eel.is/c++draft/class.access) gives [class.access].
    – Martin
    Commented Feb 14, 2020 at 13:31
  • @Martin Thanks for the link. But comments and questions & answers should behave the same way.
    – Géry Ogam
    Commented Feb 14, 2020 at 13:40
  • Meh, why use square brackets as link text, there is no use in that. Just don't double them up.
    – Luuklag
    Commented Feb 14, 2020 at 13:43
  • Fair enough! The two post can probably be considered different - the other is asking how to use links where the title contains square brackets the way MarkDown currently works in the comments - while your post suggests that instead of using a workaround this should be considered a bug. Still, I think that the link to the workaround might be useful for users reading your question. (I hope I remember this correctly - IIRC you need to add \[ and \] also for such links in chat, not only comments.)
    – Martin
    Commented Feb 14, 2020 at 13:44
  • @Luuklag The C++ standard should be quoted like that, it is the name of each paragraph (just look at it).
    – Géry Ogam
    Commented Feb 14, 2020 at 13:45
  • [class.access] Or you just put the extra brackets outside of the hyperlink, easy fix.
    – Luuklag
    Commented Feb 14, 2020 at 13:47
  • @Martin Yes the workaround is useful that is why I thanked you. I don’t know which way is the best (requiring the escape character or not) but comments and questions & answers should at least behave consistently.
    – Géry Ogam
    Commented Feb 14, 2020 at 13:49
  • 1
    @Luuklag I am not looking for a workaround, I am looking for consistency in user experience. Comments should behave the same as questions & answers on this matter.
    – Géry Ogam
    Commented Feb 14, 2020 at 13:51
  • Well then I think your in for a pain. IMHO comments use the most basic form of Markup, so that would mean that we should make posts consisted with how markup is handled in comments. So having to escape special characters in posts as well.
    – Luuklag
    Commented Feb 14, 2020 at 15:08
  • 1
    @Luuklag In your comment above, the leftmost square bracket appears as part of the link text. In the preview, and also after submitting the post, the leftmost square bracket is not a part of the link text. The behavior in chat seems to be the same as in the comments, as Martin said above. Commented Feb 8, 2023 at 6:11

0

You must log in to answer this question.

Browse other questions tagged .