feat: add linkStyle to MarkdownThemeData for customizable link text s… - #22
Closed
inamhusain wants to merge 1 commit into
Closed
feat: add linkStyle to MarkdownThemeData for customizable link text s…#22inamhusain wants to merge 1 commit into
inamhusain wants to merge 1 commit into
Conversation
Collaborator
|
Thank you for this, @inamhusain! 🙏
|
mike-doctorina
pushed a commit
that referenced
this pull request
Jul 29, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mike-doctorina
added a commit
that referenced
this pull request
Jul 30, 2026
…uite + coverage (#23) * feat: GitHub alerts, task lists, table alignment + parser fixes & tests New syntax - GitHub alert blocks (> [!NOTE]/[!TIP]/[!IMPORTANT]/[!WARNING]/[!CAUTION]) via a new MD$Alert block, MD$AlertType, and BlockPainter$Alert. - Task-list items (- [ ] / - [x]) via MD$ListItem.checked/isTask, rendered with a checkbox. - Table column alignment (:---, :--:, ---:) captured on MD$Table.alignments and applied when rendering. - Guarded $...$ inline LaTeX-to-Unicode math (code-span/code-block safe; currency like $5 preserved). Reworks PR #21 into a robust form. Theme - Adopt linkStyle (PR #22) cleanly; add per-type alert colors (alertColors / alertColorFor). - Fix MarkdownThemeData.copyWith dropping builder and onLinkTap. Parser correctness fixes (from an adversarial bug hunt) - Emphasis no longer leaks to end-of-line for stray/unterminated markers (5 * 6 = 30, **oops) and no longer treats intraword _ as emphasis (snake_case, object_id) — CommonMark-inspired flanking + closer checks. - Thematic breaks support ***, ___ and spaced variants; --- no longer greedily swallows trailing text. - ATX headings require a space after #, reject 7+ #, and strip trailing #. - ~~~ fenced code blocks recognized alongside ```. - Emphasis surrounding a link/image is merged onto the link span. - Link/image targets support <url> and single-quoted titles. Tests - Add 153 tests across parser (inline, block, gfm, edge cases), theme, and widget rendering; total suite now 215 and green (was 62). BREAKING: MD$Block.map/maybeMap gain an `alert` branch for MD$Alert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add comprehensive tests for Markdown parser functionality - Introduced a golden characterization test to capture the exact structural output of the Markdown parser, ensuring stability against future changes. - Created a regression test suite targeting edge cases and performance-related changes in the parser, documenting specific behaviors and invariants. - Updated the unit test runner to include new test files for block parsing, inline parsing, GitHub Flavored Markdown (GFM), and edge cases. - Added a variety of test cases covering prose, emphasis, links, images, lists, tables, and more to ensure robust parsing behavior. * feat: make inline LaTeX math opt-in and configurable + improvements Inline `$...$` math is now DISABLED by default, so literal dollar signs (prices like `$5`, shell variables like `$HOME`) are never altered. Enable it with `MarkdownDecoder(inlineMath: true)` or `Markdown.fromString(text, inlineMath: true)`. Improvements to the math feature: - Configurable command table via `mathReplacements`; the defaults are exported as `kMarkdownMathCommands` so callers can extend rather than replace them. - Superscript/subscript conversion: `x^2` -> x², `H_2O` -> H₂O, `x^{10}` -> x¹⁰, `a_i` -> aᵢ. Unmappable runs are left literal. - More commands (implies/iff, perp/parallel, oplus/otimes, hbar/ell, Re/Im, therefore/because, extra arrows and relations). - `\$` is now a recognized escape (literal dollar); an escaped opening `$` never starts a math run, so `\$\alpha\$` stays literal `$\alpha$`. Making math opt-in also speeds up the default parse path (it no longer calls the math pass at all): escapes-heavy text is now ~68% faster than baseline. Tests: new test/parser/math_test.dart (commands, super/subscripts, code protection, escaping, configurability, span integrity). The golden snapshot is regenerated to reflect the new default (only the two math entries changed). Co-authored-by: Fazliddin <faz.ibragimovv@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: credit #22/#21 contributors in changelog Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test: cover phase-1 escape/link edges and unterminated math brace Bring parser.dart line coverage to 99.6% (the remaining two lines are an unreachable defensive branch in the list-traverse). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test: cover nodes, theme, and widget to 100% line coverage Add nodes_test.dart (MD$Style helpers, block type/toString/maybeMap, MD$ListItem/MD$TableRow, Markdown facade), extend theme_test.dart (headingStyleFor, type/toString, MarkdownTheme.of/maybeOf), and add widget_test.dart (context theme fallback in create/updateRenderObject). nodes.dart, markdown.dart, theme.dart, widget.dart now at 100%; parser.dart 99.6%. render.dart left untouched pending its refactor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: expand README (GFM blocks, opt-in math), add codecov; release 0.1.0 - README: document GitHub alerts, task lists, table alignment, thematic breaks and opt-in inline math; refresh feature list and performance section. - Add a Codecov coverage badge and a CI upload step (codecov-action). - Bump version 0.0.9 -> 0.1.0 and retitle the CHANGELOG section. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Mike Matiunin <plugfox@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Fazliddin <faz.ibragimovv@gmail.com>
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.
Working code example.
MarkdownThemeData( linkStyle: getBoldStyle( color: themeState.themeColors.linkColor, ).copyWith(decoration: TextDecoration.underline), ),