Skip to content

Custom extension not able to parse custom syntax that starts with [, even if not conflicting with link syntax. #524

@ForgottenR

Description

@ForgottenR
  1. What version of goldmark are you using? :
    1.7.13
  2. What version of Go are you using? :
    1.24.5
  3. What operating system and processor architecture are you using? :
    macos arm
  4. What did you do? :
    I tried to implement a custom extension to parse syntax such as [^1^] . If we try to parse it as a link, since it has neither a link destination, nor a matching link reference definition, it should fail.
  5. What did you expect to see? :
    With the correct priority value set, the custom parser should be able to continue to try parsing on cases where links fail to resolve.
  6. What did you see instead? #:
    The custom parser won't work with a priority lower than the link parser, where the failed content is appended as text nodes or segments by the link parser.
  7. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?:
    Can't answer since it's about a custom extension's behaviour issue.

The root issue seems to be that the link parser consumes content before ] character and output a separate node, which doesn't allow the parser's "revert to original position" behavior to work when the link fails to resolve later. And there is a related issue #132

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