Repository navigation
Avoid indenting HTML lists in Markdown Javadoc. - #1545
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_1028886735
branch
from
November 26, 2026 14:32
58994c4 to
7fe6923
Compare
In `///` Markdown Javadoc comments, HTML list tags (`<ul>`, `<ol>`, `<dl>`, `<li>`, `<dt>`, `<dd>`) do not establish CommonMark container blocks; they start Type 6 HTML blocks that end at the next blank line. Pushing 2-space `ListIndent` and 4+-space `ListItemIndent` causes subsequent paragraphs, `<p>`, or `<table>` blocks after a blank line to reach 4+ columns of indentation, turning them into CommonMark indented code blocks (which disables inline tags and Markdown links and breaks re-formatting). HTML list tags inside Markdown lists could also interfere with the enclosing Markdown list's indentation stack.
In `JavadocWriter`, handle HTML list open, close, and item tags in Markdown Javadoc without modifying `indentStack` or `continuingListItemOfInnermostList`. Request a newline before HTML list open tags when not already at the start of a line (so `<li><ol>` and `<li><ul>` remain on one line while inline lists like `Intro <ul><li>a</ul> trailing.` split onto separate lines), and request newlines around HTML list close tags and after open tags. Inside block tags (2-space continuation indent), flattening `<li>` from 4+ spaces to 2 spaces means `<li>` starts a standard Type 6 HTML block rather than a paragraph continuation line, so Markdown `[link]` syntax inside HTML list items renders literally (consistent with body text and Markdown list items; `{@link ...}` still works).
PiperOrigin-RevId: 1030659593
copybara-service
Bot
force-pushed
the
test_1028886735
branch
from
November 26, 2026 14:37
7fe6923 to
09ed9c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoid indenting HTML lists in Markdown Javadoc.
In
///Markdown Javadoc comments, HTML list tags (<ul>,<ol>,<dl>,<li>,<dt>,<dd>) do not establish CommonMark container blocks; they start Type 6 HTML blocks that end at the next blank line. Pushing 2-spaceListIndentand 4+-spaceListItemIndentcauses subsequent paragraphs,<p>, or<table>blocks after a blank line to reach 4+ columns of indentation, turning them into CommonMark indented code blocks (which disables inline tags and Markdown links and breaks re-formatting). HTML list tags inside Markdown lists could also interfere with the enclosing Markdown list's indentation stack.In
JavadocWriter, handle HTML list open, close, and item tags in Markdown Javadoc without modifyingindentStackorcontinuingListItemOfInnermostList. Request a newline before HTML list open tags when not already at the start of a line (so<li><ol>and<li><ul>remain on one line while inline lists likeIntro <ul><li>a</ul> trailing.split onto separate lines), and request newlines around HTML list close tags and after open tags. Inside block tags (2-space continuation indent), flattening<li>from 4+ spaces to 2 spaces means<li>starts a standard Type 6 HTML block rather than a paragraph continuation line, so Markdown[link]syntax inside HTML list items renders literally (consistent with body text and Markdown list items;{@link ...}still works).