issue #7442 : markdown tables not rendered#7443
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #7442 — Markdown preview: GFM table rendering
Recap for code reviewers.
Summary
The Markdown file preview in the Hop file explorer (
MarkDownExplorerFileTypeHandler.previewMarkdown()) did not render GFM pipe tables correctly. Tables appeared as plain paragraphs with literal|characters instead of HTML<table>elements.This change adds the required CommonMark extensions, registers them on the parser and renderer, and adds table-specific CSS for both light and dark mode previews.
Problem
previewMarkdown()used the base CommonMark parser with no extensions:CommonMark core does not support GFM tables. A report such as
retail-dv-initial-report.md(pipe tables with alignment markers like---:) was parsed into eight<p>| ... |</p>blocks and zero<table>elements.Headings, bold text, inline code, and lists rendered correctly; only GFM-specific syntax was broken.
Solution
1. Dependencies (
plugins/transforms/textfile/pom.xml)Three CommonMark extensions were added (all
providedscope, version${commonmark.version}=0.29.0):commonmark-ext-gfm-tablescommonmark-ext-task-list-items- [x]/- [ ]task listscommonmark-ext-footnotes[^1]footnotesThese match the existing pattern for
commonmarkcore in the textfile plugin.2. Extension registration (
MarkDownExplorerFileTypeHandler.java)Extensions are configured once in a static list and passed to both builder instances:
Parser and HtmlRenderer are thread-safe when built this way, so the static list is appropriate.
3. Table CSS in preview HTML
The inline preview stylesheet had no
tablerules. Shared layout rules were added (full width, collapsed borders, padding, rounded corners), plus mode-specific colors:Light mode
#ffffff#f1f5f9#e2e8f0#f8fafcDark mode
#0f172a#1e293b#334155#111827Colors follow the existing slate palette already used for body, code blocks, and blockquotes.
Files changed
plugins/transforms/textfile/pom.xmlplugins/transforms/textfile/src/main/java/.../MarkDownExplorerFileTypeHandler.javaDiff size: 2 files, +71 / −2 lines.
Review focus
providedscope likecommonmarkcore. Confirm they are bundled into the Hop client distribution at runtime (same mechanism as the existingcommonmarkdependency via the textfile plugin).LICENSEfile may need entries for the three new extension artifacts (currently onlycommonmarkcore is listed).DocBuilder.markdownToHtml()inplugins/misc/documentationstill uses the bare parser and would have the same table limitation if HTML doc generation is expected to handle GFM tables.MarkDownExplorerFileTypeTestcovers file-type metadata only, not preview rendering. Consider whether a small unit test asserting<table>output for a pipe-table snippet is worth adding in a follow-up.Manual verification
.mdfile with GFM tables (e.g. a data-vault load report).Out of scope / known limitations
commonmark-ext-autolinkorcommonmark-ext-gfm-strikethrough— bare URLs and~~strikethrough~~still render as literal text.ul/ollist styling added (lists were already readable).