Markdown表格中合并单元格

我试图在 Discourse 帖子中制作一些花哨的表格,但似乎无法成功。简而言之,我想合并一些单元格,以便将多个单元格放置在其他单元格下方或类似操作。这可行吗?

这是我的语法:

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

这是我得到的结果:

| | Grouping ||

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

这是我想要实现的效果:

任何建议都将不胜感激!

这看起来像是从 multimarkdown 示例中复制粘贴的。

我认为 Discourse 使用的是 markdown.it。因此在 Discourse 中无法实现。

我正在寻找一种解决方案来合并论坛中的表格单元格,以优化显示界面,并允许在表格中添加图片。然后我找到了 jekyll-spaceship 的介绍
链接:https://stackoverflow.com/questions/46621765/can-i-merge-table-rows-in-markdown

那么有人已经将其集成到 discourse 的核心了吗?还没有吗?

1 个赞

目前还无法实现,Discourse 不支持 \u003ctd\u003e\u003cth\u003e 元素的 colspanrowspan 属性。我认为这也不在路线图上。

您或许可以通过自定义插件来添加对此的支持。请参阅:Whitelisting HTML tags / attributes

支持的 HTML 元素列表在此处:https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/addon/allow-lister.js#L115。表格标签似乎在此处:https://github.com/discourse/discourse/blob/main/app/assets/javascripts/pretty-text/engines/discourse-markdown/table.js

也许这会有所帮助。

如果您想请求在核心功能中允许使用 colspanrowspan 属性,您可以创建一个新的 Feature 主题。:slight_smile:

2 个赞

谢谢,我将参考该类别功能中的文章示例以获得明确的建议。

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.