We are creating / managing user documentation for our solution in Confluence Cloud with the Draw.io plugin. We want to present the content as HTML on our secure portal.
To do this we need to export / access the pages as html as well as any referenced images. Images are either uploaded bitmaps or embedded draw.io diagrams.
We have tried:-
1) Exporting the space as html: The challenge is the draw.io images are included in the html as Script Tags and do not seem to reference the .png bitmaps that are included in the export
2) Accessing the pages via the Rest API: We can get the formatted HTML but again cannot work out how to get a rendered version of the draw.io images
Our preference is to use the API as we can integrate it into our build process.
Does anyone have any suggestions on an approach that could work?
Many Thanks JamesM
We found a solution using the REST API.
1) We build a hierarchy for the space using recursive calls to: https://{{host}}/wiki/rest/api/content/{{pageId}}/child/page?expand=children.page
We start at the root page and then drill down all child pages
2) We fetch the html for each page using https://{{host}}/wiki/rest/api/content/{pageId}?expand=body.export_view
3) We Fetch the content for the page by iterating over all img nodes in the HTML and fetching the underlying image using the supplier src
4) We update the HTML to make all src and href fields local rather than pointing to confluence
JamesM