Skip to content

Adjoined comments fail to render correctly  #584

@rien333

Description

@rien333

While I'm a huge fan of this mode, one thing has bugged me for years: whenever you create two adjoining (HTML) comments — without any whitespace between them — the second renders in the default face, instead of the comment face. This is annoying to me, since my documents are filled with comments, meaning that I have to jump to all sorts of hoops to make two adjoining comments discernible from the main text (I write academic documents in markdown on a daily basis, and I use comments for all sorts of purposes).

It's of course possible to solve this issue by inserting whitespace in between the two comments. However, this distracts me from my writing flow, and, more importantly, creates unwanted whitespace in the resulting document (e.g. a pdf I create from the .md file; see screenshot in §Actual Behavior).

Note that this does not happen in emacs' HTML-mode (i.e. both adjoining comments render in the correct face). As such, this issue should in principle be solvable.

Expected Behavior

Whenever two comments are placed side-by-side (without whitespace between them), both should render in the markdown-comment-face.

Actual Behavior

The second comment is rendered in the default face. Here is a screenshot that shows the problem:

2021-01-12-1610458263

Steps to Reproduce

  1. Create a .md file with the following contents:
Main text <!--a comment--><!--another comment-->.

(ironically, github does render this example correctly when using markdown syntax highlighting!)

Backtrace

Not applicable I think; this is reproducible using emacs -Q.

Software Versions

  • Markdown Mode: 20210107.101 (though this issue has been present in versions from years ago)
  • Emacs: 25–28 (I think I started emacs around version 25, and this bug has always been present)
  • OS: tested on Linux (kernels 4.x–5.x), macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions