Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass AST model -> HTML Conversion for Markdown Comments #3332

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

rgrunber
Copy link
Contributor

@rgrunber rgrunber commented Nov 22, 2024

  • For JEP 467, JDT parses the markdown comments into the AST Model as a Javadoc node (TagElement & TextElement and Name/MemberRef/MethodRef for links), converting to HTML. JDT-LS converts the HTML back to Markdown using Remark.
  • This bypasses the AST model -> HTML conversion by attempting to render the Javadoc comments directly as Markdown, in part because the content is already (mostly) Markdown

Before
Screenshot from 2024-11-22 16-21-15

After
image

Things left to address :

  • As seen from the screenshot, we introduce a newline after each new /// ..., while I think we should treat consecutive text elements as a continuation. An empty /// is meant to signify a newline IIRC. Update: This can't be done because the AST model doesn't include empty /// lines currently. At least we no longer insert a newline for every now /// line.
  • For some reason links to package declarations don't resolve (eg. java.util but I'm not sure why. Seems a corner case
  • Certain javadoc tags (eg. @see, @throws/@exception are meant to be combined under a single heading, and not listed separately (see screenshot).

@rgrunber rgrunber added the hover label Nov 22, 2024
@rgrunber rgrunber self-assigned this Nov 22, 2024
@rgrunber rgrunber changed the title Bypass Markdown -> HTML Conversion for Markdown Comments Bypass AST model -> HTML Conversion for Markdown Comments Nov 22, 2024
@rgrunber rgrunber added this to the Mid December 2024 milestone Nov 28, 2024
- For JEP 467, JDT parses the markdown comments into the AST Model as a
  Javadoc node (TagElement & TextElement and Name/MemberRef/MethodRef
  for links), converting to HTML. JDT-LS converts the HTML back to
  Markdown using Remark.
- This bypasses the AST model -> HTML conversion by attempting to render
  the Javadoc comments directly as Markdown, in part because the content
  is already (mostly) Markdown

Signed-off-by: Roland Grunberg <[email protected]>
Signed-off-by: Roland Grunberg <[email protected]>
@rgrunber rgrunber marked this pull request as ready for review December 11, 2024 22:22
@rgrunber rgrunber merged commit 39a9fd8 into eclipse-jdtls:master Dec 12, 2024
7 checks passed
@rgrunber rgrunber deleted the skip-html-conv branch December 12, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant