Repository navigation
Update Markdig to 1.4.2, fix Markdown rendering, and test Native AOT - #5737
Merged
Merged
Conversation
--- updated-dependencies: - dependency-name: Markdig dependency-version: 1.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
This was referenced Oct 20, 2026
…findings 4 and 5)
…s (round 2 finding 7)
tig
approved these changes
Oct 21, 2026
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.
Supersedes #5736.
Markdig 1.4.2 recognizes Markdown structures that exposed gaps in Terminal.Gui's renderer: definition terms and empty list items could disappear, and hard breaks became spaces. The dependency audit also found dropped abbreviation labels and table content corrupted by serializing Markdig's AST and reparsing it with a simpler inline parser.
This PR upgrades Markdig from 1.4.0 to 1.4.2, preserves the parsed content through rendering, and exercises the resulting behavior in a published native AOT executable.
Changes
Rendering and parsing safeguards
TableDatacells as Markdown inline source. Preserve literal syntax with original inline source where possible, leaving harmlesssnake_caseand[1]readable in the default pipeline. Reuse original source spans for custom-pipeline plain cells when the standalone parser preserves their text, styles, and link behavior; ordinary punctuation such asHello, world.stays readable on copy. Keep entity encoding where needed to prevent other extensions from changing literal text, including literal domains becoming autolinks. Respect escaped row boundaries and retain empty cells. Serialize resolved links and images with angle-bracket destinations and their original titles, including spaces, quotes, and pipes. Preserve literal!before links so reparsing does not turn links into images. Unescaped generic attributes remain metadata, matching Markdig; escaped attributes remain visible text.InlineRunrecord properties and verify equality and additional-style round trips.ArgumentException, log a warning with the original exception and lower literal paragraphs through the normal state-reset path, preserving blank source lines. Content invalidation clears old anchors; layout rebuilding repopulates their positions. Recovery resets slugs and caches the parsed result. Markdig 1.4.2 reports nesting failures as genericArgumentException; retaining parse-only recovery without matching its message is intentional. Exceptions from AST lowering remain outside the catch.The existing public
TableDatainterface and standalone string-basedMarkdownTableinput remain available. This PR preserves parsed table content when rendered throughMarkdown; it does not introduce the larger table geometry API.Dependency audit and follow-up
Release-history audit for the Markdig 1.4.2 upgrade
Dependency history
The merged Markdown view first referenced Markdig 0.39.0 in commit
c6d67e362(#4955, 2026-04-17). The subsequent package bump commits below changed only
Directory.Packages.props; they did not add release-specific regression tests.Existing CI coverage alone therefore does not establish coverage of each upstream fix.
0cde267fd(#4989)0c7dee4b4(#5017)8130f52f0676c9ec25491fadafb(#5503)22ef38a6d(#5685)56efec662The May 5 package maintenance commit also mentions Markdig but retains 1.1.3.
The open 1.4.1 dependency PR is not a merged version transition.
Scope and results
Reviewed upstream release notes from 0.39.1 through 1.4.2, relevant parser and
extension source, and upstream regression examples against Terminal.Gui's AST
lowering, table conversion, layout, ANSI rendering, and native smoke app.
The new regression tests exercise Terminal.Gui output and table data; they do
not attempt to duplicate Markdig's entire CommonMark test suite.
AbbreviationInlinelabels. Fixed both normal text and table extraction, with tests for labels before and inside emphasis.LinkHelper.Urilize. Superscripts continue using terminal emphasis rather than raised glyph positioning.Deliberate boundaries and follow-up opportunities
MarkdownPipelinebuilt withUsePipeTables (new PipeTableOptions { UseGfmRules = true }). Integration testsconfirm row padding and truncation. Switching the default would change accepted syntax.
custom pipeline with the corresponding extension options. These are optional
upstream features; this PR does not change the default pipeline.
InferColumnWidthsFromSeparator(0.41.0) produces Markdig column-width metadata,but
TableDatacurrently carries only text and alignment. Honoring those widthsneeds a separate table-sizing API and layout design.
sizing hints and richer table geometry, with design questions and acceptance criteria.
MarkdownTablemodel. The first grid row is displayed as its header. This PRverifies content preservation for the upstream open-cell regression, not full grid fidelity.
Markdownnow carry parsed inline segments through layout,drawing, and link hit testing, preserving code, escaped literals, combined styles,
and original link targets. Their public text representation remains available
for compatibility and clipboard reconstruction. Standalone string-based
MarkdownTableinput uses Markdig inline parsing and the same lowering as AST-backed cells.opt-in; dedicated per-kind colors are not introduced.
FindClosestBlock/FindBlockAtPositionfixes concern reference/footnote groups.Terminal.Gui does not call them and discards the parsed document after lowering.
Source-to-preview navigation would first require retained source mappings.
consumed: Terminal.Gui parses Markdown and renders the AST itself.
Terminal.Gui began with Markdig 0.39.0 and subsequently moved through 1.1.2, 1.1.3, 1.3.0, 1.3.1, 1.3.2, and 1.4.0. The dependency bump commits added no release-specific regression tests. This audit reviews the intervening releases and adds coverage at the parser-to-renderer boundary.
Follow-up #5738 tracks inferred column sizing and richer table layout, including headerless/multiple-header-row grid tables, row/column spans, block content, resize/overflow policy, navigation, selection, and AOT coverage. It includes examples, implementation pointers, design decisions, and acceptance criteria.
Strict GFM tables, CJK-friendly emphasis, emoji shortcodes, and nested alerts remain opt-in pipeline choices. Source-to-preview navigation also remains separate work. Preserving Markdown hard-break syntax in partial paragraph selections remains deferred; hard breaks render correctly, and full-document copying retains the original source.
Validation
POST-GENERATION-VALIDATION.mdchecklist for all changed code, including added-line spacing/brace/whitespace scans and manual review. The PR diff has no added.ToArray ()or.ToList ()calls.NO_COLORunset,TERM=xterm-256color, andCOLORTERM=truecolor.tuirec; verified text and the original activated URL in the asciinema cast and inspected the rendered frame.The recording is retained here as PR evidence, using an immutable historical asset URL; it is no longer part of the source tree.
To pull down this PR locally