akiomik / akiomik/mado

MD034 misses a bare URL whose scheme is not lower-case

Offen
#420 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Rust
Sterne
407
Forks
12
Ø Merge
5 Std. 45 Min.
Gemergte PRs (30 T.)
30

Beschreibung

`HTTP://www.example.com/` is a link on GitHub and MD034 says nothing about it. `mado` 0.3.2 reported it; #418 does not.

cmark-gfm decides the scheme with `strncasecmp`:

```c
if (link_len > len && strncasecmp((char *)link, valid_uris[i], len) == 0 &&
```

comrak 0.54 decides it with `==` (`src/parser/autolink.rs`):

```rust
let scheme = &subject.input[i - rewind..i];
let cond = |s: &&str| size - i + rewind >= s.len() && &scheme == s;
if !SCHEMES.iter().any(cond) {
return None;
}
```

so `Http://`, `HTTPS://` and the rest are text to comrak and links to GitHub. The GFM spec writes the schemes lower-case and says nothing about case either way, so cmark-gfm is the authority here and comrak is the one out of step.

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_no_errors_with_upper_case_scheme` pins the loss and names this issue. What is left is to take it upstream to comrak and, once it lands, turn that test into one that expects a violation.

Not the same as `Www.example.com`, which cmark-gfm compares with `memcmp` and does not autolink either. mado agrees with cmark-gfm there; markdownlint reports it and is the one being lenient.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.