Skip to content

Conversation

@mbien
Copy link
Member

@mbien mbien commented Jan 29, 2026

the browser renders inline snippets as code blocks, lets do the same. turned out to be a problem in the html generator

before:
image

after:
image

fixes #8963

@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) JavaDoc [ci] enable java/javadoc tests and build-javadoc target ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jan 29, 2026
@mbien mbien added this to the NB29 milestone Jan 29, 2026
@neilcsmith-net
Copy link
Member

Why does a <div> need a line break?!

@mbien
Copy link
Member Author

mbien commented Jan 29, 2026

i think thats the wrong question, its more about what NB's html renderer can reliably render, not what divs can do.

@neilcsmith-net
Copy link
Member

Yes, but Swing normally treats div as a block element.

@mbien
Copy link
Member Author

mbien commented Jan 29, 2026

the unclosed <p> from the javadoc is messing with the renderer state. I filtered it out as test and it fixed the divs. Self closing tags like <br/> usually keep working even with broken html. Who knows how well the end tag omission logic was implemented.

@mbien mbien marked this pull request as draft January 30, 2026 00:30
@mbien
Copy link
Member Author

mbien commented Jan 30, 2026

i believe i found the issue. The deprecated section is wrapped in <i> </i>, and the end-tag omission of <p> does only work when no other tags are open i think.

<!DOCTYPE html>
<p><b>Deprecated.</b>
<i>
foo
<p>bar
</i>

is invalid.

@mbien mbien force-pushed the doc-code-blocks_delivery branch from cd3dfdd to bb950d9 Compare January 30, 2026 02:33
@mbien mbien changed the title javadoc renderer: Add newline before and after code snippets javadoc renderer: fix snippet rendering of deprecated sections Jan 30, 2026
@neilcsmith-net
Copy link
Member

Thanks. I suspected something like this and was going to debug it today.

Checked out and tested build of this and seems good to me.

@mbien
Copy link
Member Author

mbien commented Jan 30, 2026

oh nice. even the goto tests are green. The original hotfix would have required to update test data. Even better this way.

@mbien mbien marked this pull request as ready for review January 30, 2026 16:37
italic tags don't mix very well with text sections of unclosed
paragraph tags.
@mbien
Copy link
Member Author

mbien commented Feb 2, 2026

short rebase for CI

@mbien mbien force-pushed the doc-code-blocks_delivery branch from bb950d9 to 669d5d9 Compare February 2, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) JavaDoc [ci] enable java/javadoc tests and build-javadoc target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants