Package: mkdocs-build-plantuml-plugin
MkDocs-Build-Plantuml-PluginTable of ContentsAbout the ProjectPrerequisitesInstallationUsageDark Mode SupportKnown restrictionsContributingAbout the ProjectThis plugin automates the generation of PlantUML image files when usingmkdocs serve.The motivation behind this plugin is to provide a solution for users who prefer not to use inline diagrams and have encountered challenges with non-functional !includes.Note: If you want inline diagrams in your Markdown files```plantumlAlice -> Bob```this plugin doesnotmeet your requirements. Please check outplantuml-markdownwhich does exactly that.PrerequisitesYou need to have installed:Python3MkDocsJava for Plantuml (If running locally)Plantuml(if running locally)This plugin (needs httplib2 for server rendering)On macOS you can install plantuml with homebrew which puts a plantuml executable in/usr/local/bin/plantuml.Installationpip3installmkdocs-build-plantuml-pluginUsagePlugin SettingsInmkdocs.ymladd this plugin section (depicted are the default values):plugins:-search-build_plantuml:render:'server'# or "local" for local renderingbin_path:'/usr/local/bin/plantuml'# ignored when render: serverserver:'http://www.plantuml.com/plantuml'# official plantuml serverdisable_ssl_certificate_validation:true# for self-signed and invalid certsoutput_format:'svg'# or "png"allow_multiple_roots:false# in case your codebase contains more locations for diagrams (all ending in diagram_root)diagram_root:'docs/diagrams'# should reside under docs_diroutput_folder:'out'input_folder:'src'input_extensions:''# comma separated list of extensions to parse, by default every file is parsedIt is recommended to use theserveroption, which is much faster thanlocal.Example folder structureThis would result in this directory layout:docs/# the default MkDocs docs_dir directorydiagrams/include/# for include files like theme.puml etc (optional, won't be generated)out/# the generated images, which can be included in your md filessubdir1/file1.svg# you can organise your diagrams in subfolders, see belowfile.svgsrc/# the Plantuml sourcessubdir1/file1.pumlsubdir2/file.pumlmkdocs.yml# mkdocs configuration fileWhen starting withmkdocs serve, it will create all diagrams initially.Afterwards, it checks if the*.puml(or other ending) file has a newer timestamp than the corresponding file in out. If so, it will generate a new image (works also with includes). This way, it won‘t take long until the site reloads and does not get into a loop.Including generated imagesInside yourindex.mdor any other Markdown file you can then reference any created image as usual:# My MkDocs Document## Example Plantuml Images![file](diagrams/out/file.svg)

![file1](diagrams/out/subdir1/file1.svg)Dark Mode SupportSince Version 1.4 this plugin can support dark mode when rendering withserver(prefers-color-scheme).Note: Not in local mode, only server rendering modeGrab a general (ie. forMaterial Theme) dark mode support css file (i.e. fromhenrywhitaker3/mkdocs-material-dark-theme) for your themeEnable theme support in this plugin:- build_plantuml:
     [...]
     theme_enabled: true
     theme_folder: "include/themes"
     theme_light: "light.puml"
     theme_dark: "dark.puml"You have to provide two puml theme files, ie mydarkmode.puml and mylightmode.pumlIn the out directory a<file>.<ext>will be created and additionally a<file>_dark.<ext>Insert your images in markdown with![file](diagrams/out/file.svg#darkable)(this selector is then used in theJS fileto know which images have to be exchanged)provideextra_javascriptfile which handles the switchYou can find an example in theexample folderExample OutputKnown restrictionsIf you use!includeand therender: "server"option, this plugin merges those files manually. If there are any issues or side effects because of that, please open a ticket.Dark mode / theme support is currently only available in server rendering mode.ContributingContributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.