Handling html anchors

Hi,
I create a bunch of Confluence pages from HTML documents using the endpoint /wiki/api/v2/pages with representation: storage. Some of the documents contain internal references, i.e. links to anchors in the same document.
However, after importing these documents, the anchors disappear, making the links referencing them useless. My anchors are defined like <a id="some-id">some text</a>. How can I prevent Confluence from cleaning these anchors as I need them both in the Confluence page and later on when I request the content of the page by expanding content.body.storage.

Thanks,

Lars

Ok, found out that anchor links should be converted to macros. However, posting content withh e.g.

<ac:structured-macro ac:name="anchor" ac:schema-version="1">
<ac:parameter ac:name="name">myName</ac:parameter>
</ac:structured-macro>

gets cleaned after updating the content by requesting a PUT. The same macro is preserved when creating a new page with the same content using POST. Is that expected behaviour?

1 Like