松弛块嵌套子弹点列表

发布于 2025-02-09 14:01:53 字数 370 浏览 2 评论 0原文

我需要将API请求发送给Slack,其中包含包含嵌套子弹点列表的消息。我找到了以下对现有问题的答案: https://stackoverflow.com/a/68483110/166659015却又可悲的是,这仅显示一个普通的子弹点列表而不嵌套。

我找不到此Rich_textrich_text_list类型的任何资源或文档。

如何利用Rich_text的块来创建嵌套的项目符号列表?

(我知道有解决方法,但是如果通过块中存在1维的子弹点,那么也应该以某种方式嵌套)

I need to send a API request to slack with a message containing a nested bullet point list. I've found the following answer to a existing question: https://stackoverflow.com/a/68483110/16659015 but sadly this only shows a normal bullet point list without nesting.

I couldn't find any resources or documentation to this rich_text and rich_text_list types and when trying different orders the block kit builder threw errors.

How can I utilize the blocks with rich_text to create a nested bullet point list?

(I know there are workarounds but if a 1 dimensional bulletpoint exists through blocks then a nested should also be possible somehow)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苯莒 2025-02-16 14:01:53

对于像我这样的其他人,将来寻找这个问题是解决方案:

您可以在此处看到它: https://api.slack.com/tutorials/tracks/rich-text-tutorial

您可以看到在此处的块构建器中的演示

这是从文档复制的示例代码。诀窍是仅在当前一个列表下方制作一个单独的列表块,并使用缩进属性:

{
"type": "rich_text",
"elements": [
    {
        "type": "rich_text_section",
        "elements": [
            {
                "type": "emoji",
                "name": "office"
            },
            {
                "type": "text",
                "text": " Company business",
                "style": {
                    "bold": true
                }
            }
        ]
    },
    {
        "type": "rich_text_list",
        "style": "bullet",
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Fill out your W-2"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Enroll in "
                    },
                    {
                        "type": "link",
                        "text": "benefits",
                        "url": "https://salesforcebenefits.com"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Fill out your Slack profile, including:"
                    }
                ]
            }
        ]
    },
    {
        "type": "rich_text_list",
        "style": "ordered",
        "indent": 1,
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Time zone"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Pronouns"
                    }
                ]
            }
        ]
    }
]

},

For anyone else like me looking for this in the future here is the solution:

You can see it documented here: https://api.slack.com/tutorials/tracks/rich-text-tutorial

You can see a demo in the block builder here.

And here is the example code copied from the docs. The trick is simply to make a separate list block below your current one and use the indent property:

{
"type": "rich_text",
"elements": [
    {
        "type": "rich_text_section",
        "elements": [
            {
                "type": "emoji",
                "name": "office"
            },
            {
                "type": "text",
                "text": " Company business",
                "style": {
                    "bold": true
                }
            }
        ]
    },
    {
        "type": "rich_text_list",
        "style": "bullet",
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Fill out your W-2"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Enroll in "
                    },
                    {
                        "type": "link",
                        "text": "benefits",
                        "url": "https://salesforcebenefits.com"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Fill out your Slack profile, including:"
                    }
                ]
            }
        ]
    },
    {
        "type": "rich_text_list",
        "style": "ordered",
        "indent": 1,
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Time zone"
                    }
                ]
            },
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "Pronouns"
                    }
                ]
            }
        ]
    }
]

},

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文