Consider this:
[First try
----------
Second try]: https://rust-lang.org
It's a real ambiguity of the CommonMark spec; I could not find anywhere that it said anything about whether link definitions or setext headers have higher binding power. But most other parsers do it the same way:
[First try
Second try]: https://rust-lang.org
Details
Events from pandoc:
"[*\n-\n]:{\n" -> [
Start(Heading { level: H2, id: None, classes: [], attrs: [] })
Text(Boxed("[*"))
End(Heading(H2))
Start(Paragraph)
Text(Boxed("]:{"))
End(Paragraph)
]
Events from commonmark.js:
"[*\n-\n]:{\n" -> [
Start(Heading { level: H2, id: None, classes: [], attrs: [] })
Text(Boxed("[*"))
End(Heading(H2))
Start(Paragraph)
Text(Boxed("]:{"))
End(Paragraph)
]