rumdl 0.1.78

A fast Markdown linter written in Rust (Ru(st) MarkDown Linter)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
use rumdl_lib::config::Config;
use rumdl_lib::lint;
use rumdl_lib::rules::all_rules;

#[test]
fn test_inline_disable_enable_blocks() {
    let content = r#"# Test Document

<!-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but should be ignored due to the disable comment above

<!-- markdownlint-enable MD013 -->
This is another very long line that exceeds 80 characters and should trigger MD013 because it was re-enabled by the enable comment
"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // Find MD013 warnings
    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have exactly one MD013 warning (line 7)
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
    assert_eq!(
        md013_warnings[0].line, 7,
        "Expected warning on line 7, got line {}",
        md013_warnings[0].line
    );
}

#[test]
fn test_inline_disable_all_rules() {
    let content = r#"# Test Document

<!-- markdownlint-disable -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but all rules are disabled
## This would trigger MD025 (multiple top-level headings) but all rules are disabled
Trailing spaces here
<!-- markdownlint-enable -->

This is another very long line that exceeds 80 characters and should trigger MD013 because all rules were re-enabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // All warnings should be from lines after the enable comment (line 8+)
    for warning in &warnings {
        assert!(
            warning.line >= 8,
            "Warning on line {} should have been disabled (before line 8)",
            warning.line
        );
    }
}

#[test]
fn test_nested_disable_enable() {
    let content = r#"# Test Document

<!-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled
<!-- markdownlint-disable MD009 -->
This line has trailing spaces and should not trigger MD009
This is a very long line that exceeds 80 characters and would normally trigger MD013 but is still disabled
<!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters and should now trigger MD013 because it was re-enabled
This line has trailing spaces and should not trigger MD009
<!-- markdownlint-enable MD009 -->
This line has trailing spaces and should now trigger MD009  "#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    let md009_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD009"))
        .collect();

    // MD013 should only trigger on line 9
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
    assert_eq!(
        md013_warnings[0].line, 9,
        "Expected MD013 on line 9, got line {}",
        md013_warnings[0].line
    );

    // MD009 should only trigger on line 12
    assert_eq!(
        md009_warnings.len(),
        1,
        "Expected 1 MD009 warning, got {}",
        md009_warnings.len()
    );
    assert_eq!(
        md009_warnings[0].line, 12,
        "Expected MD009 on line 12, got line {}",
        md009_warnings[0].line
    );
}

#[test]
fn test_disable_at_end_of_file() {
    let content = r#"# Test Document

This is a very long line that definitely exceeds the default limit of eighty characters by a lot here

<!-- markdownlint-disable MD013 -->
This is a very long line that definitely exceeds the default limit of eighty characters but is disabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have exactly one MD013 warning (line 3)
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
    assert_eq!(
        md013_warnings[0].line, 3,
        "Expected warning on line 3, got line {}",
        md013_warnings[0].line
    );
}

#[test]
fn test_multiple_disable_same_rule() {
    let content = r#"# Test Document

<!-- markdownlint-disable MD013 -->
<!-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled
<!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because it was re-enabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have exactly one MD013 warning (line 7)
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
    assert_eq!(
        md013_warnings[0].line, 7,
        "Expected warning on line 7, got line {}",
        md013_warnings[0].line
    );
}

#[test]
fn test_enable_without_disable() {
    let content = r#"# Test Document

<!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because enable without disable has no effect"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have one MD013 warning
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
}

#[test]
fn test_disable_enable_on_same_line() {
    // Edge case: Both disable and enable on the same line
    let content = r#"# Test Document

<!-- markdownlint-disable MD013 --> <!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because it was enabled on the same line"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // The line after should trigger MD013
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
}

#[test]
fn test_disable_specific_then_all() {
    let content = r#"# Test Document

<!-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled
<!-- markdownlint-disable -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but all rules are disabled
## This would trigger MD025 but all rules are disabled
<!-- markdownlint-enable -->
This is a very long line that exceeds 80 characters and should trigger MD013 because all rules were re-enabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // All warnings should be from line 9 or later
    for warning in &warnings {
        assert!(
            warning.line >= 9,
            "Warning on line {} should have been disabled",
            warning.line
        );
    }
}

