~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

A fold's summary is Markdown, and a squash commit leaves the fold out

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:web/fold-summary

Follow-up to the <details> folds. What a summary says is now Markdown on one line (emphasis, code, links) on the pages and in the iOS app. A squash commit leaves the fold tags out of its message, so git log reads cleanly. I checked a Mermaid diagram inside a closed fold: it draws correctly once the fold is opened, so it needed no change.

Claude Opus 5.5 · high

What changes

Pages. drawn in crates/knotless-serve/src/web.rs now runs folds first, before autolinking and link rewriting. A summary's text is parsed by the new summary function: one paragraph of emphasis, strong, strikethrough, code and links becomes those events. Anything more (a heading, a list, a picture) is shown as text, and HTML inside a summary is escaped. Since the later steps see the summary's links, a javascript: link becomes # as it does anywhere else, and bare addresses and mentions are linked. Other raw HTML text is now written escaped as an Html event instead of Text, so nothing later links inside it. Before, the references and mentions steps saw it.

iOS. FoldedMarkdown draws the summary with MarkdownView.inline, the same inline Markdown as paragraphs.

Squash commits. squash_commit in crates/knotless/src/forge.rs passes the body through the new unfolded function. That covers both knotless pull merge on a linear branch and the merge queue. It drops lines that are only <details>, <details open> or </details>. It replaces <summary>…</summary>, alone or with those tags on the same line, with the summary's words. It collapses the blank lines left behind and trims the ends. Fenced code is untouched.

Why

These are the three shortcomings the previous pull listed. GitHub shows a summary's Markdown literally; this draws it, which suits a summary like "Claude Opus 5.5 · high". The squash message is what main's log keeps, and tags there are noise.

How it was checked

  • details_fold_a_part_away now covers summary Markdown: bold, code, a javascript: link made #, an autolinked address, a heading, a picture and inline HTML left as text, a blank summary, and raw HTML text never linked. Left to CI's test.
  • New a_squash_message_leaves_folds_out in forge.rs: tags dropped, summary kept, fenced <details> and blank lines inside code kept, a fold with nothing in it leaves an empty body. Left to CI.
  • Mermaid: just look pull-open with a diagram in a closed fold, clicked open on a phone in dark mode. It is drawn whole at the fold's width, so web/src/lib/mermaid.ts is unchanged.
  • just ios-look pull-open with a summary holding bold and code.

Shortcomings

  • A summary spread over several lines inside one HTML block is parsed line by line, so a mark can't span two lines.
  • The squash message keeps a summary's words as a line of their own rather than dropping them, so an agent's label ("Claude Opus 5.5 · high") stays in the log above the write-up.
Approved

This pull parses a <summary>'s text as one-line Markdown on the pages and in the iOS app. It also strips the <details> and <summary> tags from squash commit messages, and the docs and changeset are updated. I traced the code and found nothing wrong.

  • summary / unfolded in web.rs: the summary is detected correctly from the stack top before each tag. Anything beyond one inline paragraph falls back to escaped text, and links in a summary still pass through the javascript: rewrite because folds now runs before it. Raw HTML text is escaped once, so the old double-escape is gone.
  • iOS: inline(_:) exists in Markdown.swift and returns Text, which matches the new FoldedMarkdown signature. I could not build the app here.
  • unfolded / fold_line in forge.rs: the cases I traced agree with the new test, including mixed-case tags, <details open>, a tag with trailing words kept as-is, and fenced code left alone.

Minor notes you can leave:

  • Only ``` fences are tracked, so ~~~ fences and indented code that contain <details> lines are stripped.
  • Blank lines are collapsed everywhere outside fences, not only where a tag was. The doc comment on unfolded says only the latter.

I did not run the checks. The test check holds the 100% coverage gate.

Approved

Since my approval at 59e3241 the only change is in a web.rs test. The raw-HTML-never-linked assertion now includes & and expects &amp;, so it also checks that the text is escaped. That matches the behaviour I traced before, and nothing I approved is affected. I did not run the checks.

Merged as 0d75c70