Skip to content

Merge xVanTuring's GFM features + local bug fixes#37

Open
luca-chen198 wants to merge 6 commits into
mainfrom
feature/gfm-reintroduce
Open

Merge xVanTuring's GFM features + local bug fixes#37
luca-chen198 wants to merge 6 commits into
mainfrom
feature/gfm-reintroduce

Conversation

@luca-chen198
Copy link
Copy Markdown
Collaborator

Summary

Re-introduces @xVanTuring's CommonMark/GFM feature contributions from his fork (https://github.com/xVanTuring/swift-markdown-engine/tree/main) together with local follow-up bug fixes.

The original merge was performed and pushed prematurely (commit 2ad2dee), then reverted (1988aac) so we could land it through a proper review workflow. This PR re-applies the same changes via a "revert the revert" commit. xVanTuring's original per-commit attribution is preserved in the git history (reachable through 2ad2dee).

From xVanTuring's branch (22 commits)

  • Block syntax: GFM tables, blockquotes with nested bars, full-width thematic breaks, Setext headings
  • Inline syntax: ~~strikethrough~~, _italic_ / __bold__, N-backtick code spans, CommonMark backslash escapes, ![alt](url) markdown image links
  • Lists: marker normalization for -/*/+, space-indented nested bullets, backspace-restore on empty -
  • ~8 rendering/styling fixes: emphasis-in-code containment, inline-code backticks active, table → child active propagation, code-block background scope, task-checkbox boundary restyle, wrapped block-image anchoring, image-provider fingerprint mutation, redundant NSValue cast

Local follow-ups (commit 76bad45)

  • HR/blockquote: NSRangeException bounds-guard against TextKit's synthetic trailing line fragment (crash on Enter)
  • HR: drop physical source expansion (was inserting 119 dashes); drop Setext support (was absorbing the last table row as H2 underline)
  • HR: reveal raw source when caret enters the HR line
  • Tables: skip inline LaTeX styling for $...$ inside a table — the stray .latexImage tag was drawing a tiny image as a dot on the collapsed source line
  • Blockquote Enter: list-style continuation on Enter, exit on empty marker (mirrors bullet-list UX)
  • Refactor: extract removeLinePrefixAndExit helper, shared by list-exit and quote-exit

Test plan

  • GFM conformance sweep from xVanTuring's issue rendered correctly
  • Tables: render correctness, caret in/out, LaTeX in cells, inline code in cells, no stray dot below
  • Blockquotes: nested levels (>, >>, >>>), Enter continuation, Enter on empty exits without crash
  • HR: all three forms (---, ***, ___); Enter on HR line doesn't crash; click on HR reveals raw source
  • Strikethrough, underscore emphasis, backslash escapes
  • Image links (![alt](url))
  • Regression check: existing bullet/numbered lists still work; existing tasks ([ ] / [x]) still toggle
  • Side-by-side with current main — no visual regressions in non-GFM cases

@luca-chen198 luca-chen198 marked this pull request as ready for review May 21, 2026 16:33
@luca-chen198 luca-chen198 linked an issue May 21, 2026 that may be closed by this pull request
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.

Fork with added GFM/CommonMark features & fixes — sharing in case any are useful make horizontal line scalable

1 participant