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 b965344cf..6a5214d2a 100644 --- a/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java +++ b/core/src/test/java/com/google/googlejavaformat/java/JavadocFormattingTest.java @@ -2652,6 +2652,245 @@ class Test {} doFormatTest(input, expected); } + @Test + public void markdownHtmlListItemFollowedByParagraph() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = + """ + class T { + /// Updates: + ///
  • A single [Foo] + ///
  • One or more [Bar]s + /// + ///

    See [Baz] for more details. + void m() {} + + /// Updates: + ///

  • First item + ///

    Following paragraph without blank line. + void n() {} + } + """; + // Baseline: HTML `

  • ` pushes 4-space indent, turning `

    ` into an indented code block. + String expected = + """ + class T { + /// Updates: + ///

  • A single [Foo] + ///
  • One or more [Bar]s + /// + ///

    See [Baz] for more details. + void m() {} + + /// Updates: + ///

  • First item + /// + ///

    Following paragraph without blank line. + void n() {} + } + """; + doFormatTest(input, expected); + } + + @Test + public void markdownHtmlUnorderedAndDefinitionLists() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = + """ + class T { + /// Intro: + ///

    + /// Following text. + /// + /// + /// + ///
    + ///
    Term + ///
    Definition + /// + ///

    More details. + ///

    + void m() {} + } + """; + // Baseline: HTML list tags push 2+4+ spaces of indentation (turning paragraphs into indented + // code blocks) and join `` onto adjacent lines. + String expected = + """ + class T { + /// Intro: Following text. + /// + /// + /// + ///
    + ///
    Term + ///
    Definition + /// + ///

    More details.

    + void m() {} + } + """; + doFormatTest(input, expected); + } + + @Test + public void markdownNestedHtmlLists() { + assume().that(MARKDOWN_JAVADOC_SUPPORTED).isTrue(); + String input = + """ + class T { + /// Types: + ///
  • + ///
      + ///
    1. First + ///

      Details for first. + ///

    2. Second + ///

      Details for second. + ///

    + void m() {} + + /// Works only if: + ///
  • + ///