gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.37k stars 172 forks source link

Find the line number where the ast.Node was found #249

Closed Arteneko closed 2 years ago

Arteneko commented 2 years ago

Hi! I'm trying to implement something with a custom RenderNodeHook to extract some metadata (namely, links inside the document).

For this purpose, I'd need access to the line in the markdown file from which an ast.Node was built (maybe the character index from start of line too, but not a hard requirement).

I fail to find anything inside the ast package for this, is there a way?

kjk commented 2 years ago

No, line number is not provided in AST.

Arteneko commented 2 years ago

Couldn't that be added?

kjk commented 2 years ago

I'm sure it can be done but I have no plans to work on that.