I’m thinking about writing a plugin that converts @username to e.g. <a class="mention" href="..../users/username">@username</a>.
Do you know if there are currently any plugins or extensions I can have a look at, to find out how to write a plugin? (I haven’t been able to find any.)
There is not already a mentions plugin for CommonMark somewhere?
Do you know about any guidelines or tutorials anywhere about how to write plugins and extensions?
Are you interested in a @mentions plugin? I’m thinking it could be useful in combination with At.js.
@jgm and the other core developers said that they are still ironing out the core specs and implantations before they would touch on spec extensions.
In terms of pluggability, have you considered Remarkable - high speed pluggable implementation for javascript ? Perhaps that would be easier for you to add non standard extensions via that method. They are more willing to experiment if I last remembered correctly.
@mention seems about as straightforward a syntax as #tag at first and it has been implemented several times, e.g. here in Discourse (as OP already mentioned) or at Stack Exchange. Remember, though, that this extension may conflict with established practice, hence expectations, elsewhere:
In code documentation and discussion, the at-sign usually introduces attribute@att or parameter@param names. In Java-Doc and relatives it precedes the “line classifier” (or whatever it is called), e.g. * @param {Number} start.
In Pandoc and probably other extensions, the at-sign is used to prefix the cite key of proper scientific citations. It usually appears inside square brackets, but also outside or without any.
Established practice in plain text environments is what should guide and limit Markdown extensions, but not every extension needs to work flawlessly in every context.
In pandoc, @foo is used for two things: references to numbered example list items and citations. Unfortunately this syntax was established before the current “mentions” convention took hold.
I wonder if mentions plugins tend to be app specific. They refer to users via username or ids, and the way they do this (html attribute names and format, and url links to about-user pages) might app specific I would think. Perhaps each web app will have its own mentions plugin (perhaps some base version + a few tweaks).