Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

TypeSpec documentation uses Markdown formatting (**bold**, *italic*, bullet points, numbered lists) that needs to be converted to JavaDoc HTML tags for proper rendering.

Changes

  • Added markdown conversion in JavaJavadocComment.java

    • **text**<b>text</b>
    • *text*<i>text</i>
    • ***text***<b><i>text</i></b>
    • Lines starting with - <ul><li> elements
    • Lines starting with N. <ol><li> elements
  • Implementation approach

    • Regex patterns for inline formatting (bold, italic, bold-italic)
    • Line-by-line parsing for list detection with proper nesting
    • XML escaping applied before markdown conversion to preserve user content safety
    • HTML tags generated after escaping to avoid double-encoding

Known Issue

HTML tags are currently being escaped as &lt; and &gt; in generated files. The conversion logic is correct (verified via standalone test), but an additional layer of escaping occurs during file writing or post-processing. Investigation shows this is likely in the protocol layer between the Java generator and TypeSpec compiler. Further debugging needed to identify and fix the escaping source.

Example

Input from TypeSpec:

/**
 * This operation supports:
 * - Simple **bold** text
 * - *Italic* formatting
 * - Combined ***bold italic***
 */

Expected JavaDoc output:

/**
 * This operation supports:
 * <ul>
 * <li>Simple <b>bold</b> text</li>
 * <li><i>Italic</i> formatting</li>
 * <li>Combined <b><i>bold italic</i></b></li>
 * </ul>
 */
Original prompt

This section details on the original issue you should resolve

<issue_title>Support documentation formating for Javadoc</issue_title>
<issue_description>To support this test case: https://github.com/microsoft/typespec/pull/8929/files

Java doc should support bullet points, number list, bold and italic styles written in the case.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 13, 2026 06:34
- Added support for converting **bold** to <b>bold</b>
- Added support for converting *italic* to <i>italic</i>
- Added support for converting ***bold italic*** to <b><i>bold italic</i></b>
- Added support for converting bullet lists (- item) to <ul><li>
- Added support for converting numbered lists (1. item) to <ol><li>

Co-authored-by: haolingdong-msft <87355844+haolingdong-msft@users.noreply.github.com>
…ping

The HTML tags generated by markdown conversion were being escaped. Investigation showed the conversion logic is correct, but there may be additional escaping happening in the file writing or protocol layer that needs further investigation.

Co-authored-by: haolingdong-msft <87355844+haolingdong-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Javadoc formatting styles Add markdown-to-JavaDoc formatting conversion for documentation comments Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support documentation formating for Javadoc

2 participants