Unable to mention category as first text on line

Continuing the discussion from Mentioning Categories instead of Groups?:

Summary:

Unable to mention a category when the hashtag is the first text on a line.

Steps to reproduce:

  1. Create topic or post
  2. Add category preceeded by hashtag as first text on a line

Expected Results:

Editor offers to autocomplete category name and create mention

Actual Results:

Level 1 header is created

Notes:

Understand that this conflicts with Markdown spec, so not sure how this could be solved.

Attachments:

This is what happens with a category mention on its own line:
howto

Versions and Mods:

Discourse 1.5.0.beta7 (meta.discourse.org)

System Information:

Windows 10 Pro, Chrome Stable 47

إعجابَين (2)

This isn’t a bug, I added rules to make sure this does not conflict with Markdown’s ATX-style headers.

#This is a h1 header
# This is also a h1 header
3 إعجابات

In commonmark the space is required so I think you can safely ignore that.

إعجاب واحد (1)

Until we port over to commonmark, the headers are going to conflict with the autocomplete which doesn’t look good to me UX wise. :philosoraptor: