Skip to content

Matrix rich text both ways - #6

Open
hsmith-dev wants to merge 1 commit into
feat/keychain-signinfrom
feat/matrix-rich-text
Open

hsmith-dev wants to merge 1 commit into
feat/keychain-signinfrom
feat/matrix-rich-text

Conversation

@hsmith-dev

Copy link
Copy Markdown
Owner

What and why

Gap 0.6 (stacked on #5): formatting survives the trip between ChatCraft and other Matrix clients.

  • Receiving: formatted_body HTML (bold, italic, strike, code, code blocks, links, mention pills, quotes, lists, line breaks) becomes ChatCraft markup through a small, tolerant converter (no HTML dependency; tags are never executed; output capped).
  • Sending: formatted_body is rendered by ChatCraft's own parser instead of CommonMark, so *x* reaches Element users as bold (it was italic), and @handle becomes a mention pill.
  • ChatCraft-authored messages keep their exact source (shortcodes and all): if the HTML re-renders from the body, the body is used verbatim.

Testing

  • cargo xtask ci passes; all Matrix integration tests pass.
  • Converter fixtures, hostile HTML, round trip, and a mapper test that a pill counts as a mention.
  • Live: an Element-style HTML message posted through the Matrix API reads back as @quinn: *shipped!* See <https://example.org/notes|the notes> with its list.

🤖 Generated with Claude Code

- received formatted_body HTML (bold, italic, strike, code, pre, links,
  mention pills, quotes, lists, br/p) converted to ChatCraft markup by a
  small tolerant converter (no HTML parser dependency, never executed)
- sent messages carry formatted_body rendered by ChatCraft's own parser,
  so *x* is bold for Element users too; mention pills for @Handles
- ChatCraft-authored messages keep their exact source (HTML re-renders
  from the body); edits use the same path
- drop the SDK markdown feature
- tests: converter fixtures, hostile HTML, round trip, mapper pills

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant