mark icon indicating copy to clipboard operation
mark copied to clipboard

Add mermaid support

Open dreampuf opened this issue 2 years ago • 7 comments

Hi, me again. Thanks for maintaining the cool tool. I'm asking to add a cool feature.

Before Github officially enabled mermaid support, I'm a heavy user of markdown. I think we all know the best idea of markdown is to provide the ability to integrate the git workflow. The diagrams are the same. That's the mermaid comes from. The basic idea isn't new. Graphviz and other tools can do the same thing. But they can't either be easily integrated with or provide the fancy built-in diagram types.

There are two ways to make mermaid integrated with confluence. Client-side render and server-side render. My approach is kinda server side. It renders the code if it found them before you upload your page. And render the picture as an attachment. Upload it and insert the picture in a proper place (before the code block and set the block as collapse).

Talking to the cons, the image size, and third-party dependencies. The image size is from 30MB to 389MB. Mermaid render needs a browser environment. It makes mark need to coexist with a browser. But on the other hand, you still need to view your confluence page. This PR comes with chrome-headless.

All the best, Dreampuf

dreampuf avatar Mar 14 '22 09:03 dreampuf

image

dreampuf avatar Mar 14 '22 10:03 dreampuf

I love this idea, but I think it never got pushed right?

WildDogOne avatar Jul 19 '22 15:07 WildDogOne

OK I have built from your fork and everything seems good except the code blocks inserted after the mermaid images. I get "com.atlassian.confluence.ext.code.render.InvalidValueException" on Confluence Server Now I think I can see where problem is coming from, you declare the codeblocks as "plaintext" but our confluence server only understands codeblocks of the type "server" I am pretty positive that this is an issue of confluence cloud vs server but I am not sure if there is a way around this sadly

WildDogOne avatar Jul 19 '22 20:07 WildDogOne

@DemonWareXT Hi, I think there is a way to identify whether a cloud or server is by the domain. According to https://jira.atlassian.com/browse/CLOUD-6999 This is achievable. Let me know if you are interested.

dreampuf avatar Jul 20 '22 05:07 dreampuf

@dreampuf There is a cheap alternative way I think, at least it works with confluence server, I can't check with confluence cloud. I just set language = "" Dirty hack I guess, but it could be much easier

WildDogOne avatar Jul 20 '22 06:07 WildDogOne

I notice the main branch adopt mermaid support via #128 . The implementation relies on cloudscript.io plugin, which is not free. Our instance doesn't have it. I just set the language to plaintext (it could be any from the list of code macro supported languages)

dreampuf avatar Jul 29 '22 09:07 dreampuf

@dreampuf yeah exactly, what is why I will keep running your branch because it works for me that way, I don't want to get some strange paid plugin for that

WildDogOne avatar Jul 29 '22 09:07 WildDogOne

@dreampuf would you be interested in reviving this MR?

mrueg avatar Jan 25 '23 09:01 mrueg

@dreampuf There is a cheap alternative way I think, at least it works with confluence server, I can't check with confluence cloud. I just set language = ""

Doesn't work for me with confluence cloud. ;-(. I still get the mermaid code displayed below the diagram.

jd-brennan avatar Apr 04 '23 20:04 jd-brennan

Thanks, I've included your contribution as https://github.com/kovetskiy/mark/pull/288

I have not included the working directory and pathfinder change. Feel free to create a new PR if this is something you need.

mrueg avatar Apr 25 '23 21:04 mrueg