Closed JimmyRittenborg closed 8 years ago
I'm not sure exactly how you anticipate the structured data being stored in Markdown, but I've planned to move over to YAML for a while, now. This would allow a better, human-readable storage scheme, more in line with Kirby's Structure field.
Unfortunately, there seems to be reasonably wide adoption (despite notices in the Readme!), so a sudden change in master
might well upset some developers and administrators. I'd like to run YAML storage in an alternate branch aimed at a 1.0 release… We'll see.
So instead of a cold-turkey - could it be softly solved in some way along the lines like this?
Check for a if the current value already is JSON
public function isJson($string) {
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
}
if it's true
use JSON else just use YAML - the change will be better now than later, i think :see_no_evil:
Currently we can't use straight out
if( $page->location()->isNotEmpty() ):
in templates to check if the a map should be showed, because the field will after a save, always contain JSON regardless if it's filled or not :grin:
Should have updated this thread when I started working on the switch, but as of cde31391aa148d410a9b47315103c5116d7a03d2, data is stored in YAML!
Why is the location data stored in JSON over markdown in the markdown files?
Can't we keep the data clean and readable in the markdown format - some people edits the content through dropbox.