Replies: 1 comment 1 reply
-
Rather than compare bytes, have you considered using a semantic differ? For example, dyff is pretty decent at this. Pkl's YAML renderer will try to produce "normal" looking YAML, but our goal isn't necessarily to allow users to format their YAML a certain way. Especially because YAML's strings have so, so many different forms. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I was wondering how difficult it would be to implement at custom YAML renderer or add some options to the built in one?
My use case is, that I'm trying to build a small Pkl library that generates a set of different project configuration files that has previously been maintained manually (initially generated from a template and then copy pasted around).
To verify that my Pkl code generates identical output it would be very helpful if I could hint certain formatting options to make diffing easier.
My major pain points are currently:
Indenting of list items
Where the intellij formatter (in default configuration) adds an extra indent before the '-'.
So Pkl generates:
And an intellij formatted file looks like:
Quoted string encoding
It seems like Pkl only quotes when required and always uses single quotes and then double-single-quotes for single quotes inside the string (here it would be nice with an option to use double quotes). As in:
vs
This could also be done by a post processor (I did look into using spottless gradle plugin after the pkl plugin and it does handle some of my problems but it does require some maintenance if I only want to apply it to the files that Pkl touched).
Would it be difficult to add options to the built in YamlRenderer to customize these things? And would such changes be accepted?
I did have a peek at the java code and could not find a simple configuration option for snakeyaml, but I could have overlooked something.
Beta Was this translation helpful? Give feedback.
All reactions