MikhailKravets / mkdocs_puml

Inline PlantUML diagrams in your MkDocs documentation
MIT License
27 stars 7 forks source link

preserveAspectRatio is incorrect and not configurable #43

Open dev-artisan opened 2 months ago

dev-artisan commented 2 months ago

Describe the bug When using mkdocs-exporter plugin to export to PDF, the process errors during PDF creation saying:

preserveAspectRatio has invalid value "true"

To Reproduce Steps to reproduce the behavior:

  1. Install the mkdocs-exporter
  2. Export a page to PDF that has a puml diagram
  3. Check logs
  4. See error

Expected behavior The error should not appear and the preserveAspectRatio attribute of the svg should be configurable using the skinparam option provided by plantuml e.g.

@startuml
skinparam preserveAspectRatio xMinYMid slice
@enduml

See valid options for attribute here.

Additional context The issue seems to be a hard override here: https://github.com/MikhailKravets/mkdocs_puml/blob/master/mkdocs_puml/puml.py#L126C27-L126C46

dev-artisan commented 2 months ago

Suggestion: Perhaps just remove the line that is forcing it to "true"

MikhailKravets commented 2 months ago

Hi @dev-artisan, thanks for raising this issue!

If we remove a preserveAspectRatio propetry from SVG, diagrams will not be correctly displayed in web-site (by default). Perhaps, it'll be better to embed an aspect ratio settings in puml itself. I'll research this problem a bit more.

dev-artisan commented 2 months ago

Suggested solution in the below pull request:

https://github.com/MikhailKravets/mkdocs_puml/pull/45