gomarkdown / markdown

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

Parsing: add reference nodes to AST tree #244

Open quenbyako opened 2 years ago

quenbyako commented 2 years ago

Here is the problem: autoresolving of referenced links works well, however, for me, it's strictly important to get reference link definitions unchanged. E.g. this code:

Hello [world][wiki-world]

[wiki-world]: https://wikipedia.com/blah-blah-blah

can't be parsed and rendered back again to same structure, instead of this, ast with markdown renderer, renders to this structure:

Hello [world](https://wikipedia.com/blah-blah-blah)

which isn't what i expect from syntax tree.

I looked a bit in code, and found that for now, links parser has overcomplicated structure, imho, so maybe it's time to refactor it a bit? As far as i understand, the proposed change is impossible with current implementation of links parser.

kjk commented 2 years ago

I'm happy to accept patches but to set expectation: I'm not going to work on this myself.