Does Slack support Markdown tables?

后端 未结 2 1447
误落风尘
误落风尘 2021-02-12 12:22

I want to send a Markdown table to Slack with its postMessage API, but I got raw content in Slack instead of a rendered table. Does Slack support Markdown tables? I

相关标签:
2条回答
  • 2021-02-12 12:37

    No, in fact, Slack doesn't support Markdown in messages¹ at all. It uses its own similar-at-a-glance format called mrkdwn which has some notable differences with Markdown:

    • In Markdown, both * and _ are used for emphasis
    • In Markdown, both ** and __ are used for bold
    • In mrkdwn * is used for bold and _ is used for emphasis
    • Markdown has no syntax for strikethrough (though some implementations have added it, e.g. in GFM which uses ~~) but mrkdwn uses ~ for strikethrough
    • Link syntax is very different
    • mrkdwn doesn't support headings
    • Probably more

    Don't expect arbitrary Markdown² to work in Slack messages.


    ¹Slack does support Markdown in posts which can be created using the files.upload API endpoint setting filetype to post.

    ²Note that tables aren't supported in regular Markdown either. Like strikethrough, some implementations have added these.

    0 讨论(0)
  • 2021-02-12 12:50

    Slack does not support rendering of tables so this markup will not work.

    You have two alternatives:

    • You can use fields, which will be rendered as 2 columns on most devices. See fields in layout blocks.
    • You can convert your table into an image (outside Slack) and
      attach the image to your message.
    0 讨论(0)
提交回复
热议问题