Hey Leon,
After some experimentation, I found that you're able to include a pre-existing draw.io diagram into wiki markup by referencing the original page id of the draw.io diagram and the name of the diagram using the {inc-drawio} macro.
For instance, if I create a new draw.io diagram named "my_diagram.drawio" on a page with ID 123456789, I can then include this diagram on a different page in wiki markup by using:
{inc-drawio:pageId=123456789,diagramName=my_diagram.drawio}
The awkward part here is getting the pageId of the owning page. If you're interacting with a lot of diagrams or using wiki markup frequently to include drawio diagrams, it may make sense to create a single/few page(s) where you create all the diagrams to have a known pageId you can reference easily.
If you're doing this through code like the atlassian-python-api package, it would be much easier to grab the reference page containing the diagrams, e.g.:
from atlassian import Confluence
confluence = Confluence( url='http://localhost:8090', username='admin', password='admin')
diagram_page = confluence.get_page_by_title(space="MySpaceName", title="Diagrams Reference")
new_page = confluence.create_page(
space="MySpaceName",
title="New Page Including Diagram",
representation="wiki",
body=f"""h1. Include Drawio test
{{inc-drawio:pageId={diagram_page["id"]}|diagramName=my_diagram.drawio}}
""",
)
Hope this helps!
You could try {drawio}, but I doubt the markdown parser will understand that. If it's possible to insert raw confluence page storage format into markdown, that should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leon. Attached you find a screenshot of all the supported formats you can use to generate a diagram from code (Arrange > Insert > Advanced):
Sincerely,
Bastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.