我正在尝试匹配 Slack API 消息的模型,该消息在附件文本行开头的链接中具有大于 (>) 字符。该模型还在附件文本中使用斜体和粗体,所以我有text
in the mrkdown_in
大批。不幸的是,这会导致 Slack 解释为>
or >
当它出现在行的开头时作为块引用字符。有谁知道如何解决这个问题?
我可以使用小大于号 (﹥) 或全角大于号 (>),但我不知道如何使用标准大于号 (>),这似乎很愚蠢。
这是一个 Slack 沙箱消息 JSON,它重现了我遇到的问题:https://api.slack.com/docs/messages/builder?msg=%7B%22 附件%22... https://api.slack.com/docs/messages/builder?msg=%7B%22attachments%22%3A%5B%7B%22text%22%3A%22_First%20line%20(needs%20to%20be%20italic)_%5Cn%3Chttp%3A%2F%2Fgoogle.com%7C%26gt%3B%20There%20should%20be%20a%20%5C%22%26gt%3B%5C%22%20at%20the%20start%20of%20this%20line%3E%22%2C%22mrkdwn_in%22%3A%5B%22text%22%5D%7D%5D%2C%22text%22%3A%22How%20do%20I%20display%20a%20greater-than%20character%20at%20the%20start%20of%20the%20link%20below%3F%22%7D
以下是来自上述 URL 的 JSON 消息:
{
"attachments": [
{
"text": "_First line (needs to be italic)_\n<http://google.com|> There should be a \">\" at the start of this line>",
"mrkdwn_in": [ "text" ]
}
],
"text": "How do I display a greater-than character at the start of the link below?"
}
以下是 Slack 呈现我的消息的方式,其中一些注释为红色:带注释的图像 https://i.stack.imgur.com/DQcKa.png
部分解决方案是输入垂直制表符 (\u000b
) 位于大于号之前。这显然具有转义大于符号的效果。
但是,这在链接内部不起作用,因此您必须将垂直制表符和大于号移到链接外部。
Example:
"text": "_First line (needs to be italic)_\n\u000b><http://google.com|There should be a \">\" at the start of this line>"
完整示例在这里:消息生成器 https://api.slack.com/docs/messages/builder?msg=%7B%22attachments%22%3A%5B%7B%22text%22%3A%22_First%20line%20(needs%20to%20be%20italic)_%5Cn%5Cu000b%26gt%3B%3Chttp%3A%2F%2Fgoogle.com%7CThere%20should%20be%20a%20%5C%22%26gt%3B%5C%22%20at%20the%20start%20of%20this%20line%3E%22%2C%22mrkdwn_in%22%3A%5B%22text%22%5D%7D%5D%2C%22text%22%3A%22How%20do%20I%20display%20a%20greater-than%20character%20at%20the%20start%20of%20the%20link%20below%3F%22%7D
其他“隐形”角色也可以。问题作者发现\u200a
(头发空间)最适合他。
我在另一个 Stack Exchange 社区上找到了这个问题的原始解决方案:link https://webapps.stackexchange.com/questions/86557/how-do-i-escape-formatting-characters-in-slack
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)