jrblevin / markdown-mode

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

Comments do not fill properly #833

Open joeljamesadamson opened 1 week ago

joeljamesadamson commented 1 week ago

Expected Behavior

When using M-q fill-paragraph in a block of comments, comment markers should reframe so the beginnings and endings of lines are marked with comments. For example:


<!--- this is a comment that goes over the end of the line I have set with fill-column -->
<!--- and this is the continuation of that line after using M-q -->

This is the default behavior in every other major mode that uses comments; some do not have an end-of-line delimiter, of course.

Actual Behavior

What happens instead is that if a comment goes past fill-column and then the user presses M-q, the beginning and ending of lines are inserted into the center of the line, i.e. the text is all filled as if it were regular text and there were no comment delimiters:

<!--- this is a comment that goes over the end of the 
line I have set with fill-column --> <!--- and this is the 
continuation of that line after using M-q -->

All of it is still font-locked as a comment, and will still be processed as a comment, but it doesn't look good and it doesn't fit with typical Emacs behavior.

Steps to Reproduce

  1. Insert comment delimiters using M-;
  2. Start typing! and type well past fill-column
  3. Put the point anywhere in that comment block and use either fill-paragraph or M-q

Backtrace

Software Versions

markdown-mode, version 2.6 GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) on Arch Linux

joeljamesadamson commented 1 week ago

An alternative would be to have the whole block reframe so that there's a <!--- at the beginning and a --> at the end with no delimiters marking the intervening lines. But that doesn't happen either.