Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert macro "draw.io" by wiki markup language

Leon Li July 3, 2023

Hello

I don't find the related macro wiki markup language grammar.

 

3 answers

0 votes
Jacob.Learned
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 26, 2024

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!

0 votes
David Benson July 3, 2023

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.

0 votes
Bastian -drawio Diagrams-
Atlassian Partner
July 3, 2023

Hi Leon. Attached you find a screenshot of all the supported formats you can use to generate a diagram from code (Arrange > Insert > Advanced):

 

Screen Shot 2023-07-03 at 11.12.13.png

Sincerely,
Bastian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events