Skip to content

feat(auto-close): implement richer syntax support - #394

Merged
farnabaz merged 7 commits into
mainfrom
feat/auto-close-v2
Sep 3, 2026
Merged

feat(auto-close): implement richer syntax support#394
farnabaz merged 7 commits into
mainfrom
feat/auto-close-v2

Conversation

@farnabaz

@farnabaz farnabaz commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

What

Rewrites autoCloseMarkdown to match packages/comark/SPEC/auto-close.md (links/images, nested emphasis, math, HTML, setext, tildes, streaming trailing-openers) while keeping an O(n) scanner. Incomplete markdown heals as block structure (full document) plus inline syntax (last line only).

Why

Streaming AI output still needed more complete CommonMark/GFM healing than 0.6.2 (placeholder links, nested markers, space-flanked openers, setext guards)


checkout packages/comark/SPEC/auto-close.md for the final behavior

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
comark Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-json-render Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-nextjs Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-nuxt Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-svelte Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-sveltekit Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-twoslash Ready Ready Preview Sep 3, 2026 8:40am UTC
comark-vue Ready Ready Preview Sep 3, 2026 8:40am UTC

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Documentation previews

📚 Preview all documentation changes (follows new pushes)

Pinned to the current head: ba1c210

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@394

@comark/angular

npm i https://pkg.pr.new/@comark/angular@394

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@394

@comark/html

npm i https://pkg.pr.new/@comark/html@394

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@394

@comark/react

npm i https://pkg.pr.new/@comark/react@394

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@394

@comark/vue

npm i https://pkg.pr.new/@comark/vue@394

commit: ba1c210

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 3, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +2 new · 🟠 ~4 changed · 🔴 -0 removed · 2 flows · 5 files · commit ba1c210


Architecture

Architecture diagram for comarkdown/comark at ba1c210

6 components touched across 5 lanes.

Open full size


Inside the changed components — 1 view

Component view — Streaming & Auto-Close Engine

Internal modules of the streaming self-healing engine executing block scanning, inline character healing, link placeholder insertion, and table padding.

Architecture view of Component view — Streaming & Auto-Close Engine in comarkdown/comark

Data flow

Data flow diagram for comarkdown/comark at ba1c210

Streaming Parse with Self-Healing · Auto-Close Streaming Resolution

Open full size


The other flows — 1 sequence

Auto-Close Streaming Resolution

Sequence diagram of Auto-Close Streaming Resolution in comarkdown/comark

Drill down
Core Engine — 6 components
🟡 CHANGED Core Parser

Coordinates parsing lifecycle, plugin hooks, streaming auto-close configuration, and token processing.

🟡 CHANGED Streaming & Auto-Close

Self-healing engine that closes incomplete Markdown and MDC syntax during streaming.

🟡 CHANGED Block Scanner

Performs full-document scanning for open code fences, HTML elements, component stacks, YAML frontmatter, and setext heading guards.

🟢 NEW Inline Syntactic Healer

Linear-time character scanner managing delimiter stacks for bold, italic, code, math, and strikethrough, with trailing opener suppression.

🟢 NEW Link & Image Healer

Synthesizes placeholder URLs for unclosed links and images or strips markup in text-only mode.

🟡 CHANGED Table Closer

Pads column widths and balances trailing pipe boundaries while respecting incomplete inline cells.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail
  • Show unchanged neighbours

Tip

Run PR Lens on your own machine: npx skills add coldteadotai/pr-lens installs the agent skill. Then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."

🪧 More tips
  • Draw a diff before it is even a pull request: npx @coldtea/pr-lens-cli analyze --base origin/main reads the diff with your own model key, and npx @coldtea/pr-lens-cli render .pr-lens/graph.json draws the same lenses on your machine.
  • The boxes under View are live. Tick Architecture lens or Data flow lens to choose which diagrams appear, or Expand every detail to open every drill-down at once. The comment redraws in place a few seconds later.
  • Show unchanged neighbours lists the components this change did not touch alongside the ones it did, so the drill-down shows what the changed code sits next to.
  • GitHub will not let you zoom an image in a comment. The link under each diagram opens it full size on a page of its own, where you can.
  • The CLI's render picks up .github/pr-lens.yml automatically and applies your corrections (renames, exclusions, lane pins) at draw time.
  • Would you rather run it from CI on a key of your own? Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and a model key in your repository secrets, say GEMINI_API_KEY. The Action asks Gemini by default, or OpenAI and any endpoint speaking /chat/completions through its provider input.
  • PR Lens is free for open source. A star on the repository is what keeps it going.
  • Push a new commit and the whole comment re-renders for the new head. An older run never overwrites a newer one, so a slow render cannot put a stale diagram back.
  • The diagrams follow your GitHub theme, so dark mode gets the dark render and light mode the light one, and the moving dots show this pull request's data in motion.

◈ Rendered by PR Lens · crafted with ❤️ by the Coldtea team · Something drawn wrong?

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.

1 participant