yuzutech / kroki

Creates diagrams from textual descriptions!
https://kroki.io
MIT License
2.83k stars 211 forks source link

Store "try" editor state in url for easy editing. #1134

Closed arronmabrey closed 2 years ago

arronmabrey commented 2 years ago

Howdy 👋

Loving the app, thanks for making this.

I had once been the owner of graphviz.io and built something similar to this (but just for graphviz). It could do different embedding using very similar urls. One of the features I had and thought it was really great. Was when you edited anything in the editor (similar the the "try" section of kroki) it would live update the diagram like yours. However, I would base64 the text/code of the graph into the url as hash data (using something like #ABC-the-base64-data-DEF) This is very similar you how you encode the urls for the different outputs. (maybe this could be another output target called "try") But in my case, it worked with storing the editor state as well. I could copy the url and drop it into another browser and the text/code editor would be re-hydrated ready for more edits.

Maybe this already exists and I'm missing it. Would love to know your thoughts.

Thanks, -- Arron

ggrossetie commented 2 years ago

Hey Arron!

Loving the app, thanks for making this.

You're welcome 😉

I had once been the owner of graphviz.io and built something similar to this (but just for graphviz). It could do different embedding using very similar urls. One of the features I had and thought it was really great. Was when you edited anything in the editor (similar the the "try" section of kroki) it would live update the diagram like yours. However, I would base64 the text/code of the graph into the url as hash data (using something like #ABC-the-base64-data-DEF) This is very similar you how you encode the urls for the different outputs. (maybe this could be another output target called "try") But in my case, it worked with storing the editor state as well. I could copy the url and drop it into another browser and the text/code editor would be re-hydrated ready for more edits. Maybe this already exists and I'm missing it. Would love to know your thoughts.

This is somehow related to: https://github.com/yuzutech/kroki/issues/706 While I can see the benefit of such feature, I don't want to add it unless Kroki provide a good diagram editor. The "Try" section is merely a text area to get a taste of what Kroki can do. It's by no means a diagram editor and I would not recommend to write/edit diagrams on https://kroki.io/. Instead, I would recommend to use a plain-text format (such as AsciiDoc or Markdown) and a text editor or IDE to write/edit diagrams (preferably using a version control such as git).

In other words, I don't want to encourage people to edit diagrams on kroki.io by providing an "edit URL".

As mentioned in #706, in my mind, a good diagram editor must provide auto-completion, syntax highlighting, error/warning notifications, suggestions, inline documentation, and more... Since Kroki supports more than a dozen diagram libraries it would take a considerable amount of time and effort.

Having said that, you can use https://niolesk.top/ which is developed by a community member.

arronmabrey commented 2 years ago

That totally makes sense, and thanks for the feedback! And for the link to https://niolesk.top/