Skip to content

codelinks: One-line marker scanner triggers on @-mentions anywhere in a comment line, not just at line start #88

Description

@HartmannNico

Bug description

The sphinx-codelinks one-line marker scanner looks for @ anywhere in a comment line. If an @-containing word is followed by a comma later on the same line, the scanner interprets the text as a malformed marker and raises InvalidNeedException: Given ID '...' does not match configured regex

To reproduce

Any Rust source comment of the form:

// Some prose that mentions @@another-tag(item_1, item_2): more text
// See @author, check the example
// We parse things matching @pattern, then act

…fails the build if the field between the first comma and the next comma/end-of-line doesn't match the configured ID regex.

Current behaviour

Scans for @ at any position in the comment text. Treats everything before the first comma as the title and everything between the first and second comma as the ID. Build fails when the "ID" contains spaces or special characters.

Expected behaviour

Only parse a line as a one-line marker when @ appears at the start of the meaningful comment content — i.e., the line matches ^\s*//!?\s*@<title>,\s*<id>,\s*<type>,\s*\[<links>\]. An @ embedded in the middle of free-form prose should be ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions