Closed bharatrajagopalan closed 2 years ago
Hi @bharatrajagopalan, thanks for your PR. It's now merged in the develop branch. I've done some fixes in tests and small refactors / cleanups in the code (PEP warnings, splitting big methods, etc.). Take a look if seems ok for you.
Thanks @mikitex70 ! Any view on when this gets released formally as part of the plugin?
Hi @mikitex70
Changelog below. Hopefully, I have ticked the boxes in terms of the process you require for this PR. Let me know if you need me to do anything else.
My basic use case is running this with mkdocs and a private plantuml server as part of backstage setup while getting full functionality such as
!include
which works with local jarNew include preprocessor for remote server
Borrowing the logic from https://github.com/quantorconsulting/mkdocs_build_plantuml where !include statements are recursively converted to plantuml text and merged into one big file to be sent to the server so that this behaves just like the local jar version (currently this just fails)
Over and above the logic taken from mkdocs_build_plantuml, the include pre-processor also parses lines ensuring that
@startuml
and@enduml
from included files are removed and only are attached to the beginning and end of the total payload sent to the server.POST method support
With the new include preprocessor, there is the danger that the plantuml url for get requests can get too large and hence there is also the option to turn on POST method if the plantuml server supports it. The official one doesn't support POST so I spun up a private server to test this along with mkdocs-markdown.
This also includes fallback to GET if POST fails - this basically checks the error code back from POST and anything that is not ok (400 or higher) is attempted with GET. Note that this doesn't work with plantuml.com as they actually respond to POST with a 200 code but just send regular HTML page back. But works just fine with a private server.
The other interesting bit I noted was that POST is stricter than GET e.g. it mandates the
@startuml
and @enduml tags.Default theme support
Essentially you can specifiy a default theme using
theme
as part of config which internally attaches the!theme
directive at the beginning of the file. Since the theme command can result in errors when used with specific plantuml commands - there is a configurable exception listpuml_notheme_cmdlist
also setupDockerfile for testing
I had trouble running the tests on my local due to dependencies, so I basically took the travis file already in theand used it to create a docker test image which has all the dependencies based on python alpine to ensure that the size remained small. I don't have access to travis ci (not free since 2020 unfortunately).
Test output