akiomik / akiomik/mado

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

Đang mở
#420 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Rust
Star
409
Fork
12
Merge trung bình
5 giờ 45 phút
Pull request đã merge (30 ngày)
30

Mô tả

`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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with comrak's src/parser/autolink.rs and mado's rule::md034::tests::check_no_errors_with_upper_case_scheme, confirming how mixed- or upper-case schemes are classified. The work is complete when the upstream parser handles the schemes consistently and the mado test is updated to expect an MD034 violation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
testing, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.