mxblocks
Rich message blocks for Matrix bots: buttons, chips, tables, charts, cards,
progress, trackers, forms, media galleries, and math. Blocks ride as an extra
key on an ordinary m.room.message. Clients that understand that key render
them; everyone else sees the plain body, so every message stands on its own.
The specification defines the wire contract. Applications control their payload namespace and its compatibility aliases.
Workspace
| Path | Package | Purpose |
|---|---|---|
crates/mxblocks |
mxblocks |
serde types, validation, content keys, shared fixtures |
crates/mxblocks-asks |
mxblocks-asks |
reaction asks and buttons |
crates/mxblocks-tex |
mxblocks-tex |
math renderer integration and Matrix image events |
crates/mxblocks-tools |
mxblocks-tools |
rich_send/rich_edit definitions and validation |
packages/mxblocks-element |
@talaagent/mxblocks-element |
Element Web runtime renderer |
packages/mxblocks-math |
@talaagent/mxblocks-math |
MathJax + resvg LaTeX-to-PNG CLI |
Cargo metadata/dependencies are shared at the virtual workspace root. JavaScript packages use one pnpm lockfile; Turborepo runs their builds, tests, and typechecks. The root JavaScript package is private; the two packages have explicit file lists and can be packed independently.
Install
Rust APIs: mxblocks, mxblocks-asks, mxblocks-tex, and mxblocks-tools. See the integration guide for deployment archives, npm, and Nix consumption, including the Cargo source paths after the workspace move.
Application-selected keys
use ;
use Map;
let keys = new
.with_read_aliases;
let rich = buttons;
let mut content = new;
keys.write_rich;
assert_eq!;
ContentKeys reads only its configured namespaces and derives matching .used
and .album keys. Its write methods remove stale configured aliases on edits.
Default helpers retain com.talaagent.mxblocks and com.ianm.mtrix as public
compatibility keys. WriteKey::Custom chooses an arbitrary writer namespace;
use ContentKeys when the reader aliases should be configurable too.
Element has the corresponding configuration under its public settings key:
The writer key is also read. Custom keys have no implicit compatibility aliases. The sender allow-list remains required, and plain message bodies remain the fallback for clients without the module.
Development
Use Rust 1.88+, Node 24+, and the pnpm version pinned in packageManager.
nix develop supplies the Rust/Node tools, pnpm, resvg, and fonts.
pnpm test runs the math renderer against resvg. Outside the Nix shell, install
resvg and fonts or set MXBLOCKS_MATH_BIN to a built wrapper. Math tests are
uncached because they execute external tools. Turbo also tracks shared Rust
fixtures and the renderer environment; pnpm --filter <package> <script> runs
one package directly.
Nix uses the same pnpm workspace and lockfile. See the package READMEs for Element installation and the math CLI, and CONTRIBUTING.md for release and privacy checks.
License
Apache-2.0, with dependency and font attribution in NOTICE.