Don't escape number signs (#) if they won't be parsed as headings #106

Merged
dragonman225 merged 1 commit from master into master 2023-07-28 18:49:06 +02:00
dragonman225 commented 2023-07-28 13:09:00 +02:00 (Migrated from github.com)

Fixes #105 and add related test patterns

Note: Although CommonMark 0.30 only specifies spaces, tabs, or by the end of line as the separator between the heading markers # and the heading content, my code uses \s regex to identify spaces (like the code for escaping list item markers), so it will escape heading markers if they are followed by a Unicode space.

It's stricter but has better compatibility with other Markdown editors, e.g. iA Writer parses # 123456 (with U+3000 in between) as a heading.

Fixes #105 and add related test patterns Note: Although [CommonMark 0.30](https://spec.commonmark.org/0.30/#atx-headings) only specifies *spaces, tabs, or by the end of line* as the separator between the heading markers `#` and the heading content, my code uses `\s` regex to identify spaces (like the code for escaping list item markers), so it will escape heading markers if they are followed by a Unicode space. It's stricter but has better compatibility with other Markdown editors, e.g. iA Writer parses `# 123456` (with `U+3000` in between) as a heading.
marijnh commented 2023-07-28 18:49:14 +02:00 (Migrated from github.com)

Thanks!

Thanks!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-markdown!106
No description provided.