After using the $page->update() function to change some fields via a frontend form, the format of the page.txt file changes from:
title: My blog post
----
color: green
----
text: Hello there, how are you?
to:
title: My blog post
----
color: green
----
text: Hello there, how are you today?
Although the extra carriage returns between fields and separators don’t affect anything programming-wise, they make reading the page.txt file a bit less comfortable. They’re also inconsistent with the condensed format used throughout the Docs.
Is this something that could/should be changed either manually or via a tweak to /core/page.php?
As you wrote, the two formats are identical for Kirby as Kirby trims all whitespace at the start and end of the field when loading the content files.
If you don’t want to have the newlines, you would have to change this line in the Toolkit Data class. You don’t have to modify the Kirby code though. Instead you can put this into your config.php to override the built-in function:
It’s just a matter of taste. As far as I know, the “official” format changed with Kirby 2 because it separates the fields more clearly, but if you like the condensed format better, go for it. We probably won’t change the default though.
I guess it’s sort of like the spaces vs tabs debate. After seeing the condensed format used throughout the Docs I guess seeing the new official format just threw me off.
Yes, I think it’s what you are used to. I used to write my text files in the condensed format as well, and found the carriage returns a bit annoying. But then I started to write Kirby documentation, and I quickly got used to the format with extra lines, and now I actually prefer having that extra bit of space.