Skip to content

Number Duplicate Inline Comments Correctly Past a Stray Backtick #3429

Closed

Description

@ptr727

Problem

The inline Markdown comment search blanks code spans with CODE_SPAN before searching, which does not follow CommonMark's precedence rules. A stray backtick (backslash-escaped, inside a comment's own text, in an HTML attribute, or in an autolink) pairs with a later backtick and blanks the stretch between them. Where the first of two comments with identical text falls inside that stretch, the search skips it and numbers both on the later line.

Reproduction (constructed)

Start \` and <!-- x --> one
then \` and
later <!-- x --> two.

The two comments are numbered 1 and 3 by the raw search that preceded the code-span mask, and 3 and 3 by the masked search. The second copy must sit mid-line, since one at the start of a line is an html_block.

What fixing it needs

Code-span positions taken from the Markdown parser rather than a regex, or a search that accepts a masked hit only where the raw line agrees and the comment is not inside a real span. Rare: it needs a stray backtick and two comments with the same text in one paragraph.

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