markup
markup copied to clipboard
@ character is not escapable
User Story
As a GitHub user I want to make @ characters escapable to avoid the automatic mentioning of users.
Problem
In GitHub issue comments it is not possible to escape the @ character with the backslash. This may lead to unintended mentioning of other users. It is however possible to use the grave (`@`) or the zero width space (U+200B). Since the ZWSP is hard to find after you copy a table, I do not recommend it here. I first noticed the bug this issue.
Examples
| Syntax | Example | Expected behavior | Actual behavior |
|---|---|---|---|
@spixi |
@spixi | mention link | mention link |
\@spixi |
@spixi | no mention link | mention link |
`@spixi` |
@spixi |
no mention link | no mention link |
@spixi with ZWSP |
@spixi | no mention link | no mention link |
Commonmark, unlike Gruber's original Markdown, allows all punctuation chars in U+0020..7F to be escaped with the backslash. Alas, Github's at-mention extension apparently works as a postprocessor on top of cmark-gfm and is not a part of its Autolinks extension.
Indeed, we do postprocess to add @mentions to a document. By the time the \@ makes it to the part of the code that links users, the backslash has already been eaten by our Markdown processor. (I've been known to use the ZWSP trick myself.)
If CommonMark didn't allow escaping all punctuation in ASCII with a backslash, the Markdown processor would leave the backslash alone, and then we could detect it in the postprocess stage. If we added an exception here, we'd no longer be CommonMark-compliant — the documents @ and \@ should render identically.
There's no simple solution here, unfortunately.
Found an easy way to escape at signs! E.g.: @chloekek. This doesn't insert code markup or ZWSPs.
@<!-- -->chloekek
@chloekek Nice finding. <!-- --> is used for comments in SGML and does not seem to be part of vanilla Markdown. Could this somewhere added to the help page?
(I've been known to use the ZWSP trick myself.)
@kivikakk What is the "ZWSP trick"? Zero-width space?
@chloekek Great solution!
@kivikakk See @spixi's suggestion that this get added to the help page. Zero-width spaces is a huge pain to type and interrupts the thought process while trying to compose messages.
@jzabroski Yes, it stands for zero-width space.
I didn't write or have input on the docs — might need to get in touch with @github/product-docs-core? (This is a guess, sorry if I'm @mention'ing the wrong team!)
@github/product-docs-core is the right team! First responder here... I opened https://github.com/github/help-docs/issues/11534 to track this issue. 😊
Just want to add a real-world use-case for this feature, which is that the JSON-LD spec has various keywords that begin with the @ symbol, e.g. @context, @id, @type, etc. When discussing these on GitHub it's all too easy to not backtick them and then you have user mentions everywhere. (This is also happening in commit messages that reference these terms, though I don't really expect people to escape @ in commit messages.)
Another use case: SCSS has a variety of @-rules that it would be nice to be able to mention in issues without pinging the corresponding users.
Hey! I found this ( ). Thus I could add ``` into my code block on my readme.md file 😁