atom-community / markdown-preview-plus

Markdown Preview + Community Features
https://atom.io/packages/markdown-preview-plus
Other
370 stars 88 forks source link

support plantuml diagrams #166

Open richardwthompson opened 8 years ago

richardwthompson commented 8 years ago

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

appanp commented 8 years ago

+1 for this feature

trickyEdecay commented 8 years ago

+2 for this feature

Galadirith commented 8 years ago

@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

flomine commented 5 years ago

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

lierdakil commented 5 years ago

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.

mritzco commented 4 years ago

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

lierdakil commented 4 years ago

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 notifications@github.com:

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 .

mritzco commented 4 years ago

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 commented 4 years ago

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

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