Skip to content

Markdown support feature for comments#663

Open
rschwietzke wants to merge 3 commits intodevelopfrom
feature/661-markdown-comment
Open

Markdown support feature for comments#663
rschwietzke wants to merge 3 commits intodevelopfrom
feature/661-markdown-comment

Conversation

@rschwietzke
Copy link
Contributor

No description provided.

@rschwietzke rschwietzke added this to the 10.0.0 milestone Feb 26, 2026
@rschwietzke rschwietzke added java Pull requests that update Java code report Change to report or reporting. PRIORITY: NORMAL labels Feb 26, 2026
@socket-security
Copy link

socket-security bot commented Feb 26, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedmaven/​com.vladsch.flexmark/​flexmark@​0.64.83610090100100
Addedmaven/​com.vladsch.flexmark/​flexmark-ext-tables@​0.64.89610090100100
Addedmaven/​com.vladsch.flexmark/​flexmark-ext-autolink@​0.64.810010090100100

View full report

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional Markdown rendering for report comments using a ::markdown:: prefix, styling the output in reports, and documenting the feature.

Changes:

  • Add Markdown-to-HTML conversion for comment values prefixed with ::markdown:: (case-insensitive)
  • Add flexmark-java dependencies and corresponding third-party license/notice entries
  • Add report CSS styling and end-user documentation for Markdown comments

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/java/com/xceptance/xlt/report/providers/ConfigurationReportProvider.java Adds Markdown processing for report comments via flexmark parser/renderer
src/test/java/com/xceptance/xlt/report/providers/ConfigurationReportProviderTest.java Adds unit tests covering Markdown processing behavior
pom.xml Adds flexmark-java dependencies for Markdown rendering
doc/feature-doc/markdown-comments.md Documents how to use ::markdown:: comments and expected behavior
config/testreport/css/default.css Adds styling rules for rendered Markdown blocks in reports
doc/3rd-party-licenses/flexmark-java/NOTICE Adds flexmark-java notice
doc/3rd-party-licenses/flexmark-java/LICENSE Adds flexmark-java license text
NOTICE.md Registers flexmark-java in the project’s notice list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +270 to +276
if (cleanedString.substring(0, MARKDOWN_PREFIX.length()).equalsIgnoreCase(MARKDOWN_PREFIX))
{
final String markdown = cleanedString.substring(MARKDOWN_PREFIX.length());
final String html = MARKDOWN_RENDERER.render(MARKDOWN_PARSER.parse(markdown));
return "<div class=\"markdown\">" + html + "</div>";
}

Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanedString.substring(0, MARKDOWN_PREFIX.length()) will throw StringIndexOutOfBoundsException for any comment shorter than the prefix (e.g., "Hello World" or "Bold", both covered by the new tests). Also, the ::markdown::-only case will be treated as Markdown and wrapped in <div>...</div>, but the test expects it to be returned unchanged. Fix by checking length before slicing and by explicitly handling the “prefix only” case (length equals prefix length). Prefer regionMatches(true, ...) (or a safe length-guarded startsWith-style check) to avoid substringing just to compare.

Suggested change
if (cleanedString.substring(0, MARKDOWN_PREFIX.length()).equalsIgnoreCase(MARKDOWN_PREFIX))
{
final String markdown = cleanedString.substring(MARKDOWN_PREFIX.length());
final String html = MARKDOWN_RENDERER.render(MARKDOWN_PARSER.parse(markdown));
return "<div class=\"markdown\">" + html + "</div>";
}
// If the cleaned string is shorter than the prefix, it cannot start with the prefix
if (cleanedString.length() < MARKDOWN_PREFIX.length())
{
return comment;
}
// Check for case-insensitive prefix match without creating a substring
if (cleanedString.regionMatches(true, 0, MARKDOWN_PREFIX, 0, MARKDOWN_PREFIX.length()))
{
// If the string is exactly the prefix, treat it as a normal comment
if (cleanedString.length() == MARKDOWN_PREFIX.length())
{
return comment;
}
final String markdown = cleanedString.substring(MARKDOWN_PREFIX.length());
final String html = MARKDOWN_RENDERER.render(MARKDOWN_PARSER.parse(markdown));
return "<div class=\"markdown\">" + html + "</div>";
}

Copilot uses AI. Check for mistakes.
Comment on lines +539 to +553
<!-- flexmark-java for Markdown-to-HTML conversion (report comments) -->
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark</artifactId>
<version>0.64.8</version>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-ext-tables</artifactId>
<version>0.64.8</version>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-ext-autolink</artifactId>
<version>0.64.8</version>
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flexmark version is duplicated across multiple dependencies, which makes upgrades/error-prone edits more likely. Consider extracting 0.64.8 into a Maven property (or dependencyManagement) and reference it from each dependency entry.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +33
| Input | Output |
|-------|--------|
| No prefix | Passed through as-is (raw HTML allowed) |
| `::markdown::` + content | Markdown → HTML, wrapped in `<div class="markdown">` |
| `::markdown::` only (no content) | Returned unchanged |
| `null` | Returned as `null` |
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table uses || at line starts, which typically renders as an extra empty column or malformed table in common Markdown renderers (including GFM). Replace with standard pipe table formatting (single leading/trailing |) so the “Behavior” table renders correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +1427 to +1435
.markdown code {
background-color: #f0f0f0;
padding: 0.15em 0.4em;
border-radius: 3px;
font-size: 0.9em;
}
.markdown pre {
background-color: #f5f5f5;
border: 1px solid var(--main-border-color);
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new Markdown styles hardcode colors (#f0f0f0, #f5f5f5, and elsewhere #666), which may conflict with theming and contradict the doc’s claim that styling uses existing CSS custom properties for consistent appearance. Consider switching these to existing CSS variables (or introduce dedicated variables) so Markdown blocks adapt consistently across themes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code PRIORITY: NORMAL report Change to report or reporting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow formatting of comments with Markdown

2 participants