Sorry, we don't support your browser.  Install a modern browser
This post is closed.

Make blocks data a bit more readable in text files#517

Because it can be useful to review data in text files and not only via the panel UI, it would be great if the blocks serialization was a bit more human friendly.

Currently it’s stored as a JSON array in a single line:

MyField: [{"content": {}, "id": "41793082-67cc-4aa3-9b3d-ec49512b8f58", "isHidden": false, "type": "heading"},{"content": {}, "id": "52032388-147b-4140-9d7b-f51cfd3d6cc6", "isHidden": false, "type": "text"},{"content": {},"id": "fcadde7b-1808-4872-8ff5-36781e4a9234", "isHidden": false, "type": "text"}]

It could help to serialize it by putting each block on its own line, like this:

MyField: [
{"content": {}, "id": "41793082-67cc-4aa3-9b3d-ec49512b8f58", "isHidden": false, "type": "heading"},
{"content": {}, "id": "52032388-147b-4140-9d7b-f51cfd3d6cc6", "isHidden": false, "type": "text"},
{"content": {},"id": "fcadde7b-1808-4872-8ff5-36781e4a9234", "isHidden": false, "type": "text"}

That way:

  • if you version content files with git, you can get more meaningfull diffs;
  • if you want to make a manual content tweak, it’s easier to find a specific block.
a year ago

Not exactly like you propose, but you can use the pretty: true prop in the blueprint definition of the blocks field, which will pretty-print the JSON in the content file.

a year ago

Oh, good to know!

a year ago
Changed the status to
a year ago
Changed the status to
a year ago