Closed dragonman225 closed 1 year ago
According to the CommonMark spec, # that is not followed by spaces, tabs, or the end of line, would not become headings.
#
Example: https://spec.commonmark.org/dingus/?text=%23%20abc%20(heading)%0A%0A%23abc%20(not%20heading)%0A%0A%23%0A(%E2%86%91%20empty%20heading)%0A
But the serializer of prosemirror-markdown escapes # even if the text would not be parsed as headings. e.g.
prosemirror-markdown
#foo
would be serialized back to
\#foo
making the generated Markdown less clean and less readable.
Given my previous experience with #101, I wonder if this can be solved by changing the regular expressions in the esc function a bit.
esc
Yes, this sounds like it could also be fixed by not matching these characters if they are followed by non-whitespace. Want to submit a PR?
Sure! I'll try.
Problem
According to the CommonMark spec,
#
that is not followed by spaces, tabs, or the end of line, would not become headings.Example: https://spec.commonmark.org/dingus/?text=%23%20abc%20(heading)%0A%0A%23abc%20(not%20heading)%0A%0A%23%0A(%E2%86%91%20empty%20heading)%0A
But the serializer of
prosemirror-markdown
escapes#
even if the text would not be parsed as headings. e.g.would be serialized back to
making the generated Markdown less clean and less readable.
Solution
Given my previous experience with #101, I wonder if this can be solved by changing the regular expressions in the
esc
function a bit.