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

Is there a way to force a large diagram to fit a page in mdbook with this add-on? #79

Closed GeoffMurray closed 1 year ago

GeoffMurray commented 1 year ago

We have some diagrams where they are currently sligthly long for the page output when we also generate PDF from the source.

Do you have any suggestions for trying to get an image to fit ?

sytsereitsma commented 1 year ago

The only thing I can think of is adding a CSS stylesheet to the book with a max-height property for images. Unfortunately this will affect all images in the book. In your css file:

img {
  max-height:500px
}

And in your book you should add an additional-css line to the html renderer configuration.

GeoffMurray commented 1 year ago

We found something similar, eventually. Posting in case useful for others. We are using this for now. In our case, we want it to be the maxium of the page size in height, but no more. We wanted that consistent across all our created diagrams. Seems to be working very well for us.

<style>
img {
    max-height: 100vh;
    display: block;
    margin: 0 auto;
}
</style>