sytsereitsma / mdbook-plantuml

mdBook preprocessor to render PlantUML diagrams to png images in the book output directory
MIT License
76 stars 14 forks source link

Support for custom configurations / themes #25

Closed Jonas-Heinrich closed 2 years ago

Jonas-Heinrich commented 2 years ago

Hey sytsereitsma,

I love your plugin!

plantuml itself has more configuration options I would like to use, like setting a global config file (-config "filename.conf"). As far as I can see, this is not supported for plantuml picoweb servers, which means that I would have to include custom styling options (like themes etc.) into every markdown code block to enforce it with this plugin when using a picoweb url as plantuml-cmd.

Would it be possible to add a custom configuration option (e.g. in the book.toml), that just contains a path to a configuration file? The content of this file could then simply be prepended on each plantuml webserver invocation, e.g. in render_string.

A more dynamic approach for keeping in sync with the mdbook theme would be even better, but I think this could add a lot of complexity. One approach building on the previous idea could be to add a configuration option which maps mdbook theme names to their plantuml config file paths (with fallback). I'm not even sure if mdbook passes the theme name to plugins however..

Ah, the joy of wanting to support different people with/without darkmode 😄

Anyways, Thank you, Jonas

sytsereitsma commented 2 years ago

Hi Jonas. Nice idea. Can you provide an example?

sytsereitsma commented 2 years ago

I see plantuml now provides support for this, see https://plantuml.com/theme Example:

@startuml
!theme spacelab
class Example {
  Theme spacelab
}
@enduml