Skip to content

fix(ui): keep brackets and unclosed markers literal in timeline text - #245

Merged
iamnbutler merged 1 commit into
mainfrom
timeline-autoclose
Oct 14, 2026
Merged

iamnbutler merged 1 commit into
mainfrom
timeline-autoclose

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Timeline text now renders as written for bare URLs ending in ), $-containing text, and [text] without a link target. This extends the chat comark plugin from #239.

Root causes (comark 0.3.2):

  • createParse({ autoClose: true }) runs autoCloseMarkdown, which counts markers on the last line and appends a guessed closer. In Foo_(bar) the _ is preceded by a word character but followed by (, so it counts as an unclosed italic and gets _ appended. A lone $ counts as unclosed inline math and gets $ appended (${tpl} → ${tpl}$, cost $5 today → cost $5 today$). It can also append ], ), **, ~~, and `. Ace's parser now sets autoClose: false. During streaming, an unclosed marker such as **bol shows as literal text until its closer arrives. markdown-it already ends unclosed code fences at the end of the input.
  • comark's MDC comark_inline_span rule turns [text] into a span when no (url) or [ref] follows, so the brackets disappear. The chat plugin now disables it along with comark_inline_props.

Parse output changes, so VERSION goes from 8 to 9.

Fixes #244

Verification

I ran the real parseSegments from a scratch script outside the repo and deleted it afterwards. OffscreenCanvas was stubbed for text measurement only.

  • https://en.wikipedia.org/wiki/Foo_(bar) (alone and mid-sentence): link and text no longer get a trailing _
  • ${tpl} and cost $5 today: no trailing $
  • [WIP] fix and tag [a] and [b]: brackets kept
  • Keep literal braces in timeline message text #94/Exclude trailing punctuation from linkified URLs in the timeline #95: see {foo} here and text{.cls} stay literal. visit https://example.com. and (see https://example.com/a) still stop the link before the punctuation.
  • Unchanged: bold, italic (*/_), strikethrough, inline code, [link](url), <autolink>, :smile: emoji, @mention, bullet/ordered/task lists, fenced code with highlighting, and tables
  • Streaming: prefixes of a mixed message (bold, fence, table, text) parse correctly at each step, and an unclosed fence renders as code
  • bun types and bun run ci pass

I did not check rendering in the desktop app.

Built in Ace

No. Made by a Claude Code subagent in a terminal at the maintainer's choice for this session; not an Ace capability gap. Dogfooding: #5.

Disable comark's auto-close, which appended guessed closers like `_` and `$` to the last line of finished messages, and its `[text]` inline span rule, which dropped brackets.

Fixes #244
@iamnbutler
iamnbutler merged commit 1f3eec6 into main Oct 14, 2026
1 check passed
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.

Timeline text adds stray characters and drops brackets

1 participant