Stop telling an agent to send a Markdown fold as HTML

Merged
JO
14d ago
+30-5

A fold written in Markdown no longer makes the CLI suggest --format html.

Since #1024, the basecamp skill says to write a fold as <details><summary>…</summary> and </details> around Markdown. Posting one prints:

Warning: content contains HTML tags and was read as Markdown, the default. Supported tags are kept and the Markdown around them is converted. To send HTML without Markdown conversion, pass --format html.

--format html is what the skill says not to use for a fold. It stores the post exactly as written, so every paragraph, table, list and fold in it shows touching the next. The coworker writing guide said the same thing until basecamp/coworker#330. Agent posts with folds kept coming out as hand-written HTML with no space between blocks, like the one Jorge flagged.

What changes:

  • HasRichTextHTML leaves out raw HTML made only of bare <details> and <summary> tags, open or closed, with text between them. It already leaves out mention and attachment markup the same way.
  • The warning still fires for a fold written wholly as HTML, a summary holding other tags, HTML beside a fold, a comment inside a fold, and a fold tag with an attribute.

Tests: seven new cases in TestRichTextHTMLInMarkdownWarns. The two fold cases fail with the richtext.go change reverted, and the comment case fails on the first version of the check; all pass now. go test ./internal/richtext/ ./internal/commands/ passes locally.

For a person to review and merge.