jrblevin / markdown-mode

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

markdown-hide-markup hides the end mark of code block but leaves a blank line #754

Open seraphlive opened 1 year ago

seraphlive commented 1 year ago

I'm not sure if this is a bug or is intended. When using markdown-hide-markup related function to hide the markup, the end mark (```) of a code block will be hide but a blank line is left. This only happens if the mark is at the end of the buffer. If there are texts following it there will be no blank line left.

Expected Behavior

There should be no extra blank line left after the markups are hided. image (only line 2 should be left.)

Actual Behavior

Line 3 is still displayed as a blank line. image

No issue if there are still text followed. image

Steps to Reproduce

  1. Create a test.md with simple code block
    ```lisp
    (require 'package)
  2. emacs -Q -load path/to/markdown-mode.el test.md (enable display-line-numbers-mode for clarity)
  3. execute markdown-toggle-markup-hiding to hide markup.
  4. Disable the hiding and add text under the code block.
  5. execute markdown-toggle-markup-hiding again to hide markup.

Backtrace

Software Versions