fix(app): highlight inline Markdown in code previews #7

Merged
charles merged 4 commits from feature/markdown-inline-highlight into main 2026-11-09 08:13:35 +00:00
Owner

Picking Markdown as the highlight language (pasted-text / attachment preview, and ```md code blocks) only styled headings and list markers: the arborium Markdown grammar (2.18.2, latest) covers block structure only, so bold, italic, strikethrough, inline code and links came back untagged.

  • MarkdownInlineHighlight.ts (new): inline pass that tags those spans on top of the grammar's HTML; falls back to the grammar output if the text doesn't line up.
  • ArboriumHighlightWorker.ts: apply it for Markdown; keep the block-only output if the result would exceed the output limit.
  • ArboriumThemeBridge.css: nested inline tags keep the parent's weight and style (italic inside bold, bold inside a heading).

Tested outside the app against the real grammar: 25 targeted cases, 3,000 fuzz inputs, real READMEs, and computed styles in headless Chromium for both themes. Not yet seen inside Fluxer.

🤖 Generated with Claude Code

Picking Markdown as the highlight language (pasted-text / attachment preview, and ```md code blocks) only styled headings and list markers: the arborium Markdown grammar (2.18.2, latest) covers block structure only, so bold, italic, strikethrough, inline code and links came back untagged. - `MarkdownInlineHighlight.ts` (new): inline pass that tags those spans on top of the grammar's HTML; falls back to the grammar output if the text doesn't line up. - `ArboriumHighlightWorker.ts`: apply it for Markdown; keep the block-only output if the result would exceed the output limit. - `ArboriumThemeBridge.css`: nested inline tags keep the parent's weight and style (italic inside bold, bold inside a heading). Tested outside the app against the real grammar: 25 targeted cases, 3,000 fuzz inputs, real READMEs, and computed styles in headless Chromium for both themes. Not yet seen inside Fluxer. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The arborium Markdown grammar only covers block structure, so bold,
italic, strikethrough, inline code and links came back untagged when
Markdown was picked as the highlight language. Add an inline pass in the
highlight worker that tags them on top of the grammar output, and let
nested inline tags keep their parent's weight and style.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review of the inline Markdown highlighter found inputs that stalled or
crashed the highlight worker and a few mis-highlights:

- resolve code spans, autolinks and bracket pairs once per segment and
  match emphasis with a linked delimiter list, so scanning is linear
- cap inline nesting depth, link nesting and destination length, stop
  once the output passes the limit, and fall back to the grammar output
  if the pass throws
- handle CRLF line endings, skip indented code blocks, and keep emphasis
  from pairing across table cells

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GitHub's release download endpoint kept answering 504 for one asset of
upstream's patched Electron release, which failed the Linux job (and so
skipped Windows and the feed). Retry the direct download, then fetch the
same asset through the GitHub API.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Two adjacent whitespace runs in the fence pattern made a line of 50,000
spaces take most of a second in the inline Markdown pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer!7
No description provided.