markdown-preview-plus icon indicating copy to clipboard operation
markdown-preview-plus copied to clipboard

support plantuml diagrams

Open richardwthompson opened this issue 10 years ago • 9 comments

plantuml (http://plantuml.com/) is a lightweight text language that turns simple text into diagrams.

I have started including plantuml text in my markdown documents as code blocks.

The following snippet is example plantuml text that generates a sequence diagram.

  plantuml
  @startuml 
  Alice -> Bob: Authentication Request 
  Bob --> Alice: Authentication Response
  Alice -> Bob: Another authentication Request 
  Alice <-- Bob: another authentication Response 
  @enduml

It would be awesome if markdown-preview-plus could detect if a code block is representing a plantuml diagram and actually generate and display the image as part of the preview

richardwthompson avatar Dec 20 '15 00:12 richardwthompson

+1 for this feature

appanp avatar Dec 21 '15 06:12 appanp

+2 for this feature

trickyEdecay avatar Mar 02 '16 11:03 trickyEdecay

@richardwthompson @appanp @trickyEdecay Thanks so much for the suggestion and I really apologise that its taken me so long to reply to you all.

We use markdown-it as our markdown parser and in theory its possible to extend it with a plugin to support plantuml. Unfortunately it doesn't look like such a plugin already exists and it is not something I would have the time to implement myself.

I will label this as a wont-implement however if anyone would like to implement it I would be happy to consider a PR. Thanks again @richardwthompson @appanp @trickyEdecay

Galadirith avatar Mar 27 '16 12:03 Galadirith

Maybe this one: https://www.npmjs.com/package/markdown-it-plantuml

flomine avatar Oct 23 '18 16:10 flomine

markdown-it-plantuml seems to send diagram code to the third-party service over the net, over plain HTTP no less. So, an obvious drawback is that it won't work offline, it will also eat into your data cap if you have one, and there are of course all the associated privacy concerns present. For that reason, I'm not too keen on including it with MPP. There's a fork that supposedly doesn't do that https://github.com/DeepElement/markdown-it-plantuml-offline, but it seems like it's not particularly well-maintained.

lierdakil avatar Oct 23 '18 18:10 lierdakil

Perhaps users could choose between the default third party or starting a local server, it takes one line with docker:

docker run -d --name plantuml -p 8080:8080 plantuml/plantuml-server:tomcat

The npm package @flomine mentioned, seems to support setting your own server.

const options = {
  generateSource: function generateSource(umlCode) {
    return `https://your.server/plant-uml/${yourEncodeFunction(umlCode)}`;
  }
}

Lately, we use Gitlab extensively and it has configurable support for plantuml, being able to preview the content with diagrams as it appears on Gitlab would be amazing!

https://docs.gitlab.com/ee/administration/integration/plantuml.html

mritzco avatar Aug 30 '19 05:08 mritzco

That is, if you have docker set up. And your OS supports Docker. Out of the box experience won't be great, to say the least.

You have an option of using Pandoc renderer with a plantuml filter, BTW. A quick cursory search shows there are a few (and honestly writing one in lua is very easy if you need to).

пт, 30 авг. 2019 г., 9:35 mritzco [email protected]:

Perhaps users could choose between the default third party or starting a local server, it takes one line with docker:

docker run -d --name plantuml -p 8080:8080 plantuml/plantuml-server:tomcat

The npm package @flomine https://github.com/flomine mentioned, seems to support setting your own server.

const options = { generateSource: function generateSource(umlCode) { return https://your.server/plant-uml/${yourEncodeFunction(umlCode)}; } }

Lately, we use Gitlab extensively and it has configurable support for plantuml, being able to preview the content with diagrams as it appears on Gitlab would be amazing!

https://docs.gitlab.com/ee/administration/integration/plantuml.html

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atom-community/markdown-preview-plus/issues/166?email_source=notifications&email_token=ABXQIZSPCI4R67M3GLJHG53QHCWQ7A5CNFSM4BXC6QOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QS6SQ#issuecomment-526462794, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXQIZTCTTI2ABP4GNWSLK3QHCWQ7ANCNFSM4BXC6QOA .

lierdakil avatar Aug 30 '19 08:08 lierdakil

My apologies, I felt like constructively contributing to the conversation to improve a plug-in I like with functionality that a group of people including myself seem to want. Thanks for the pointers to your cursory search.

mritzco avatar Aug 30 '19 16:08 mritzco

Someone already build a solution that works great out of the box:

https://shd101wyy.github.io/markdown-preview-enhanced/#/

mritzco avatar Dec 17 '19 05:12 mritzco