The goal of this project is implement PlantUML tooling for Elixir.
Right now it has:
- Encoding/Decoding of diagrams https://plantuml.com/text-encoding
- Mix task to generate links with embedded diagrams pointing to a PlantUML web server
The package can be installed by adding plantuml
to your list of dependencies in mix.exs
, you don't need to include it
on runtime if you're just using the mix task.
def deps do
[
{:plantuml, "~> 0.1", only: :dev, runtime: false}
]
end
But if you need to Encode/Decode diagrams on application runtime you can add the following to your deps:
def deps do
[
{:plantuml, "~> 0.1"}
]
end
You can host your own instance of PlantUML server https://plantuml.com/server.
There's also a Docker image available on: https://hub.docker.com/r/plantuml/plantuml-server/.
config :plantuml, plantuml_server_url: "https://your-hosted-plantuml-server.com"
The default server url used is https://plantuml.com/plantuml
.
You can also use Kroki.io public server, this one supports SSL
config :plantuml, plantuml_server_url: "https://kroki.io/plantuml"
The docs can be found at https://hexdocs.pm/plantuml.
Running the Mix.Tasks.Plantuml.GenerateMarkdownLinks
mix task on the project will search for all markdown files and look for markdown comments
with links referencing to a PlantUML file in the project.
mix plantuml.generate_markdown_links
This feature was inspired by https://github.com/danielyaa5/puml-for-markdown, a CLI tool built with JavaScript.
The diagrams are rendered by passing an encoded diagram to a PlantUML Web Service.
You can add an embedded diagram by adding a comment to your markdown file like this:
<!--![Diagram Image Link](./priv/test_assets/example_diagram.plantuml)-->
Result:
You can also render a link to a diagram, by doing the same thing but without prepending the !
<!--[Link to Diagram](./priv/test_assets/example_diagram.plantuml)-->
Result:
See our contribution guidelines and our code of conduct