DEV Community

Cover image for NextSketch 2: Save/Load your Sketches!
Mohammed for NextSketch

Posted on • Updated on

NextSketch 2: Save/Load your Sketches!

Happy December!

We've been working on being able to save and load your sketches inside the editor for the last 2 weeks! Getting it all to work took weeks of figuring out and wrestling with Serialization libraries but, after long last, we're finally here now!

For NextSketch 2, we decided to create a custom, human-readable format to describe the content of our Sketches. Say hello to our own mini-language...Horizon!

Horizon is a plain-text, extremely simple language for defining Sketches, and while we won't go too deep into how it works, if enough people are interested, we'll document it in the NextSketch 2 docs!

For example, a simple Node connected to a sub-diagram (we call them Containers), like this produces the following Horizon code:

Image description

In Horizon, this would be:

Canvas (0) {
    Node (2) [pos="865:413",color="30:30:30",text="I'm a Node!",shape="Rectangle",]
    Container (1) [pos="1255:412",color="0:89:255",text="And I'm a Container!",shape="Rectangle",canvas="1",]
    Link (0) [plug="2",socket="1",]
}
Canvas (1) {
    NodeRef (3) [pos="160:217",color="30:30:30",text="I'm a Node! <External>",shape="Rectangle",original="2",]
}


Enter fullscreen mode Exit fullscreen mode

Right now, our hand-rolled interpreter is a complete mess and needs cleanup (and error handling!) before we can declare it to be complete.

It's been a rough few weeks for us but we're glad we pulled through and got Horizon to work, ensuring that your diagrams stay usable outside of NextSketch!

Keep Building!

Top comments (2)

Collapse
 
cicirello profile image
Vincent A. Cicirello

Is this open source? If so can you add a link in the post to its repository?

Collapse
 
skyloft7 profile image
Mohammed

NextSketch 2 is a WIP commercial product. If you'd like to use Horizon to interop with NX2, let us know in the comments! If there's enough interest, we'll document how the language works.