将 acticle 导入 confluence 时以编程方式添加 table 内容

Programmatically add table of contents when importing acticles into confluence

我想将现有文章从另一个系统迁移到 confluence,我目前的方法是使用文档导入功能导入他们的 html 打印版本,到目前为止效果很好。

现在这些文章有静态目录 (TOC),我想将其替换为动态 confluence TOC 宏。

我尝试了此处描述的不同宏选项 https://confluence.atlassian.com/conf59/table-of-contents-macro-792499210.html,但其中 none 有效,并且在 html 文件导入 confluence 后仅以纯文本形式显示宏。

<ac:structured-macro ac:name="toc">...</ac:structured-macro>

{toc:printable=true|...}

有办法实现吗?

我通过在页面中放置占位符 #TOC# 并随后通过数据库中的 SQL 语句替换它来解决这个问题。

UPDATE bodycontent SET body = REPLACE(body, '#TOC#', '<ac:structured-macro ac:name="toc" />')

之后您必须刷新页面缓存。