Merging Cells in Markdown Tables

AI-generated summary

The discussion revolves around the inability to merge cells in Markdown tables within Discourse. misterjtc seeks a way to merge cells for better table formatting, providing an example of desired output. moggleif notes that Markdown syntax for merging cells, like colspan or rowspan, is not supported in Discourse due to its use of markdown.it, which lacks this feature. hoangphuctran93 expresses interest in a solution and references external resources, including a Jekyll plugin. Canapin confirms that merging cells isn’t supported in core Discourse and suggests a custom plugin as a potential workaround, pointing to documentation on whitelisting HTML attributes and table handling. The discussion concludes with hoangphuctran93 planning to propose the feature in the #feature category.

I am trying to make some fancyish tables in a Discourse post and cant seem to get it to work. In a nut shell I want to merge some cells to place multiple cells underneath or similar. Is this possible?

This is my syntax

| | Grouping ||
First Header | Second Header | Third Header |
------------ | :-----------: | -----------: |
Content | Long Cell ||
Content | Cell | Cell |

This is what I get

| | Grouping ||

First Header Second Header Third Header
Content Long Cell
Content Cell Cell

This is what I am trying to do

Any advice is appreciated!

That seems like a copy paste of multimarkdown example.

And I think Discourse is using markdown.it. Therefore not possible to do in Discourse.

I am looking for a solution to the need of merging table cells on the forum, in order to optimize the display interface. as well as allowing adding images to the table. then found the introduction to jekyll-spaceship
Link: https://stackoverflow.com/questions/46621765/can-i-merge-table-rows-in-markdown

So has anyone integrated it into the core of discourse Not yet?

It’s currently not possible, and Discourse doesn’t support colspan or rowspan attributes for <td> and <th> elements. I don’t think it’s the roadmap either.

It is possible that you can add the support for this with a custom plugin. See: Whitelisting HTML tags / attributes

the list of supported HTML elements is here: https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115. The table tags seem to be here: https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js

Maybe this will be of some help.

If you want to request allowing colspan or rowspan attributes in core, you may want to create a new Contribute > Feature topic. :slight_smile:

Thank you, I will refer to the article sample in the category feature for a clear recommendation