Table layout: full width section headers | control column width | background color for rows columns and fields

I often make posts with tables, but I am missing a few functionalities which I think would be useful on every discourse forum:


  1. full width section headers within the table:

I can do something like

column 1 | column 2 | column 3 | column 4

–|–|–|–
<h3>Section title</h3> |
something | something else | more stuff | junk
<h3>Section title</h3> |
hello | sweet | world | of mine

But the section headers will be limited to one column width. It would be create if I can continue with the same table but have rows where one item takes full width.


  1. It would be useful to be able to define how wide a column should be compared to other columns. I would like to do something like this:

name of feature | has been implemented | in version | available on desktop | max limit
-----|-|–|-|–
Sharing attachments with preview image | :white_check_mark: | 12.1.0 | :x: | 25 MiB

Currently all columns divide with evenly, but I want that first column to take priority when it comes to dividing more width than we have available, thus minimizing line wraps for the first column, even if in some cases another column contains more characters.

Edit: giving a column more width should maybe be read as giving it a certain minimum width. The forum should not try to compact the column any further, but instead just keep it wide and tell the browser to show the vertical scrollbar if it doesn’t fit.


  1. Defining column, row and field background color without need for css customization.
    something like

Columns

budgeted thing | Company 1 | Company 2 | Company 3 | Company 4 | Company 5
–|–[light blue]|–|–[light blue]|–|–[light blue]
Tv advertisements | $400.000 | $120.000 | $0 | $23.000 | $308.000

Fields:

Feature name | App 1 | App 2 | App 3 | App 4
–|–|–|–|–
Mark files as read | yes [green] | no [red] | partially [yellow] | no [red]

Field background color overwrites column and row color.
Not sure yet about row and column priorities.

We don’t have any plans to fork the implementation of tables in markdown.it.

https://github.com/markdown-it/markdown-it

Making changes to the engine is very very finicky and likely to cause all sorts of regressions. If you need custom markdown you going to need to define your own markdown it engine in a plugin.

2 Likes

For future reference, a plug-in for markdown-it exists which supports “long cells”.

https://github.com/RedBug312/markdown-it-multimd-table

I haven’t looked for any plugins to define background color or to define preferred column width / relative column scale.

Hopefully Markdown-it will some day integrate this behavior, or maybe discourse would some day consider supporting it by default.