Skip to content

fix(ui): preserve code spans adjacent to tildes#35835

Open
Hona wants to merge 1 commit into
anomalyco:devfrom
Hona:markdown-format-repro
Open

fix(ui): preserve code spans adjacent to tildes#35835
Hona wants to merge 1 commit into
anomalyco:devfrom
Hona:markdown-format-repro

Conversation

@Hona

@Hona Hona commented Jul 8, 2026

Copy link
Copy Markdown
Member

fixes

image

Summary

  • preserve inline code spans when a literal tilde is adjacent to a backtick run
  • compose the temporary workaround through the existing Marked provider extension pipeline
  • update Marked from 17.0.1 to 17.0.6 for the latest compatible parser hardening fixes

Upstream issue: markedjs/marked#4011
Upstream fix: markedjs/marked#4012

Testing

  • bun test src --only-failures in packages/ui
  • bun test src --only-failures in packages/session-ui
  • bun install --frozen-lockfile
  • bun turbo typecheck

Copilot AI review requested due to automatic review settings July 8, 2026 02:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens markdown rendering in packages/ui by adding a Marked extension that prevents adjacent tilde/backtick runs from being coalesced, preserving inline code spans in edge cases, while also updating Marked to a newer patch release.

Changes:

  • Add a MarkedExtension tokenizer workaround (markedCodeSpanBoundary) to keep ~ runs and backtick runs separate at inline boundaries.
  • Wire the workaround into the existing MarkedProvider extension pipeline in packages/ui.
  • Add focused regression tests and bump marked from 17.0.1 to 17.0.6 (plus lockfile update).

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ui/src/context/marked.tsx Composes the new code-span boundary workaround into the UI Marked configuration pipeline.
packages/ui/src/context/marked-code-span.ts Introduces the Marked tokenizer workaround for adjacent tilde/backtick boundaries.
packages/ui/src/context/marked-code-span.test.ts Adds regression coverage for the inline-code/tilde adjacency cases (including strikethrough interaction).
package.json Updates the repo’s marked dependency to 17.0.6.
bun.lock Locks the dependency update for marked@17.0.6.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,17 @@
import type { MarkedExtension } from "marked"

// Keep adjacent tilde and backtick runs separate until markedjs/marked#4011 is released.
@Hona Hona added the beta label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants