From bd4988be2b67f11e10bb6a1347ae01a34fa0b5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 27 Jul 2026 18:33:00 -0700 Subject: [PATCH] Add a test that illustrates a problem with +4 indentation for block tags in Markdown Javadoc comments. PiperOrigin-RevId: 954947047 --- .../java/JavadocFormattingTest.java | 32 +++++++++++++++++++ 1 file changed, 32 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 967adf2fd..fcb4e7d53 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -1965,6 +1965,38 @@ class Test {} doFormatTest(input, expected); } + @Test + public void markdownBlockTagContinuationLines() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = +""" +/// Something something something. +/// +/// @param foo a parameter with a long description that will need to be wrapped onto multiple +/// lines, with each line being indented by the default amount for continuation +/// lines in a block tag. +/// +/// There is even a second paragraph which illustrates why the indentation should be +2 +/// rather than +4. +record Test(String foo) {} +"""; + // TODO(b/537488642): continuation lines should be +2 to avoid the bug here. + // The four-space indentation leads to the second paragraph being interpreted as a code block. + String expected = +""" +/// Something something something. +/// +/// @param foo a parameter with a long description that will need to be wrapped onto multiple lines, +/// with each line being indented by the default amount for continuation lines in a block tag. +/// +/// There is even a second paragraph which illustrates why the indentation should be +2 rather +/// than +4. +record Test(String foo) {} +"""; + + doFormatTest(input, expected); + } + @Test public void markdownLinkReferenceDefinitions() { assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue();