Unable to get original content for LinkReferenceDefinitionGroup #649

Open
opened 2026-01-29 14:42:04 +00:00 by claunia · 2 comments
Owner

Originally created by @doggy8088 on GitHub (Jan 23, 2024).

I'm parsing a Markdown document that contains LinkReferenceDefinitionGroup . When I call ToPositionText() method for that part of the MarkdownDocument, the line and column will be 0 and 0, and the Range is wrong too. I don't know how to fix this. Any hint?

var document = Markdown.Parse(markdownText);
var parts = document.ToList();
for (int i = 0; i < parts.Count; i++)
{
    var item = parts[i];
    if (item is Markdig.Syntax.LinkReferenceDefinitionGroup)
    {
        // item.Line = 0
        // item.Column = 0
        // item.ToPositionText(); // $0, 0, 0-79
    }
}
Originally created by @doggy8088 on GitHub (Jan 23, 2024). I'm parsing a Markdown document that contains LinkReferenceDefinitionGroup . When I call `ToPositionText()` method for that part of the MarkdownDocument, the line and column will be `0` and `0`, and the Range is wrong too. I don't know how to fix this. Any hint? ```cs var document = Markdown.Parse(markdownText); var parts = document.ToList(); for (int i = 0; i < parts.Count; i++) { var item = parts[i]; if (item is Markdig.Syntax.LinkReferenceDefinitionGroup) { // item.Line = 0 // item.Column = 0 // item.ToPositionText(); // $0, 0, 0-79 } } ```
claunia added the question label 2026-01-29 14:42:04 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 23, 2024):

LinkReferenceDefinitionGroup has no parsing equivalent so cannot have a representation in text. It is just used internally to group LinkReferenceDefinition and query for links.

@xoofx commented on GitHub (Jan 23, 2024): `LinkReferenceDefinitionGroup` has no parsing equivalent so cannot have a representation in text. It is just used internally to group `LinkReferenceDefinition` and query for links.
Author
Owner

@doggy8088 commented on GitHub (Feb 22, 2024):

It because I use Markdig to traversal the Markdown document for translation purpose. I need to keep all the content as-is. When I parse to the LinkReferenceDefinitionGroup, I don't have the position info. So that I can't get the original content. I need that info the keep my final Markdown document complete.

Can you still provide Position info for this block?

@doggy8088 commented on GitHub (Feb 22, 2024): It because I use Markdig to traversal the Markdown document for translation purpose. I need to keep all the content as-is. When I parse to the `LinkReferenceDefinitionGroup`, I don't have the position info. So that I can't get the original content. I need that info the keep my final Markdown document complete. Can you still provide Position info for this block?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#649