1use crate::rule::{LintError, LintResult, LintWarning, Rule, RuleCategory, Severity};
2use crate::utils::range_utils::calculate_line_range;
3use crate::utils::table_utils::{TableBlock, TableUtils};
4
5mod md055_config;
6use md055_config::MD055Config;
7
8#[derive(Debug, Default, Clone)]
81pub struct MD055TablePipeStyle {
82 config: MD055Config,
83}
84
85impl MD055TablePipeStyle {
86 pub fn new(style: String) -> Self {
87 Self {
88 config: MD055Config { style },
89 }
90 }
91
92 pub fn from_config_struct(config: MD055Config) -> Self {
93 Self { config }
94 }
95
96 fn determine_table_style(&self, table_block: &TableBlock, lines: &[&str]) -> Option<&'static str> {
98 let mut leading_and_trailing_count = 0;
99 let mut no_leading_or_trailing_count = 0;
100 let mut leading_only_count = 0;
101 let mut trailing_only_count = 0;
102
103 let header_content = TableUtils::extract_table_row_content(lines[table_block.header_line], table_block, 0);
105 if let Some(style) = TableUtils::determine_pipe_style(header_content) {
106 match style {
107 "leading_and_trailing" => leading_and_trailing_count += 1,
108 "no_leading_or_trailing" => no_leading_or_trailing_count += 1,
109 "leading_only" => leading_only_count += 1,
110 "trailing_only" => trailing_only_count += 1,
111 _ => {}
112 }
113 }
114
115 for (i, &line_idx) in table_block.content_lines.iter().enumerate() {
117 let content = TableUtils::extract_table_row_content(lines[line_idx], table_block, 2 + i);
118 if let Some(style) = TableUtils::determine_pipe_style(content) {
119 match style {
120 "leading_and_trailing" => leading_and_trailing_count += 1,
121 "no_leading_or_trailing" => no_leading_or_trailing_count += 1,
122 "leading_only" => leading_only_count += 1,
123 "trailing_only" => trailing_only_count += 1,
124 _ => {}
125 }
126 }
127 }
128
129 let max_count = leading_and_trailing_count
132 .max(no_leading_or_trailing_count)
133 .max(leading_only_count)
134 .max(trailing_only_count);
135
136 if max_count > 0 {
137 if leading_and_trailing_count == max_count {
138 Some("leading_and_trailing")
139 } else if no_leading_or_trailing_count == max_count {
140 Some("no_leading_or_trailing")
141 } else if leading_only_count == max_count {
142 Some("leading_only")
143 } else if trailing_only_count == max_count {
144 Some("trailing_only")
145 } else {
146 None
147 }
148 } else {
149 None
150 }
151 }
152
153 #[cfg(test)]
155 fn fix_table_row(&self, line: &str, target_style: &str) -> String {
156 let dummy_block = TableBlock {
157 start_line: 0,
158 end_line: 0,
159 header_line: 0,
160 delimiter_line: 0,
161 content_lines: vec![],
162 list_context: None,
163 };
164 self.fix_table_row_with_context(line, target_style, &dummy_block, 0)
165 }
166
167 fn fix_table_row_with_context(
172 &self,
173 line: &str,
174 target_style: &str,
175 table_block: &TableBlock,
176 table_line_index: usize,
177 ) -> String {
178 let (bq_prefix, after_bq) = TableUtils::extract_blockquote_prefix(line);
180
181 if let Some(ref list_ctx) = table_block.list_context {
183 if table_line_index == 0 {
184 let stripped = after_bq
186 .strip_prefix(&list_ctx.list_prefix)
187 .unwrap_or_else(|| TableUtils::extract_list_prefix(after_bq).1);
188 let fixed_content = self.fix_table_content(stripped.trim(), target_style);
189
190 let lp = &list_ctx.list_prefix;
192 if bq_prefix.is_empty() && lp.is_empty() {
193 fixed_content
194 } else {
195 format!("{bq_prefix}{lp}{fixed_content}")
196 }
197 } else {
198 let content_indent = list_ctx.content_indent;
200 let stripped = TableUtils::extract_table_row_content(line, table_block, table_line_index);
201 let fixed_content = self.fix_table_content(stripped.trim(), target_style);
202
203 let indent = " ".repeat(content_indent);
205 format!("{bq_prefix}{indent}{fixed_content}")
206 }
207 } else {
208 let fixed_content = self.fix_table_content(after_bq.trim(), target_style);
210 if bq_prefix.is_empty() {
211 fixed_content
212 } else {
213 format!("{bq_prefix}{fixed_content}")
214 }
215 }
216 }
217
218 fn fix_table_content(&self, trimmed: &str, target_style: &str) -> String {
220 if !trimmed.contains('|') {
221 return trimmed.to_string();
222 }
223
224 let has_leading = trimmed.starts_with('|');
225 let has_trailing = trimmed.ends_with('|');
226
227 match target_style {
228 "leading_and_trailing" => {
229 let mut result = trimmed.to_string();
230
231 if !has_leading {
233 result = format!("| {result}");
234 }
235
236 if !has_trailing {
238 result = format!("{result} |");
239 }
240
241 result
242 }
243 "no_leading_or_trailing" => {
244 let mut result = trimmed;
245
246 if has_leading {
248 result = result.strip_prefix('|').unwrap_or(result);
249 result = result.trim_start();
250 }
251
252 if has_trailing {
254 result = result.strip_suffix('|').unwrap_or(result);
255 result = result.trim_end();
256 }
257
258 result.to_string()
259 }
260 "leading_only" => {
261 let mut result = trimmed.to_string();
262
263 if !has_leading {
265 result = format!("| {result}");
266 }
267
268 if has_trailing {
270 result = result.strip_suffix('|').unwrap_or(&result).trim_end().to_string();
271 }
272
273 result
274 }
275 "trailing_only" => {
276 let mut result = trimmed;
277
278 if has_leading {
280 result = result.strip_prefix('|').unwrap_or(result).trim_start();
281 }
282
283 let mut result = result.to_string();
284
285 if !has_trailing {
287 result = format!("{result} |");
288 }
289
290 result
291 }
292 _ => trimmed.to_string(),
293 }
294 }
295}
296
297impl Rule for MD055TablePipeStyle {
298 fn name(&self) -> &'static str {
299 "MD055"
300 }
301
302 fn description(&self) -> &'static str {
303 "Table pipe style should be consistent"
304 }
305
306 fn category(&self) -> RuleCategory {
307 RuleCategory::Table
308 }
309
310 fn should_skip(&self, ctx: &crate::lint_context::LintContext) -> bool {
311 !ctx.likely_has_tables()
313 }
314
315 fn check(&self, ctx: &crate::lint_context::LintContext) -> LintResult {
316 let line_index = &ctx.line_index;
317 let mut warnings = Vec::new();
318
319 let lines = ctx.raw_lines();
322
323 let configured_style = match self.config.style.as_str() {
325 "leading_and_trailing" | "no_leading_or_trailing" | "leading_only" | "trailing_only" | "consistent" => {
326 self.config.style.as_str()
327 }
328 _ => {
329 "leading_and_trailing"
331 }
332 };
333
334 let table_blocks = &ctx.table_blocks;
336
337 for table_block in table_blocks {
339 let table_style = if configured_style == "consistent" {
342 self.determine_table_style(table_block, lines)
343 } else {
344 None
345 };
346
347 let target_style = if configured_style == "consistent" {
349 table_style.unwrap_or("leading_and_trailing")
350 } else {
351 configured_style
352 };
353
354 let all_line_indices: Vec<usize> = std::iter::once(table_block.header_line)
356 .chain(std::iter::once(table_block.delimiter_line))
357 .chain(table_block.content_lines.iter().copied())
358 .collect();
359
360 for (table_line_idx, &line_idx) in all_line_indices.iter().enumerate() {
364 let line = lines[line_idx];
365 let content = TableUtils::extract_table_row_content(line, table_block, table_line_idx);
367 if let Some(current_style) = TableUtils::determine_pipe_style(content) {
368 let needs_fixing = current_style != target_style;
370
371 if needs_fixing {
372 let (start_line, start_col, end_line, end_col) = calculate_line_range(line_idx + 1, line);
373
374 let message = format!(
375 "Table pipe style should be {}",
376 match target_style {
377 "leading_and_trailing" => "leading and trailing",
378 "no_leading_or_trailing" => "no leading or trailing",
379 "leading_only" => "leading only",
380 "trailing_only" => "trailing only",
381 _ => target_style,
382 }
383 );
384
385 let fixed_line =
388 self.fix_table_row_with_context(line, target_style, table_block, table_line_idx);
389 let row_range =
390 line_index.line_col_to_byte_range_with_length(line_idx + 1, 1, line.chars().count());
391
392 warnings.push(LintWarning {
393 rule_name: Some(self.name().to_string()),
394 severity: Severity::Warning,
395 message,
396 line: start_line,
397 column: start_col,
398 end_line,
399 end_column: end_col,
400 fix: Some(crate::rule::Fix::new(row_range, fixed_line)),
401 });
402 }
403 }
404 }
405 }
406
407 Ok(warnings)
408 }
409
410 fn fix(&self, ctx: &crate::lint_context::LintContext) -> Result<String, LintError> {
411 if self.should_skip(ctx) {
412 return Ok(ctx.content.to_string());
413 }
414 let warnings = self.check(ctx)?;
415 if warnings.is_empty() {
416 return Ok(ctx.content.to_string());
417 }
418 let warnings =
419 crate::utils::fix_utils::filter_warnings_by_inline_config(warnings, ctx.inline_config(), self.name());
420 crate::utils::fix_utils::apply_warning_fixes(ctx.content, &warnings).map_err(LintError::InvalidInput)
421 }
422
423 fn as_any(&self) -> &dyn std::any::Any {
424 self
425 }
426
427 fn default_config_section(&self) -> Option<(String, toml::Value)> {
428 let json_value = serde_json::to_value(&self.config).ok()?;
429 Some((
430 self.name().to_string(),
431 crate::rule_config_serde::json_to_toml_value(&json_value)?,
432 ))
433 }
434
435 fn from_config(config: &crate::config::Config) -> Box<dyn Rule>
436 where
437 Self: Sized,
438 {
439 let rule_config = crate::rule_config_serde::load_rule_config::<MD055Config>(config);
440 Box::new(Self::from_config_struct(rule_config))
441 }
442}
443
444#[cfg(test)]
445mod tests {
446 use super::*;
447
448 #[test]
449 fn test_md055_delimiter_row_handling() {
450 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
452
453 let content = "| Header 1 | Header 2 | Header 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |";
454 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
455 let result = rule.fix(&ctx).unwrap();
456
457 let expected = "Header 1 | Header 2 | Header 3\n----------|----------|----------\nData 1 | Data 2 | Data 3";
460
461 assert_eq!(result, expected);
462
463 let warnings = rule.check(&ctx).unwrap();
465 let delimiter_warning = &warnings[1]; assert_eq!(delimiter_warning.line, 2);
467 assert_eq!(
468 delimiter_warning.message,
469 "Table pipe style should be no leading or trailing"
470 );
471
472 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
474
475 let content = "Header 1 | Header 2 | Header 3\n----------|----------|----------\nData 1 | Data 2 | Data 3";
476 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
477 let result = rule.fix(&ctx).unwrap();
478
479 let expected = "| Header 1 | Header 2 | Header 3 |\n| ----------|----------|---------- |\n| Data 1 | Data 2 | Data 3 |";
482
483 assert_eq!(result, expected);
484 }
485
486 #[test]
487 fn test_md055_check_finds_delimiter_row_issues() {
488 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
490
491 let content = "| Header 1 | Header 2 | Header 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |";
492 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
493 let warnings = rule.check(&ctx).unwrap();
494
495 assert_eq!(warnings.len(), 3);
497
498 let delimiter_warning = &warnings[1];
500 assert_eq!(delimiter_warning.line, 2);
501 assert_eq!(
502 delimiter_warning.message,
503 "Table pipe style should be no leading or trailing"
504 );
505 }
506
507 #[test]
508 fn test_md055_real_world_example() {
509 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
511
512 let content = "# Table Example\n\nHere's a table with leading and trailing pipes:\n\n| Header 1 | Header 2 | Header 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |\n| Data 4 | Data 5 | Data 6 |\n\nMore content after the table.";
513 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
514 let result = rule.fix(&ctx).unwrap();
515
516 let expected = "# Table Example\n\nHere's a table with leading and trailing pipes:\n\nHeader 1 | Header 2 | Header 3\n----------|----------|----------\nData 1 | Data 2 | Data 3\nData 4 | Data 5 | Data 6\n\nMore content after the table.";
519
520 assert_eq!(result, expected);
521
522 let warnings = rule.check(&ctx).unwrap();
524 assert_eq!(warnings.len(), 4); assert_eq!(warnings[0].line, 5); assert_eq!(warnings[1].line, 6); assert_eq!(warnings[2].line, 7); assert_eq!(warnings[3].line, 8); }
532
533 #[test]
534 fn test_md055_invalid_style() {
535 let rule = MD055TablePipeStyle::new("leading_or_trailing".to_string()); let content = "| Header 1 | Header 2 | Header 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |";
539 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
540 let result = rule.fix(&ctx).unwrap();
541
542 let expected = "| Header 1 | Header 2 | Header 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |";
545
546 assert_eq!(result, expected);
547
548 let content = "Header 1 | Header 2 | Header 3\n----------|----------|----------\nData 1 | Data 2 | Data 3";
550 let ctx2 = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
551 let result = rule.fix(&ctx2).unwrap();
552
553 let expected = "| Header 1 | Header 2 | Header 3 |\n| ----------|----------|---------- |\n| Data 1 | Data 2 | Data 3 |";
556 assert_eq!(result, expected);
557
558 let warnings = rule.check(&ctx2).unwrap();
560
561 assert_eq!(warnings.len(), 3);
564 }
565
566 #[test]
567 fn test_underflow_protection() {
568 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
570
571 let result = rule.fix_table_row("", "leading_and_trailing");
573 assert_eq!(result, "");
574
575 let result = rule.fix_table_row("no pipes here", "leading_and_trailing");
577 assert_eq!(result, "no pipes here");
578
579 let result = rule.fix_table_row("|", "leading_and_trailing");
581 assert!(!result.is_empty());
583 }
584
585 #[test]
588 fn test_fix_table_row_in_blockquote() {
589 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
590
591 let result = rule.fix_table_row("> H1 | H2", "leading_and_trailing");
593 assert_eq!(result, "> | H1 | H2 |");
594
595 let result = rule.fix_table_row("> | H1 | H2 |", "leading_and_trailing");
597 assert_eq!(result, "> | H1 | H2 |");
598
599 let result = rule.fix_table_row("> | H1 | H2 |", "no_leading_or_trailing");
601 assert_eq!(result, "> H1 | H2");
602 }
603
604 #[test]
605 fn test_fix_table_row_in_nested_blockquote() {
606 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
607
608 let result = rule.fix_table_row(">> H1 | H2", "leading_and_trailing");
610 assert_eq!(result, ">> | H1 | H2 |");
611
612 let result = rule.fix_table_row(">>> H1 | H2", "leading_and_trailing");
614 assert_eq!(result, ">>> | H1 | H2 |");
615 }
616
617 #[test]
618 fn test_blockquote_table_full_document() {
619 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
620
621 let content = "> H1 | H2\n> ----|----\n> a | b";
623 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
624 let result = rule.fix(&ctx).unwrap();
625
626 assert!(
629 result.starts_with("> |"),
630 "Header should start with blockquote + pipe. Got:\n{result}"
631 );
632 assert!(
634 result.contains("> | ----"),
635 "Delimiter should have blockquote prefix + leading pipe. Got:\n{result}"
636 );
637 }
638
639 #[test]
640 fn test_blockquote_table_no_leading_trailing() {
641 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
642
643 let content = "> | H1 | H2 |\n> |----|----|---|\n> | a | b |";
645 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
646 let result = rule.fix(&ctx).unwrap();
647
648 let lines: Vec<&str> = result.lines().collect();
650 assert!(lines[0].starts_with("> "), "Line should start with blockquote prefix");
651 assert!(
652 !lines[0].starts_with("> |"),
653 "Leading pipe should be removed. Got: {}",
654 lines[0]
655 );
656 }
657
658 #[test]
659 fn test_mixed_regular_and_blockquote_tables() {
660 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
661
662 let content = "H1 | H2\n---|---\na | b\n\n> H3 | H4\n> ---|---\n> c | d";
664 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
665 let result = rule.fix(&ctx).unwrap();
666
667 assert!(result.contains("| H1 | H2 |"), "Regular table should have pipes added");
669 assert!(
670 result.contains("> | H3 | H4 |"),
671 "Blockquote table should have pipes added with prefix preserved"
672 );
673 }
674
675 fn assert_fix_roundtrip(rule: &MD055TablePipeStyle, content: &str) {
678 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
679 let fixed = rule.fix(&ctx).unwrap();
680 let ctx2 = crate::lint_context::LintContext::new(&fixed, crate::config::MarkdownFlavor::Standard, None);
681 let remaining = rule.check(&ctx2).unwrap();
682 assert!(
683 remaining.is_empty(),
684 "After fix(), check() should find 0 violations.\nOriginal: {content:?}\nFixed: {fixed:?}\nRemaining: {remaining:?}"
685 );
686 }
687
688 #[test]
689 fn test_roundtrip_leading_and_trailing() {
690 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
691 assert_fix_roundtrip(&rule, "H1 | H2\n---|---\na | b");
692 }
693
694 #[test]
695 fn test_roundtrip_no_leading_or_trailing() {
696 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
697 assert_fix_roundtrip(&rule, "| H1 | H2 |\n|---|---|\n| a | b |");
698 }
699
700 #[test]
701 fn test_roundtrip_consistent_mode() {
702 let rule = MD055TablePipeStyle::default();
703 assert_fix_roundtrip(&rule, "| H1 | H2 |\n|---|---|\nCell 1 | Cell 2");
704 }
705
706 #[test]
707 fn test_roundtrip_blockquote_table() {
708 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
709 assert_fix_roundtrip(&rule, "> H1 | H2\n> ---|---\n> a | b");
710 }
711
712 #[test]
713 fn test_roundtrip_mixed_tables() {
714 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
715 assert_fix_roundtrip(&rule, "H1 | H2\n---|---\na | b\n\n> H3 | H4\n> ---|---\n> c | d");
716 }
717
718 #[test]
719 fn test_roundtrip_with_surrounding_content() {
720 let rule = MD055TablePipeStyle::new("no_leading_or_trailing".to_string());
721 assert_fix_roundtrip(&rule, "# Title\n\n| H1 | H2 |\n|---|---|\n| a | b |\n\nMore text.");
722 }
723
724 #[test]
725 fn test_roundtrip_clean_content() {
726 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
727 assert_fix_roundtrip(&rule, "| H1 | H2 |\n|---|---|\n| a | b |");
728 }
729
730 #[test]
747 fn md055_pandoc_grid_tables_not_flagged() {
748 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
749 let content = "\
750+---+---+
751| a | b |
752+===+===+
753| 1 | 2 |
754+---+---+
755";
756 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Pandoc, None);
759 let result = rule.check(&ctx).unwrap();
760 assert!(
761 result.is_empty(),
762 "MD055 should not flag Pandoc grid tables (excluded by table_blocks): {result:?}"
763 );
764
765 let ctx_std = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
768 let result_std = rule.check(&ctx_std).unwrap();
769 assert!(
770 result_std.is_empty(),
771 "MD055 should not flag grid-table-like content under Standard either: {result_std:?}"
772 );
773 }
774
775 #[test]
776 fn md055_pandoc_multi_line_tables_not_flagged() {
777 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
778 let content = "\
780--------- ----------- ------
781Header 1 Header 2 Header 3
782--------- ----------- ------
783Cell 1 Cell 2 Cell 3
784--------- ----------- ------
785";
786 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Pandoc, None);
787 let result = rule.check(&ctx).unwrap();
788 assert!(
789 result.is_empty(),
790 "MD055 should not flag Pandoc multi-line tables: {result:?}"
791 );
792
793 let ctx_std = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
794 let result_std = rule.check(&ctx_std).unwrap();
795 assert!(
796 result_std.is_empty(),
797 "MD055 should not flag multi-line table content under Standard: {result_std:?}"
798 );
799 }
800
801 #[test]
802 fn md055_pandoc_line_blocks_not_flagged() {
803 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
804 let content = "| First line\n| Second line\n";
807 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Pandoc, None);
808 let result = rule.check(&ctx).unwrap();
809 assert!(
810 result.is_empty(),
811 "MD055 should not treat Pandoc line blocks as tables: {result:?}"
812 );
813
814 let ctx_std = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
815 let result_std = rule.check(&ctx_std).unwrap();
816 assert!(
817 result_std.is_empty(),
818 "MD055 should not treat line-block-like content as tables under Standard: {result_std:?}"
819 );
820 }
821
822 #[test]
823 fn md055_pandoc_pipe_table_captions_not_flagged() {
824 let rule = MD055TablePipeStyle::new("leading_and_trailing".to_string());
825 let content = "\
828| H1 | H2 |
829|----|-----|
830| a | b |
831
832: My table caption
833";
834 let ctx = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Pandoc, None);
835 let result = rule.check(&ctx).unwrap();
836 assert!(
837 result.is_empty(),
838 "MD055 should not flag the pipe-table caption line: {result:?}"
839 );
840
841 let ctx_std = crate::lint_context::LintContext::new(content, crate::config::MarkdownFlavor::Standard, None);
843 let result_std = rule.check(&ctx_std).unwrap();
844 assert!(
845 result_std.is_empty(),
846 "MD055 already-valid table with caption should have no warnings under Standard: {result_std:?}"
847 );
848 }
849}