asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
331 stars 97 forks source link

PlantUML Diagrams not rendering the Previewer for vs-code #251

Closed JMikeP closed 4 years ago

JMikeP commented 4 years ago

This is an example issue. Use just the headings and fill out all necessary information. Screenshots & Files and Additional Context are optional.

Description

I am using .adoc files to create the asciidoc and there is a custom css file with my companies styling. I am using the following syntax to create a diagram. I am using all the default setting and downloading the plugin from Microsoft Market Place.

[plantuml,title, svg]

@startuml plantuml markup @enduml


System Information

I am using VS code 1.39.2 on Windows 10.

To Reproduce

Steps to reproduce the issue:

[plantuml,title, svg]

@startuml plantuml markup @enduml

Screenshots & Files

I am sorry but my company policy prevents me from providing more details on with screen shots or code files.

Additional Context

If there is a step i am missing in the install process please let me know. All did was install the plugin from the market place and restart VS Code.

We use the plugin in IntelliJ, but not everyone here has IntelliJ so having this work in VS code would help a ton!

danyill commented 4 years ago

You need to set the plantuml-server-url to your server e.g. if your server is at http://localhost:8080 then set in the document header:

  = PlantUML Test 1
  :plantuml-server-url: http://localhost:8080

See the instructions at https://github.com/eshepelyuk/asciidoctor-plantuml.js#configuration for further detail. If you are thinking of setting the server URL to http://www.plantuml.com/plantuml be aware that it is rate limited.

The above URL is correct if you are deploying the PlantUML server from a docker container -- e.g. with docker run -d -p 8080:8080 plantuml/plantuml-server:jetty

You also need to put the diagram inside a literal block (or code block)

  [plantuml, title, svg]
  ....
  @startuml
  Bob -> Alice : hello
  @enduml
  ....
  [plantuml, title, svg]
  ----
  @startuml
  Bob -> Alice : hello
  @enduml
  ----

You don't need the @startuml and @enduml

  [plantuml, title, svg]
  ----
  Bob -> Alice : hello
  ----
danyill commented 4 years ago

Another way using this extension to get PlantUML integration is via asciidoctor-kroki.

Go to your settings and enable the Use_kroki setting.

image

This might be an easier way to get "simple" plant uml support.

There is also a PlantUML extension which I haven't tried but appears to be quite capable.

Feel free to close this issue if this helps. We could do with a little more documentation on how to enable PlantUML support within this extension and I'll do a PR for this at some stage.

JMikeP commented 4 years ago

Thanks You! We are going to create a kroki server on our network and point to that.

danyill commented 4 years ago

:+1: Good choice. Kroki is a really modern, extensible well documented new thing!