Skip to content

Matrix HTML table helpers and pipe-table Markdown support - #15

Merged
TroyHernandez merged 4 commits into
mainfrom
table-helpers
Aug 3, 2026
Merged

TroyHernandez merged 4 commits into
mainfrom
table-helpers

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

What

mx_table_html() and mx_send_table() render a data frame, matrix, or list as the conservative table HTML Matrix clients accept: a bare <table> of <tr>/<th>/<td>, no CSS, colspan, rowspan, or custom attributes. mx_send_table() pairs it with a plain-text body for clients that ignore formatted_body.

mx_markdown_to_html() gains GitHub-style pipe tables, honouring the :---/:---:/---: alignment row.

Adds inst/skills/mx.client/matrix-messaging/SKILL.md.

Two corrections folded in

NEWS. The table helpers had been written into the # mx.client 0.1.1 section, which already shipped to CRAN. Moved to a new 0.1.1.2 heading so the released notes describe what was actually released.

Dropped example. The markdown.R rewrite expanded mx_pill_mentions' @param/@return prose but lost its @examples block. tinyrox flags it and CRAN wants examples on exported functions, so it's restored.

Note

rformat_dir("R") also reflowed R/messages.R, which this branch never touched. The repo was not rformat-clean. That churn is isolated in its own commit.

Verification

75 tests pass. The restored example runs clean:

mx_pill_mentions("<p>ping @jorge</p>", "@jorge:example.org")
#> "<p>ping <a href=\"https://matrix.to/#/@jorge:example.org\">jorge</a></p>"

mx_table_html() and mx_send_table() render a data frame, matrix, or list
as the conservative table HTML Matrix clients accept: a bare <table> of
<tr>/<th>/<td> with no CSS, colspan, rowspan, or custom attributes.
mx_send_table() pairs it with a plain-text body for clients that ignore
formatted_body.

mx_markdown_to_html() gains GitHub-style pipe tables, honouring the
:---/:---:/---: alignment row.

Adds inst/skills/mx.client/matrix-messaging/SKILL.md.
The markdown.R rewrite expanded mx_pill_mentions' @param/@return prose
but dropped its @examples block, which tinyrox flags and CRAN wants on
exported functions. Restored.

rformat_dir also reflowed R/messages.R, which this branch never touched;
the repo was not rformat-clean.
mx_send_table(header = FALSE) dropped the header from the HTML but
mx_table_plain() always emitted column names, so formatted_body and the
plain-text body showed different tables. mx_table_plain() now takes
header and mx_send_table() passes it through.

The markdown rewrite matched only '1.' for ordered lists; main matched
'[.)]'. '1)' input silently rendered as a paragraph. Restored, and both
markers are now covered -- there were no ordered-list tests at all, which
is how the regression got through.
@TroyHernandez

Copy link
Copy Markdown
Contributor Author

Both findings confirmed and fixed.

header = FALSE fallback. mx_table_html() honoured header, mx_table_plain() always emitted column names, so formatted_body and the plain-text body showed different tables to different clients. mx_table_plain() now takes header and mx_send_table() passes it through.

1) ordered lists. Confirmed regression. main matched ^\\s*[0-9]+[.)]\\s+; the rewrite matched only \\., so 1) input silently rendered as a paragraph. Restored.

There were no ordered-list tests at all, which is how it got through. Added coverage for both markers, plus mx_table_plain() with and without a header.

80 tests, 0 failures (markdown 16 to 18, tables 2 to 5).

@TroyHernandez
TroyHernandez merged commit 500d417 into main Aug 3, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the table-helpers branch August 3, 2026 19:14
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