#[test]
fn test_disable_all_then_enable_specific() {
    let content = r#"# Test Document

<!-- markdownlint-disable -->
This is a very long line that exceeds 80 characters and would normally trigger MD013 but all rules are disabled
## This would trigger MD025 but all rules are disabled
<!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because MD013 was specifically enabled
## This should still not trigger MD025 because only MD013 was enabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    let md025_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD025"))
        .collect();

    // Should have MD013 warning on line 7
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning, got {}",
        md013_warnings.len()
    );
    assert_eq!(
        md013_warnings[0].line, 7,
        "Expected MD013 on line 7, got line {}",
        md013_warnings[0].line
    );

    // Should not have MD025 warnings
    assert_eq!(
        md025_warnings.len(),
        0,
        "Expected 0 MD025 warnings, got {}",
        md025_warnings.len()
    );
}

#[test]
fn test_comment_inside_code_block() {
    // Comments inside code blocks should not be processed
    let content = r#"# Test Document

```markdown
<!-- markdownlint-disable MD013 -->
This is inside a code block and should not affect rules
```

This is a very long line that exceeds 80 characters and should trigger MD013 because the disable was in a code block"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have MD013 warning
    assert!(!md013_warnings.is_empty(), "Expected MD013 warnings");
}

#[test]
fn test_malformed_comments() {
    // Test that inline config directives without proper spacing are not processed
    // Note: We test that content following malformed markdownlint directives (those without
    // proper spacing) still gets linted. Valid HTML comments are correctly ignored per issue #119.
    let content = r#"# Test Document

<-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because comment has wrong opening

< !-- markdownlint-disable MD013 -->
This is a very long line that exceeds 80 characters and should trigger MD013 because comment has space in opening"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Lines after malformed HTML comments should trigger MD013
    assert!(
        md013_warnings.len() >= 2,
        "Expected at least 2 MD013 warnings, got {}",
        md013_warnings.len()
    );
}

#[test]
fn test_disable_file_all_rules() {
    let content = r#"# Test Document

<!-- markdownlint-disable-file -->

This is a very long line that exceeds 80 characters and would normally trigger MD013 but all rules are disabled for the file
## This would trigger MD025 (multiple top-level headings) but all rules are disabled
Trailing spaces here
[Bad link](http://example.com) (should trigger MD011 but all rules are disabled)"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // Should have no warnings at all
    assert_eq!(warnings.len(), 0, "Expected no warnings, got {}", warnings.len());
}

#[test]
fn test_disable_file_specific_rules() {
    let content = r#"# Test Document

<!-- markdownlint-disable-file MD013 MD009 -->

This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled for the file
# This should still trigger MD025 (multiple top-level headings)
Trailing spaces here  "#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // Should not have MD013 or MD009 warnings
    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();
    let md009_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD009"))
        .collect();

    assert_eq!(md013_warnings.len(), 0, "Expected no MD013 warnings");
    assert_eq!(md009_warnings.len(), 0, "Expected no MD009 warnings");

    // Should have MD025 warning
    let md025_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD025"))
        .collect();
    assert_eq!(md025_warnings.len(), 1, "Expected 1 MD025 warning");
}

#[test]
fn test_enable_file_after_disable() {
    let content = r#"# Test Document

<!-- markdownlint-disable-file MD013 -->
<!-- markdownlint-enable-file MD013 -->

This is a very long line that exceeds 80 characters and should trigger MD013 because it was re-enabled"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    assert_eq!(md013_warnings.len(), 1, "Expected 1 MD013 warning");
}

#[test]
fn test_rumdl_disable_file_syntax() {
    let content = r#"# Test Document

<!-- rumdl-disable-file MD013 -->

This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled using rumdl syntax"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    assert_eq!(md013_warnings.len(), 0, "Expected no MD013 warnings");
}

#[test]
fn test_disable_file_with_inline_enable() {
    let content = r#"# Test Document

<!-- markdownlint-disable-file MD013 -->

This is a very long line that exceeds 80 characters and would normally trigger MD013 but is disabled for the file

<!-- markdownlint-enable MD013 -->
This is a very long line that exceeds 80 characters but file-wide disable takes precedence over inline enable"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // File-wide disable should override inline enable
    assert_eq!(
        md013_warnings.len(),
        0,
        "Expected no MD013 warnings - file-wide disable takes precedence"
    );
}

#[test]
fn test_configure_file_basic() {
    let content = r#"# Test Document

<!-- markdownlint-configure-file { "MD013": { "line_length": 120 } } -->

This is a very long line that exceeds 80 characters but is under 120 characters so should not trigger MD013

This is an extremely long line that exceeds even 120 characters and should trigger MD013 because it's over the configured limit"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have exactly one MD013 warning (line 7 exceeds 120 chars)
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected 1 MD013 warning for line exceeding 120 chars"
    );
    assert_eq!(md013_warnings[0].line, 7);
}

