-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control over indentation with the |json filter #192
Comments
It cannot, but you can define user-defined filters, which sounds like a good fit for your particular issue? There's a little bit of documentation about the feature here: |
That sounds good - I just reviewed the json filter, and it looks like I could relatively easily make a non-pretty JSON filter (or a YAML filter, but I guess I'd need indentation info from the caller of the filter) (: |
To answer your question more directly: no, you cannot, but based on this single request I don't think I want to change stuff built-in to Askama if the user-defined filter provides good (possibly better? -- you can do an actual YAML filter) cover for your needs. Also I'd be okay with having an optional |
Closing this for now, since it looks like your problem has been solved! |
(Just to make it better, the next release will feature an optional |
Thanks, this is great! |
Hi there, I use askama to great effect with the
cargo-template-ci
crate (to create yaml for various CI services), and have run into a little weirdness - it's not a blocker, but my aesthetics still feel like this could be better.When I use the
something|json
filter, the output is indented JSON - that works OK in yaml for me, but it looks really weird - I'd much prefer if the JSON output was just a single line, rather than (legally but weirdly) outdented yaml.Can the filter function be configured to do that?
The text was updated successfully, but these errors were encountered: