markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Unable to get original content for LinkReferenceDefinitionGroup

Open doggy8088 opened this issue 5 months ago • 2 comments

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
    }
}

doggy8088 avatar Jan 23 '24 07:01 doggy8088

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 avatar Jan 23 '24 07:01 xoofx

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 avatar Feb 22 '24 15:02 doggy8088