微软团队:在发布到 webhook 的文本中转义下划线

dpa*_*kar 7 markdown microsoft-teams

我正在使用传入的 webhook 将 Azure 资源组列表发布到团队中的频道。

一些 Azure 资源组中有下划线,这些正在被解析并且两个下划线之间的文本是斜体的。从文档中我可以了解到这是 Markdown 行为,但我无法使用\类似于您在 Markdown 中所做的(反斜杠)来转义下划线。

发布带有下划线的文本以使其正确呈现的正确方法是什么?

(很高兴知道正在使用什么 Markdown 变体。)

示例有效载荷:

{
  "text": "<br/><h1>Some text (some azure subscription id)</h1><br/>some text (more text): <br/>['resource_group_name_1', 'resource_group_name_2', 'resourcegroup-rg-foo-bar']<br/><br/>some text (more text): <br/>['resourcegroupname']<br/><br/>See <a href="https://someaccount.visualstudio.com/_git/reponame?path=%2FREADME.md">documentation</a> and <a href="https://someaccount.visualstudio.com/someproject/_build?definitionId=1234&_a=summary">sometext</a>."
}
Run Code Online (Sandbox Code Playgroud)

resourcegroup-rg-foo-bar按原样显示,但resource_group_name_1类似于资源名称 1。

sha*_*lpk 5

Cards 现在支持在部分级别禁用 Markdown。你可以设置markdown为false。

详情在这里

例子

{
    "@type": "MessageCard",
    "@context": "https://schema.org/extensions",
    "summary": "Office 365 Notification",
    "title": "Office 365 Service Degradations",
    "sections": [
        {
            "markdown": false,
            "facts": [
                {
                    "name": "Service Incident:",
                    "value": "ID"
                },
                {
                    "name": "Start time:",
                    "value": "check_disk_critical"
                },
                {
                    "name": "Service:",
                    "value": "SERVICENAME"
                },
                {
                    "name": "Description:",
                    "value": "MESSAGE"
                }
            ],
            "title": "Office 365 Service Problem"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)


小智 0

它适用于将 markdown 设置为 false 的情况。如果将 markdown 设置为 false,则无需转义下划线。希望这可以帮助