#[test]
fn test_configure_file_multiple_rules() {
    let content = r#"# Test Document

<!-- markdownlint-configure-file { "MD013": { "line_length": 120 }, "MD007": { "indent": 4 } } -->

This is a very long line that exceeds 80 characters but is under 120 characters so should not trigger MD013

* List item 1
  * Nested with 2 spaces (should trigger MD007 since we configured indent to 4)
    * Nested with 4 spaces (should be OK)"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    // Check MD007 warnings
    let md007_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD007"))
        .collect();

    // The test expectation might need adjustment based on how MD007 works with configure-file
    // For now, we're testing that the configuration was parsed
    println!("MD007 warnings: {md007_warnings:?}");
}

#[test]
fn test_rumdl_configure_file_syntax() {
    let content = r#"# Test Document

<!-- rumdl-configure-file { "MD013": { "line_length": 150 } } -->

This is a very long line that exceeds 80 characters and even exceeds 120 characters but is under 150 characters so should not trigger MD013"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have no MD013 warnings as line is under 150 chars
    assert_eq!(md013_warnings.len(), 0, "Expected no MD013 warnings with rumdl syntax");
}

#[test]
fn test_configure_file_invalid_json() {
    let content = r#"# Test Document

<!-- markdownlint-configure-file { invalid json } -->

This is a very long line that exceeds 80 characters and should trigger MD013 because the configure comment had invalid JSON"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have MD013 warning as the invalid JSON config is ignored
    assert_eq!(
        md013_warnings.len(),
        1,
        "Expected MD013 warning when configure-file has invalid JSON"
    );
}

#[test]
fn test_configure_file_with_disable() {
    let content = r#"# Test Document

<!-- markdownlint-configure-file { "MD013": { "line_length": 200 } } -->
<!-- markdownlint-disable-file MD013 -->

This is an extremely long line that exceeds even 200 characters and would normally trigger MD013 even with the configuration but the rule is disabled for the file"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have no warnings as MD013 is disabled for the file
    assert_eq!(
        md013_warnings.len(),
        0,
        "Expected no MD013 warnings when rule is disabled"
    );
}

#[test]
fn test_configure_file_empty_json() {
    let content = r#"# Test Document

<!-- markdownlint-configure-file {} -->

This is a very long line that exceeds 80 characters and should trigger MD013 with default settings"#;

    let rules = all_rules(&Config::default());
    let warnings = lint(
        content,
        &rules,
        false,
        rumdl_lib::config::MarkdownFlavor::Standard,
        None,
        None,
    )
    .unwrap();

    let md013_warnings: Vec<_> = warnings
        .iter()
        .filter(|w| w.rule_name.as_ref().is_some_and(|n| *n == "MD013"))
        .collect();

    // Should have MD013 warning with default 80 char limit
    assert_eq!(md013_warnings.len(), 1, "Expected MD013 warning with empty configure");
}