Live data from Hacker News

JSON Canvas Spec (2024)

jsoncanvas.org

21–30 of 43 posts

Re: JSON Canvas Spec (2024)

#21
post #5

Are pixels really the best way to encode position at this point?

It strikes me as odd that boxes are placed precisely using pixels, but the size of text is not specified, as far as I can tell. So you use real pixels to specify boxes, but still can't render a canvas exactly/consistently?

Re: JSON Canvas Spec (2024)

#22
post #19

I feel like this page does a good job of telling me nothing. It's a representation of a graph? Where each node can be a text string or a file or a URL or a container of other nodes? And somehow these links and files and containers have a color? What is the purpose of this? Why would I want my file to be blue?

Perhaps the home page is more useful than the spec to explain the purpose of the file format: https://jsoncanvas.org/

See also the original inspiration for the format: https://obsidian.md/canvas

Re: JSON Canvas Spec (2024)

#24
Really cool to see JSON Canvas getting attention. (Hi, kepano!) It was one of the inspirations for OCIF (Open Canvas Interchange Format), which we've been working on since JSON Canvas came out.

JSON Canvas nails the simplicity-it's easy to read and easy to implement. We wanted to build on that spirit while tackling some of the challenges showing up in this thread: nested canvases, extensibility for custom app data, text styling, coordinate systems, and round-tripping between different canvas apps without data loss.

OCIF v0.7.0 just came out. It's designed to be an interchange format — so different canvas tools (Excalidraw, TLDraw, Obsidian, etc.) can export/import each other's canvases.

Some highlights:

- Extensible: apps can attach their own data via extensions, so nothing gets lost even if the features aren't supported

- Nested canvases via parent-child node relationships

- Local coordinate systems (addresses the pixel positioning concerns raised in another comment here)

- Text styling, viewport control, and more via built-in extensions

If JSON Canvas isn't quite meeting your needs, OCIF[1] might be worth a look.

https://canvasprotocol.org

Re: JSON Canvas Spec (2024)

#25
post #17

I've used canvas quite a bit since it was release in Obsidian. It's good, not great, but the simplicity of the file type opens up a lot of opportunities to build on top of it.

What would make it great in your eyes?

Not OP, but I use canvas all the time (Thank you!) in preference to something like Miro because I really value the open format and being able to keep the file. Something that really holds me back is the inability to use different shapes for the nodes - a use case for me is creating flow charts and process diagrams, so being unable to use the standard shapes for those is a challenge.

Still the best option though!

Re: JSON Canvas Spec (2024)

#26

Why use this instead of SVG?

It's interactive, for starters. You can do that with SVG, of course, but the boilerplate required would be larger than the `.canvas` file. You can externalize the boilerplate, but then you're no longer creating portable SVG files, and if we're going to create an SVG-like DSL we may as well try out this JSON-like DSL.

Re: JSON Canvas Spec (2024)

#27
post #25
post #17

Earlier quoted context omitted.

What would make it great in your eyes?

Not OP, but I use canvas all the time (Thank you!) in preference to something like Miro because I really value the open format and being able to keep the file. Something that really holds me back is the inability to use different shapes for the nodes - a use case for me is creating flow charts and process diagrams, so being unable to use the standard shapes for those is a challenge. Still the best option though!

Yeah I agree! In the meantime Advanced Canvas plugin might help:

https://github.com/Developer-Mike/obsidian-advanced-canvas

Re: JSON Canvas Spec (2024)

#28

Earlier quoted context omitted.

ah ok, sorry about that. I didn't really look at that part of the UI much, noticed it had some zoom stuff, noticed I couldn't zoom normally and scroll to where I wanted to read, was somewhat miffed.

Curious to know what “zoom normally” means for you. For me, it’s ctrl+mouse wheel or maybe two finger pinch/pull on trackpad. I am thoroughly confused as to why GitHub’s mermaid integration doesn’t seem to support any zoom outside of the overlay controls which…ick

ctrl+mouse wheel triggers the application zoom in most cases. However, if my mouse is over the scrollable node, it invokes the Google Chrome window zoom (so I end up with two competing zoom transforms). It also zooms relative to the upper left corner, rather than relative to my cursor (seems the app doesn't support panning?). The background dots also move and change size as I zoom (subtle but somewhat distracting).

Re: JSON Canvas Spec (2024)

#29
I don't use canvas in Obsidian. Tried it when it was released, but haven't used it since. I like Obsidian and want to get the most out of it. I'm curious as too how folks are using canvas in Obsidian.

Re: JSON Canvas Spec (2024)

#30
post #19

I feel like this page does a good job of telling me nothing. It's a representation of a graph? Where each node can be a text string or a file or a URL or a container of other nodes? And somehow these links and files and containers have a color? What is the purpose of this? Why would I want my file to be blue?

It's a reinvention of SVG with all the same problems. JSON is not any better in terms of data efficiency or fast updating. It's like these people have never done graphics programming.
Post reply on HN