Package: mkdocs-puml-mod
This repo is a fork ofhttps://github.com/MikhailKravets/mkdocs_pumlmkdocs_pumlis a fast and simple package that brings plantuml diagrams to MkDocs
documentation.mkdocs-puml-modwill allow you to use plantuml diagrams whensuperfencesis being used.InstallRun the following command to install the packagepipinstallmkdocs-puml-modHow to useJust addplantumlplugin intopluginssection of yourmkdocs.ymlfile,
in order to use puml with mkdocs.plugins:-plantuml:puml_url:https://www.plantuml.com/plantuml/plantumlplugin usesPlantUMLonly as an HTTP service. So, you should necessarily
specifypuml_urlconfig.Theplantumlconfig with the full list of parameters is belowplugins:-plantuml:puml_url:https://www.plantuml.com/plantuml/num_workers:8puml_keyword:pumlWhereParmeterTypeDescriptonpuml_urlstr. RequiredURL to the plantuml servicenum_workersint. Default8Max amount of concurrent workers that request plantuml servicepuml_keywordstr. DefaultpumlThe keyword for PlantUML code fence, i.e. ```puml ```Now, you can put your puml diagrams into your.mddocumentation. For example,## PUML Diagram

```puml
@startuml
Bob -> Alice : hello
@enduml
```At the build stepmkdocssends requests topuml_urland substitutes your
diagram with thesvgimages from the responses.Run PlantUML service with DockerIt is possible to runplantuml/plantuml-serveras a Docker container.Add a new service to thedocker-compose.ymlfileversion:"3"services:puml:image:plantuml/plantuml-serverports:-'8080:8080'Then substitutepuml_urlconfig with the local URL in themkdocs.ymlfileplugins:-plantuml:puml_url:http://127.0.0.1:8080num_workers:8Obviously, this approach works faster than
using remoteplantuml.com.Standalone usageYou can usePlantUMLconverter withoutmkdocs. Below is the example,frommkdocs_puml_mod.pumlimportPlantUMLpuml_url="https://www.plantuml.com/plantuml"diagram1="""@startumlBob -> Alice : hello@enduml"""diagram2="""@startumlJon -> Sansa : hello@enduml"""puml=PlantUML(puml_url,num_worker=2)svg_for_diag1,svg_for_diag2=puml.translate([diagram1,diagram2])How it worksThe package uses PlantUML as an HTTP service. It sends GET requests to
PlantUML service and receivessvgimages representing the diagrams.Theplantumlplugin parses.mddocumentation files and looks for```puml

```code blocks. Whenpumlcode block is found it is saved to the buffer for
a later request to PlantUML service. In this step, we replacepumlblock
with the uuid.NOTEyou must setpumlkeyword as an indicator that the PlantUML diagram
is located in the block. Default keyword can be changed for the custom one
inmkdocs.ymlconfig file by usingpuml_keywordparameter.After all pages are parsed,plantumlplugin requests PlantUML service
with the collected diagrams. After the responses are received, the package
substitutes uuid codes in markdown files with the correspondingsvgimages.AcknowledgementsHave combined code from 2 repos.
Credits:pugong, Fralauhttps://github.com/fralau/mkdocs-mermaid2-pluginMikhail Kravetshttps://github.com/MikhailKravets/mkdocs_pumlAllows the plugin to work when using pymdownx.superfences with snippets enabled.
Have moved all the event handling code to post_page event so that pymdownx.snippets can work on puml snippets inside the fences.If using superfences, you will need to add the below lines in superfences config in mkdocs.ymlmarkdown_extensions:-pymdownx.superfences:#pymdown-extensions installedcustom_fences:-name:pumlclass:pumlformat:!!python/name:mkdocs_puml_mod.fence.fence_pumlLicenseThe project is licensed underMIT license.