【问题标题】:How to add comments to Atlassian Confluence (Cloud) via REST API and preserve markup formatting?如何通过 REST API 向 Atlassian Confluence (Cloud) 添加评论并保留标记格式?
【发布时间】:2017-10-26 21:09:15
【问题描述】:

我在包含 Atlassian 标记语言的纯文本文件中有一条注释,如下所示:

An {{Unexpected end of socket}} \\nis a *TCP/IP* error message.

当我提交 REST API 请求以添加此类评论时,使用以下 JSON 简介:

{"type": "comment", 
 "container": {"type": "page", 
               "id": "123456789", 
               "status": "current"}, 
"body": {"storage": {"value": "An {{Unexpected end of socket}} \\nis a *TCP/IP* error message.", 
"representation": "storage"}}}

它被呈现为带有大括号、星号和其他字面意思的标记的文本(好吧,除了 \\n 被删除,这也不好):

{{Unexpected end of socket}} 是 TCP/IP 错误消息。

理想情况下,我希望在 Confluence 评论中看到这一点:

Unexpected end of socket
TCP/IP 错误消息。

有什么建议吗?

谢谢,基里尔

【问题讨论】:

    标签: confluence confluence-rest-api


    【解决方案1】:

    确保您的格式完全符合您的要求的最佳方法是使用您想要的格式创建一个测试页/评论,然后提取该输出的存储格式。这将始终为您提供您需要应用以保留所需格式的确切格式特性。

    在撰写本文时,您需要是这样的:

    "<p /><ac:structured-macro ac:name=\"code\" ac:schema-version=\"1\" ac:macro-id=\"d14c8973-f1c3-4e76-a75e-ba8e8e1be3af\"><ac:plain-text-body><![CDATA[unexpected end of socket]]></ac:plain-text-body></ac:structured-macro><p />"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-25
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多