To produce a nested comment thread, you first need the comment system to be capable of referring a comment to the ID of a parent comment. This is pretty standard so you likely have that already. Now ...
JEP 467, Markdown Documentation Comments, has been promoted from Proposed to Target to Targeted for JDK 23. This feature proposes to enable JavaDoc documentation comments to be written in Markdown ...