What operating system and processor architecture are you using? : linux/amd64
What did you do? :
I need to process links with emtpy link text - for example [](./target.md). My
usecase is to write an extension which find the heading of the referenced document
and set it as the link text, if its empty.
package main
import (
"bytes"
"github.com/yuin/goldmark"
)
func main() {
var source = []byte(`[](./target.md)`)
var buf bytes.Buffer
if err := goldmark.Convert(source, &buf); err != nil {
panic(err)
}
print(buf.String())
}
What did you expect to see? :
<p><a href="./target.md"></a></p>
Note: I need the corresponding Node in the AST
What did you see instead? :
<p>[](./target.md)</p>
Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?:
What version of goldmark are you using? :
v1.1.22
What version of Go are you using? :
1.13.7
What operating system and processor architecture are you using? :
linux/amd64
What did you do? :
I need to process links with emtpy link text - for example
[](./target.md)
. My usecase is to write an extension which find the heading of the referenced document and set it as the link text, if its empty.What did you expect to see? :
Note: I need the corresponding Node in the AST
What did you see instead? :
Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?:
Yes, the CommonMark specification (https://spec.commonmark.org/0.29/#link-text) says:
But there is no example for such a edge case. Issue is created: https://github.com/commonmark/commonmark-spec/issues/636
Input (the last one is really useless but conform with the specification)
CommonMark online demo ([Quick Link](https://spec.commonmark.org/dingus/?text=%5BMy%20Target%5D(.%2Ftarget.md)%0A%5B%5D(.%2Ftarget.md)%0A%5B%5D()%0A)) output
Goldmark output