It would be neat if the README or spec included links to some real-world examples of files - would be easier to start playing with building simple tools on top of this if there was already an example file to start experimenting with, without me having to learn Obsidian first. UPDATE: Figured out how to create one: 1. Install and then open Obsidian 2. Click the "Create new canvas" icon - third down of the icons on the…
JSON Canvas – An open file format for infinite canvas data
51–60 of 168 posts
Re: JSON Canvas – An open file format for infinite canvas data
#52I've worked a few jobs now where application data was stored in text files of various kinds (homegrown as well as well-defined formats, JSON included) and it pretty quickly becomes a mess when you start talking about modifying it over time, evolving its schema, validating it in the face of end-user edits, ensuring threads don't write to it concurrently, etc. This strikes me as exactly the type of application data tha…
I'm usually the first person to suggest SQLite for just about anything, but in this particular case I do feel like JSON is a better default format. Interacting with SQLite from different programming languages is easier than most other formats, but you still need a SQLite binding. They're available for every language but that's still a not-completely-trivial dependency. I expect most tools that people build against JS…
> Also: SQLite files aren't very easy to diff, so they're not great for collaboration in version control. JSON is better for that.
Yeah, if we're talking about diffing the literal file itself, then that changes things. At that point, we're not just talking about a storage format, we're talking about interchange as well. In that case I'd ask - of course this is application specific, not general - what data are we putting on the wire? Where does that data live?
For example, if the main state state lives in a your browser instance, and you ship updates (i.e., "CREATE", "EDIT", "DELETE" or some such) back and forth between collaborators, then diffing the state of whatever you have is fairly easy, SQLite or JSON or whatever else. But if we're shipping the actual file itself over the wire or attempting to version control it, then you're absolutely right and diffing the SQLite file is inferior.
There are some interesting tradeoffs in this space. This is a fun discussion!
Re: JSON Canvas – An open file format for infinite canvas data
#53I've worked a few jobs now where application data was stored in text files of various kinds (homegrown as well as well-defined formats, JSON included) and it pretty quickly becomes a mess when you start talking about modifying it over time, evolving its schema, validating it in the face of end-user edits, ensuring threads don't write to it concurrently, etc. This strikes me as exactly the type of application data tha…
Crucial context: its provenance is embedded infinite canvas in Obsidian (amazing markdown-based notes app++), which supports JS but has no external datastore per se. SQLite is fantastic, but inappropriate for this use case.
Re: JSON Canvas – An open file format for infinite canvas data
#54Earlier quoted context omitted.
Yeah, other details are missing too. For example backgroundStyle : > cover fills the entire width and height of the node. Does that work like the CSS background-size: cover; or background-size: 100% 100%; ? > ratio maintains the aspect ratio of the background image. Does that mean CSS cover ? contain ? Something else?
Colors can be specified in hex format, e.g. "#FFFFFF". Six preset colors exist, mapped to the following numbers: 1 red 2 orange 3 yellow 4 green 5 cyan 6 purple I'm sure everyone will infer the same color codes here. Maybe the file format isn't meant to reproduce the exact same look in different software, but merely communicate user intent. Your guess is as good as mine.
Re: JSON Canvas – An open file format for infinite canvas data
#55Earlier quoted context omitted.
This is always a tough spot in JSON, I think. You want the `id` in the node or edge object, but you also want uniqueness. I don't think there's a great way to get this any be able to just `JSON.parse()` and go without further fixup.
What do you concretely gain from embedding the id within the object?
Re: JSON Canvas – An open file format for infinite canvas data
#56It would be neat if the README or spec included links to some real-world examples of files - would be easier to start playing with building simple tools on top of this if there was already an example file to start experimenting with, without me having to learn Obsidian first. UPDATE: Figured out how to create one: 1. Install and then open Obsidian 2. Click the "Create new canvas" icon - third down of the icons on the…
If you hit "toggle output" on the bottom right, it shows a JSON Canvas representation of the page's content.
Re: JSON Canvas – An open file format for infinite canvas data
#57I really like the idea of a format for interchange between infinite canvas apps, but the preset colors and list of node types makes this spec feel strangely opinionated. You could build something like Kinopio [1] but not much beyond that. It looks really promising though! I'm definitely interested in seeing this grow. [1] https://kinopio.club
Thinking about it, I'm not sure any interchange spec would leave useful room for innovation. This isn't like EPS or PDF or something where the kind of output is well-defined (printable graphics + text) and the innovation is in the editing interface. The innovation in canvas apps is surely in the semantics of the nodes themselves; but if you add some new node type with special behavior, how can you usefully export tha…
Then, conforming implementations could render any document just by following the instructions, while editors that actually understand them can provide their own high-level control.
The trick is keeping it editable, which postscript doesn’t do well.
Example: if the language is strong enough to, say, implement force-directed node layout, an editor that doesn’t understand it could still add nodes and they would move around according to the document author’s wishes whereas perhaps the original editor might have more powerful editing capabilities.
Re: JSON Canvas – An open file format for infinite canvas data
#58If ids are unique strings, then why are `nodes` and `edges` arrays, as opposed to id-string-keyed maps?
Re: JSON Canvas – An open file format for infinite canvas data
#59Earlier quoted context omitted.
If you hit "toggle output" on the bottom right, it shows a JSON Canvas representation of the page's content.
Is that an icon? I can't seem to find it (Obsidian 1.4.16 on macOS)