The "dan" username is reserved by an invester, @hamster has it. He may be willing to let go of it, but perhaps not.
And the bug can be summed up as this: The mentions are processed after Markdown is processed, which means that the Markdown in a username is processed before we look up usernames.
To process the mentions before the Markdown is processed (the bug fix) creates a different bug... namely that processing it in this order means that we do not know which parts of a comment will be turned into HTML block elements that should prevent mentions from being processed, such as <code> elements which are quoting the raw strings.
And it turned out, that applying the bug fix surfaced that new bug almost immediately on the sites that share code snippets such as the Espruino forum.
So right now... the workaround is not to put Markdown characters in your username.
But what should be the fix is that the Markdown library should apply a two pass processing, the first pass being to discover and create all blocks (including blockquote, table, code, etc), and then to allow custom code to be applied (process mentions) before finally doing the second pass to process inline Markdown.
Unfortunately the existing Markdown library is a very long way from doing that... they do everything in one pass and without an abstract syntax tree. It's not many steps removed from just running regular expressions.
Which means we either:
1) Run regexps ourselves, pre-Markdown processing
2) Run HTML aware processing post-Markdown processing
The first creates bugs all over the place.
The second creates a bug with usernames that contain Markdown.
Considering the impact of the second scenario is far less than the impact of the first, and that there is a work around (don't put Markdown characters in your username), that is the scenario I chose.
The characters to avoid in your username include *_=\ and then anything that isn't a display character, such as HTML entities that are not rendered like ­.
The issue may appear if you only have a single Markdown character in your username, but definitely will appear if you have a pair of the same character.
Yeah it's a bug.
The "dan" username is reserved by an invester, @hamster has it. He may be willing to let go of it, but perhaps not.
And the bug can be summed up as this: The mentions are processed after Markdown is processed, which means that the Markdown in a username is processed before we look up usernames.
To process the mentions before the Markdown is processed (the bug fix) creates a different bug... namely that processing it in this order means that we do not know which parts of a comment will be turned into HTML block elements that should prevent mentions from being processed, such as
<code>
elements which are quoting the raw strings.And it turned out, that applying the bug fix surfaced that new bug almost immediately on the sites that share code snippets such as the Espruino forum.
So right now... the workaround is not to put Markdown characters in your username.
But what should be the fix is that the Markdown library should apply a two pass processing, the first pass being to discover and create all blocks (including
blockquote
,table
,code
, etc), and then to allow custom code to be applied (process mentions) before finally doing the second pass to process inline Markdown.Unfortunately the existing Markdown library is a very long way from doing that... they do everything in one pass and without an abstract syntax tree. It's not many steps removed from just running regular expressions.
Which means we either:
1) Run regexps ourselves, pre-Markdown processing
2) Run HTML aware processing post-Markdown processing
The first creates bugs all over the place.
The second creates a bug with usernames that contain Markdown.
Considering the impact of the second scenario is far less than the impact of the first, and that there is a work around (don't put Markdown characters in your username), that is the scenario I chose.
The characters to avoid in your username include
*_=\
and then anything that isn't a display character, such as HTML entities that are not rendered like­
.The issue may appear if you only have a single Markdown character in your username, but definitely will appear if you have a pair of the same character.