tigion/nvim-asciidoc-preview

Bug: Created Diagram (mermaid) does not update

Closed this issue · 5 comments

Issue:

If you have a diagram, in my case mermaid, that you'd like to preview, it only renders it once. Any updates are not reflected in the rendered graph.

What i tried:

I tried changing the browser, changing the server converter from js to cmd and other similar things, like disabling the browser cache. None worked.

System:

  • MacOS with M1 / ARM
  • Neovim 0.10
  • Node 22.2.0
  • Asciidoctor 2.0.23 [https://asciidoctor.org] Runtime Environment (ruby 3.3.2 (2024-05-30 revision e5a195edf6) [arm64-darwin22]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
  • Browser: LibreWolf, Waterfox, Firefox, Chrome latest versions

Steps to reproduce

Use an example document like the following, preview it, then make changes to the graph. You will see that the text version updates, but not the rendered graph.

= Diagram Mermaid Sample

.Mermaid graph
[source,zsh]
----
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
D --> E
D --> E
----

Hm ... I can't reproduce the error. If I use your example in an Asciidoctor file like this (Diagram Blocks):

.Mermaid graph
[mermaid]
// [mermaid, "example-mermaid", svg]
....
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
D --> E
D --> E
....

It is displayed correctly and after a change and saving, the change is also displayed correctly in the preview.

How is the diagram integrated in the Asciidoctor file?

Note

The preview is updated every time the AsciiDoc file is saved.

bug

This is indeed a bit odd. I tried to showcase it in the attached recording. On the bottom you see chrome, on the right is Firefox.

You can see me editing, saving then it updates - but only the text. The picture might be a bit small, but you see that the text changes, the pages refresh (text got longer) but nothing happens to the graph.

Chrome is a fresh install, no changes.

Please send me your AsciiDoc file (content as a code block or file as an attachment) so that I can test it with your exact example.

EDIT: I found the issue. It seems it is a caching issue on mac, although i am not sure what caused it. I reinstalled asciidoctor, node, chrome, Firefox via brew and it is gone.

Closed by author, as reason could not be found, but was solved after reinstalling all dependencies on Mac via brew