Closed autra closed 2 years ago
Thanks! 🎉
Would it be possible to create a release with this change? This looks really nice to have.
Is there an example of how to set plantuml-format=png
? The obvious thing (similar to plantuml-filename
) doesn't seem to be valid
@autra did this ever work? :sweat_smile: i try to run it like this ->
pandoc --variable=plantuml-format:svg tests/sample.md -t json -s | pandoc-plantuml
and by debugging i see meta is an empty dict {}
.
I can kinda get it to work with --metadata
pandoc --metadata=plantuml-format:svg tests/sample.md -t json -s | pandoc-plantuml
It will ultimately fail because the pformat["c"][0]["c"] is slightly different.
It did when I tested 😆 I agree it's not a guarantee though... I forgot how I tested though. Maybe with the front matter of a md file?
Weird I feel this could have never worked i even tested an old pandoc version
.local/bin/bin/pandoc --version
pandoc 2.14
And I mean the docs state
But unlike --variable, --metadata affects the metadata of the underlying document (which is accessible from filters and may be printed in some output formats) and metadata values will be escaped when inserted into the template.
Assuming from your comment you stopped using it? :sweat_smile:
I think I would just change it to use --metadata
to do it, but if you have any chance to figure out why that worked or how would be amazing
Hi, what's the status on this?
I would try to look into it sometime if noone already is on it.
I took a look at it and it seemed hairy to me. Maybe I'm wrong but the Pandoc plugin API looked very deficient to me.
My plan was to just use --metadata
but if you have the time to figure out if we could use --variables
would be interesting,
I came to the conclusion that it is not possible and never was but somehow something worked in the past :sweat_smile:
@fliiiix my memory kinda came back to me and I've made some tests: it does work with the following test document and command:
---
title: foo
plantuml-format: svg
---
test:
- foo
- bar
```{.plantuml caption="PlantUML example" #my-label}
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
pandoc --filter=pandoc-plantuml -o test.pdf test.md
So setting up the var in the front matter was how I tested and what I wanted to achieve. There really might be better way, I don't know :-)
I'm not using this filter any more (we have our own lua filter that supports many more diagram engines all at the same time.
Thanks for sharing @autra :tada: that makes so much more sense. Using the metadata flag for that or embed the metadata directly into the document is probably the only way that works.
So @lukaspanni if you want to work on it feel free otherwise i will probably look at it at some point :)
@fliiiix For my use case, having the metadata in the file actually makes more sense, so I won't look into that.
In relation to https://github.com/timofurrer/pandoc-plantuml-filter/issues/13, and especially @MyriaCore's suggestion.
This allows to specify preferred format through the whole document via the variable
plantuml-format
.