It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Draw.io diagrams and HTML Export Edited

I've just HTML exported a space that contains a lot of draw.io diagrams but they are not being displayed when I view the HTML. They are there as attachments on each page but they are not displayed inline when viewing the files in Chrome (or Safari). I notice there are errors in the console for every diagram:

Uncaught ReferenceError: require is not defined for every script block, such as (redacted):

<script class="ap-iframe-body-script">
(function(){
var data = {
"addon_key":"com.mxgraph.confluence.plugins.diagramly",
"uniqueKey":"com.mxgraph.confluence.plugins.diagramly__drawioXXXX",
"key":"drawio",
"moduleType":"dynamicContentMacros", "moduleLocation":"content", "cp":"/wiki",
"general":"",
"w":"",
"h":"",
"url":"https://confluence.draw.io/connect/confluence/viewer-1-4-8.html?XXXXX",
"structuredContext": "{\"license\":{\"active\":true},\"confluence\":{\"macro\":{\"outputType\":\"html_export\",\"hash\":\"XXXX\",\"id\":\"XXXX\"},\"content\":{\"type\":\"page\",\"version\":\"XXXX\",\"id\":\"XXXX\"},\"space\":{\"key\":\"XXXX\",\"id\":\"XXXX\"}}}",
"contentClassifier":"content",
"productCtx":"{\"page.id\":\"XXXX\",\"macro.hash\":\"XXXX\",\"page.type\":\"page\",\"contentId\":\"XXXX\",\"simple\":\"0\",\"inComment\":\"0\",\": = | RAW | = :\":\"contentId=XXXX|simple=0|zoom=1|inComment=0|pageId=XXXX|diagramDisplayName=XXXX.drawio|lbox=1|contentVer=1|revision=1|baseUrl=XXXX\",\"space.id\":\"XXXX\",\"diagramDisplayName\":\"XXXX\",\"diagramName\":\"XXXX.drawio\",\"links\":\"\",\"tbstyle\":\"\",\"height\":\"341\",\"space.key\":\"XXXX\",\"user.id\":\"XXXX\",\"content.version\":\"XXXX\",\"page.title\":\"XXXX\",\"zoom\":\"1\",\"macro.body\":\"\",\"pageId\":\"XXXX\",\"macro.truncated\":\"false\",\"lbox\":\"1\",\"content.type\":\"page\",\"output.type\":\"html_export\",\"contentVer\":\"1\",\"page.version\":\"XXXX\",\"revision\":\"XXXX\",\"user.key\":\"XXXX\",\"baseUrl\":\"XXXX\",\"content.id\":\"XXXX\",\"width\":\"XXXX\",\"macro.id\":\"XXXX\"}",
"timeZone":"XXXX",
"origin":"https://confluence.draw.io",
"hostOrigin":"XXXX",
"apiMigrations": {
"gdpr": true
}
};
if(window.AP && window.AP.subCreate) {
window._AP.appendConnectAddon(data);
} else {
require(['ac/create'], function(create){
create.appendConnectAddon(data);
});
}
}());
</script> 

The error is on this line: require(['ac/create'], function(create){

Are draw.io diagrams supported in HTML exports? If so, any idea how I can get them working?

1 answer

Thanks for your answer. Unfortunately an HTML export from Confluence does not preserve macros in a way that would allow us easily to inject our draw.io diagrams in the exported HTML page. This is why you cannot export HTML content and have an included draw.io diagram automatically.

Suggestion for a workaround: You will find a PNG of your diagram as an attachment of the page. You could inject this image in the HTML export. Or you could (temporarily) replace the real diagram with the picture and start the export then. After the export you can revert to the version with the real diagram. I admit that this is not a cool workaround.

If you want, you can describe the context of your question. Why do you want to export to HTML at all. Maybe there are other alternatives.

Would be nice, if this PNG replacement could happen automatically. We have really many diagrams and manual replacement is not an option.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

109 views 3 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you