This question sums up my problem well:
https://community.atlassian.com/t5/Confluence-questions/How-to-save-a-code-block-to-confluence-through-jsonrpc-api/qaq-p/413254?tempId=eyJvaWRjX2NvbnNlbnRfbGFuZ3VhZ2VfdmVyc2lvbiI6IjIuMCIsIm9pZGNfY29uc2VudF9ncmFudGVkX2F0IjoxNjE3NjYwMzMyNDU5fQ%3D%3D
And here is my code:
def _format_page(issue, comments):
issue_body = markdown.markdown(_format_issue(issue))
issue_body = utils._replace_code(issue_body)
comment_body = _format_comments(comments)
print(issue_body)
json = {"type": "page",
"title": issue['key'] + ": " + issue['fields']['summary'],
"space": {"key": creds.confl_space},
"body": { "storage": {
"value": issue_body + comment_body,
"representation": "storage",
}
}
}
return json
Above is the code I'm using. Everything works and posts a page on Confluence, except the {code} ... {code} blocks appear in plain text. My goal was to convert a Markdown file to HTML and then post the snippet onto the page. The format is in storage, like the answerer said to do, so what am I doing wrong? Thank you.
Edit: Just to be clear, I am transferring Jira Issues to Confluence pages. This just formats the JSON file - it does not perform any CRUD requests.