You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Javadoc: do not insert a <p> tag before a <div> that follows a blank line #268
google-java-format#1534 (open, opened 2026-11-22, the author has not yet signed the CLA) stops the Javadoc formatter from adding <p> in front of a <div> block. The lexer gets a new blank-line token for a blank line that directly precedes a <div> start tag, so the blank line is kept and no paragraph tag is inferred. It only applies to classic (non-Markdown) Javadoc, outside <pre> and block tags. The PR says it fixes upstream issue 1180, which is not in our data. <div-custom>, <span> and plain text keep getting <p> as before.
Why it matters: a <p> directly in front of a block-level <div> is invalid HTML and makes doclint complain. Our inferParagraphTags in the Javadoc lexer has the same rule as upstream (literal, blank line, literal gives <p>), and a <div> start tag is an ordinary literal for us, so we very likely produce the same output. I did not run our formatter, so "Before" below is derived from reading the code.
Before (how it is formatted today, derived from our inferParagraphTags):
open-java-format/src/main/java/com/palantir/javaformat/java/javadoc/Token.java and JavadocWriter.java (the PR adds a token type and widens the visibility of requestBlankLine)
Our Javadoc lexer is not a record/pattern-switch design like upstream's, so the diff will not apply as is. The idea ports easily: recognise a blank line followed by <div and skip the inferred <p>.
Suggested action: watch the PR (the CLA problem and review may change it), then adopt-the-idea with our own test if it is merged or if a user reports the <p><div> output.
Filed from an upstream-watch ticket after manual review.
Activity