From 7657be401053532bcc750825de788dbeca3fddda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Thu, 23 Apr 2026 14:56:13 -0700 Subject: [PATCH] Add tables to the to-do list for Markdown Javadoc, plus a test illustrating the current mangling. PiperOrigin-RevId: 904650274 --- .../java/JavadocFormattingTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java index 4b3fd3da6..bf7ac1c2d 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -1988,6 +1988,30 @@ class Test {} doFormatTest(input, expected); } + @Test + public void markdownTables() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = +""" +/// | foo | bar | +/// | --- | --- | +/// | baz | qux | +/// +/// - |foo|bar| +/// |--:|:--| +/// |baz|qux| +class Test {} +"""; + // TODO: unmangle the tables + String expected = +""" +/// | foo | bar | | --- | --- | | baz | qux | +/// - |foo|bar| |--:|:--| |baz|qux| +class Test {} +"""; + doFormatTest(input, expected); + } + // TODO: b/346668798 - Test the following Markdown constructs, and make the tests work as needed. // We can assume that the CommonMark parser correctly handles Markdown, so the question is whether // they are subsequently mishandled by our formatting logic. So for example the CommonMark parser @@ -2027,4 +2051,10 @@ class Test {} // // - Autolinks // should be preserved. https://spec.commonmark.org/0.31.2/#autolink + // + // - Tables + // | foo | bar | + // | --- | --- | + // | baz | qux | + // Probably we should just try not to mangle them. https://spec.commonmark.org/0.31.2/#tables }