Back to News
Advertisement
eengomez about 20 hours ago 4 commentsRead Article on github.com

FR version is available. Content is displayed in original English for accuracy.

Hi HN, Nick here, founder at OpenKnowledge. We built an open source library, Visimer, for editing Mermaid diagrams with a what-you-see-is-what-you-get visual editor. Try the playground at https://visimer.com/playground. You can rename labels, change shapes, add new nodes, etc. by clicking and dragging the visual canvas.

We set out to build this originally for OpenKnowledge, our markdown wysiwyg editor, then realized it’d be great to share it as a proper embeddable component library so that other apps can leverage it as well.

Our general take is that AI is great for generating content, but whenever you want to tweak fine details, for example to create an artifact sharable with others, point-edit functionality is much better. We built Visimer to bring that to Mermaid diagrams, just like we did for markdown.

Some technical bits:

- Leverages the native Mermaid.js renderer for visualizing the Mermaid diagram true to how it’s intended. We add point-edit functionality on top.

- We tried re-generating the entire file on every edit, but found that it would eat comments and formatting, etc. The final approach maps the rendered SVG elements back to a CST, so we can then edit only the parts of the file that should change.

You can pair the visual editor with any text-editor so you can have both visual and code-level editor experiences. The library provides bindings for Monaco and CodeMirror and is extensible. There's also a low-level headless version.

If you just care about being able to edit your Mermaid diagrams in your markdown, you can try it in the OpenKnowledge app (our OSS markdown IDE, available as Mac/Linux/Windows apps).

Let us know what you think.

Advertisement

⚡ Community Insights

Discussion Sentiment

67% Positive

Analyzed from 96 words in the discussion.

Trending Topics

#whole#diagrams#nice#mermaid#sometimes#blog#posts#whenever#small#change

Discussion (4 Comments)Read Original on HackerNews

cdieck88about 2 hours ago
Nice one! I use Mermaid sometimes in my blog posts. Whenever I make a small change, I have to run `astro build` to see the result in the generated HTML. With your editor, the whole process should be much faster.
jumpalongjimabout 3 hours ago
I’m out and about so haven’t tried this yet, but sounds like your context is an embedded diagram. For free diagrams (.mmd files) I find AI creation and editing to be highly effective.
ltononroabout 3 hours ago
This is ridiculously useful in the era of AI. They keep generating near-to-good diagrams with always some two or three minor annoying pieces that you'd like to correct. Genious idea, congrats!
grommet_kitabout 6 hours ago
Mapping SVG back to a CST instead of regenerating the whole file is the right call. Preserving comments matters.