How/where to customize markdown parser

I’m preparing a Discourse instance using SSO and it’s important for us to support the existing usernames which have underscore&dashes on any position. I have managed to do the regex updates on Discourse code for this to work, including making the username autocomplete on the composer to play well with it.

However, I’m having trouble with the markdown parser which I’m not familiar with. Specifically, usernames with underscores in the first and last position of a @mention makes it italic, as per markdown specs. So currently a post with something like @_username_ becomes @username (and not linked).

Can someone give me some pointers on where to starting looking to customize this? I’m new to Discourse so any help is appreciated. Thanks in advance!

1 Like

This is going to be elite level difficulty. I would give up on this if I were you and accept the minor username changes. That’s my professional opinion as someone with 8+ years of experience in the matter.


Thank you for the heads up on this. Surely above my level.

I’m considering the possibility of hiring someone with the skills to look into this. If it gets done, would you consider this for the core, assuming everything works, passes all tests, etc? Or, is underscores/dashes not something Discourse will ever have in usernames? Just trying to understand if this would be a patch (PR) or a plugin.

No, I would not consider it.

1 Like

I am with Jeff here, I strongly recommend you abort this mission

Shuffling with precedence of rules in the markdown engine is very likely to have terrible side effects