matrix-org / matrix-org/matrix-spec
Extend supported HTML table elements and attributes for formatted_body
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 330
- Forks
- 150
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 3
Description
**Current spec for m.room.message is defined here:**
https://spec.matrix.org/v1.5/client-server-api/#mroommessage-msgtypes
**Problem:**
We tried to use Matrix for delevery of rich microblogging-style messages to rooms using the m.text and formatted_body, but efforts were handicapped by insufficient HTML table layouts.
Regarding HTML table, only following elements are highlighted without specifying what attributes are supported:
table, thead, tbody, tr, th, td, caption, span, summary
**Proposal;**
Extend supported HTML table elements and attributes to support more complex and useful table layouts without compromising security.
HTML 4.0 table spec is used as a guideline:
https://www.w3.org/TR/html401/struct/tables.html
This proposal does not include CSS.
We want following to be included in to m.room.message spec:
1. ````: The "border" is allowed and defaults to 0. border = pixels. Eg. ````
2. ````: The "width" is allowed and defaults to 100%. width = length. Eg. ````. The length is as per the above HTML 4.0 spec, a percentage or a pixel value. When the value is a percentage value, the value is relative to the available horizontal space.
3. ````: The "margin", "margin-top", "margin-right", "margin-bottom" and "margin-left" are allowed and defaults to 0.
Eg. ````
Values for "margin" as per the CSS standard.
Eg.
auto - the browser calculates the margin.
length - specifies a margin in px, em, etc.
% - specifies a margin in % of the width of the containing element.
inherit - specifies that the margin should be inherited from the parent element.
4. ````: The "padding", "padding-top", "padding-right", "padding-bottom" and "padding-left" are allowed and defaults to 0.
Eg. ````
Values for "padding" as per the CSS standard.
Eg.
length - specifies a padding in px, em, etc.
% - specifies a padding in % of the width of the containing element
inherit - specifies that the padding should be inherited from the parent element
5. ```` is accepted. Eg. ````. N is number of rows to span.
6. ```` is accepted. Eg. ````. N is number of colmns to span.
7. ```` is accepted. Eg. ````.
This attribute specifies the alignment of data and the justification of text in a cell. Possible values:
left: Left-flush data/Left-justify text.
center: Center data/Center-justify text. This is the default value for table headers.
right: Right-flush data/Right-justify text.
justify: Double-justify text.
8. ```` is accepted. Eg. ````.
This attribute specifies the vertical position of data within a cell. Possible values:
top: Cell data is flush with the top of the cell.
middle: Cell data is centered vertically within the cell. This is the default value.
bottom: Cell data is flush with the bottom of the cell.
baseline: All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells.
9. ````: The "margin", "margin-top", "margin-right", "margin-bottom" and "margin-left" are allowed and defaults to 0.
Values for "margin" as per the CSS standard.
10. ````: The "padding", "padding-top", "padding-right", "padding-bottom" and "padding-left" are allowed and defaults to 0.
Values for "padding" as per the CSS standard.
11. ```` is accepted. Eg. ````. Eg. ````. A dark red.
12. ```` is accepted. Eg. ````. N is number of rows spanned by cell.
13. ```` is accepted. Eg. ````. N is number of cols spanned by cell.
14. ```` is accepted. Eg. ````. The length is as per the above HTML 4.0 spec, a percentage or a pixel value. When the value is a percentage value, the value is relative to the available horizontal space.
15. ```` is accepted. Eg. ````.
This attribute specifies the alignment of data and the justification of text in a cell. Possible values:
left: Left-flush data/Left-justify text. This is the default value for table data.
center: Center data/Center-justify text.
right: Right-flush data/Right-justify text.
justify: Double-justify text.
16. ```` is accepted. Eg. ````.
This attribute specifies the vertical position of data within a cell. Possible values:
top: Cell data is flush with the top of the cell.
middle: Cell data is centered vertically within the cell. This is the default value.
bottom: Cell data is flush with the bottom of the cell.
baseline: All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells.
17. ```` is accepted. Eg. ````. Eg. ````. A dark red.
18. ````: The "margin", "margin-top", "margin-right", "margin-bottom" and "margin-left" are allowed and defaults to 0.
Values for "margin" as per the CSS standard.
19. ````: The "padding", "padding-top", "padding-right", "padding-bottom" and "padding-left" are allowed and defaults to 0.
Values for "padding" as per the CSS standard.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the m.room.message specification at the linked Matrix Client-Server API section, then compare the proposed elements and attributes with the linked HTML 4.0 table specification. Done means reaching and documenting an agreed, security-preserving set of supported table markup and attributes in the Matrix specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100