Programatically create Confluence storage format (XHTML)

Hello everyone,

is there any way to programatically create the Confluence XHTML storage format?

I want to create a blueprint that builds the storage format conditionally and then create the page.

To get an idea think about a Jira setup documentation:

  • Blueprint wizard variables: Operating System (e.g. RedHat, Ubuntu)
  • Based on the values add the “text fragment” that install OpenJDK with Ubuntu (apt-get install openjdk) and RedHat (yum install openjdk)

I don’t want to fully maintain a separte blueprint xml as they have a lot of in common.

I need something like https://j2html.com or MarkupBuilder (groovy 3.0.8 API) but just for the Confluence XHTML format.

Thanks for help :slight_smile:

The Confluence XHTML storage format is pretty similar to simple HTML. I wrote a Python script that took Markdown pages as input and pushed them to a Confluence Cloud instance, and off the shelf Markdown to HTML libraries worked for me. You probably will have to avoid syntax that Confluence doesn’t understand, so I would not try to push complicated formatting, but most Markdown should render into HTML that Confluence should be able to accept.