MD034 reports a URL inside link text that follows a nested `]`
- Vorherrschende Sprache
- Rust
- Sterne
- 407
- Forks
- 12
- Ø Merge
- 5 Std. 45 Min.
- Gemergte PRs (30 T.)
- 30
Beschreibung
`see [note [1] https://example.com/doc](/x) now` is one link on GitHub, with the URL inside its text, and #418 reports the URL as bare. `mado` 0.3.2 reported nothing, and neither does markdownlint.
GFM refuses an autolink anywhere inside brackets, and asks the bracket stack rather than a flag. github/cmark-gfm `extensions/autolink.c`:
```c
static cmark_node *match(cmark_syntax_extension *ext, cmark_parser *parser,
cmark_node *parent, unsigned char c,
cmark_inline_parser *inline_parser) {
if (cmark_inline_parser_in_bracket(inline_parser, false) ||
cmark_inline_parser_in_bracket(inline_parser, true))
return NULL;
```
comrak 0.54 asks a `bool` that any `]` clears, so an inner `[1]` closes it and the URL after it is autolinked though the outer `[` is still open (`src/parser/inlines.rs`):
```rust
if !self.options.parse.relaxed_autolinks && self.within_brackets {
return None;
}
```
comrak's own rendering shows it is a parser defect rather than a dialect: the autolink runs to the next space and swallows the `](/x)` that would have closed the link, so what comes out is an `` with `%5D(/x)` in its href — or, where a space precedes the `]`, an `` nested inside an ``, which no renderer means to emit.
An image inside link text closes the flag the same way, so a README badge link reproduces it too.
MD034 reports the links its parser makes, which is what #418 settled, so there is nothing to fix in the rule:
`rule::md034::tests::check_errors_with_bare_url_after_nested_brackets` pins the report and names this issue. What is left is comrak.
This one is a false positive where #420 and #421 are reports lost, and it is the reason `Document::parse_with_autolink` cannot pass over a text node for being inside a link: comrak really does autolink there, so passing it over made the report depend on whether the document had another URL elsewhere.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.