Storage format for linking to anchors no longer works?

Stephen Ellwood November 14, 2023

I have a Python Program which creates Storage Format code for Confluence Cloud based on:

https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html

I created the following Python code to link to an Anchor:

def content_url(link, description=None, page=None):
"""Encode a Link to an anchor in this page or another page

Args:
----
link: Name of anchor to link to
description: alternative description to use, (or use link if omitted)
page: page where anchor can be found (blank = current page)

"""
if description is None:
description = link
return ''.join(['<ac:link ac:anchor="{0}">'.format(link),
'<ri:page ri:content-title="{0}"/>'.format(page) if page else '',
'<ac:plain-text-link-body>',
'<![CDATA[' + description + ']]>',
'</ac:plain-text-link-body>',
'</ac:link>'
])

It was working well until someone pointed out that the pages I was creating were created in editor V1 format.  I changed the REST API call to create a "V2" page and the links no longer work in that they do go to the correct page but never down to the anchor.  Is this just another thing that got broken with the V2 editor or does the documentation need updating?

For reference the anchor is created using the following function:

 def anchor(name):
"""Insert an Anchor in the text
"""
output = '<ac:structured-macro ac:name="anchor" ac:schema-version="1">'
output += '<ac:parameter ac:name="">' + name + '</ac:parameter></ac:structured-macro>'
return output

Any help would be appreciated!

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events