jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
877 stars 160 forks source link

Faulty recognition of closing sequence in atx headers #778

Closed kuranari closed 11 months ago

kuranari commented 12 months ago

Expected Behavior

  1. We want trailing spaces to be visible when markdown-hide-markup is enabled.
    • The current behavior results in an unnatural input experience(see the attached video for more details).
  2. The closing sequence must be preceded by a space or tab

Actual Behavior

  1. Trailing spaces are not visible when 'markdown-hide-markup' is enabled.
  2. A closing sequence is identified even without a trailing whitespace.

Steps to Reproduce

Input # foo# or ## Steps to Reproduce

https://github.com/jrblevin/markdown-mode/assets/2577343/c7733f4a-7ff5-4952-833a-25ebe84059c0

The whitespace appears when the next character is entered.

Software Versions

Additional Details

The issue occurs due to the definition of markdown-regex-header.

Changes were introduced to align with the implementation of Markdown.pl as per this commit: https://github.com/jrblevin/markdown-mode/commit/26e39378e0fd4445bd8409ef72a7ffbf322293bc

While the behavior of the whitespace following the opening sequence was modified with this commit: https://github.com/jrblevin/markdown-mode/commit/58ba6a31843a3dc919aece5f3a152067af3d3ff5, the behavior of the whitespace preceding the closing sequence was not altered.