Mermaid rendering to docx halts indefinitely when run through command prompt or RStudio #6085
Unanswered
Gewerd-Strauss
asked this question in
Q&A
Replies: 3 comments 5 replies
-
Addendum: Graphviz diagrams via ---
creation date: 2023-07-02 09:26
modification date: 2023-07-02 09:26
tags:
- vault
---
```{dot}
digraph G {
start [shape=Mdiamond,color=red,bgcolor=red,style=filled];
subgraph cluster_0 {
color=red
bgcolor=violet
node [style=filled,color=white];
a0 -> a1 -> a2 -> a3;
label = "process #1";
}
subgraph cluster_1 {
node [style=filled];
b0 -> b1 -> b2 -> b3;
b0 -> a3
label = "process #2";
color=yellow
bgcolor="red"
}
end [shape=Msquare,color=green,style=filled];
start -> a0;
start -> b0;
a1 -> b3;
b2 -> a3;
a3 -> b0
a3 -> a0;
a3 -> end;
b3 -> end;
}
```
exhibits the same problem, launching 3 chrome instances which must be killed for code execution to resume. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I believe this to be an issue with using Chrome to convert the diagrams into static images. FYI: |
Beta Was this translation helpful? Give feedback.
2 replies
-
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hello,
I am experiencing a weird issue where converting a
.qmd
-doc with mermaid syntax todocx
will halt code execution indefinitely by not closing the launched-therefore chrome.exe-instances required for mermaid rendering. From an automation perspective, this is obviously really bad.Files and commands issued for a MWE
The document used for testing purposes:
This doc is converted using the following
build.R
-script1:And finally, this is the command I feed2 to
cmd.exe
kicking the whole thing off:Background
The
build.R
-script and the command fed to the cmd prompt are auto-generated by a self-written autohotkey script34. This procedure has been working flawlessly for rmarkdown and bookdown packages called by running the RScript shown above from the command line.I have been recently made aware of the existence of quarto, and have since been implementing it into my script. While playing around with the features Quarto has over RMarkdown this issues occured.
QMD-documents not containing Mermaid syntax will get rendered completely successfully for both docx and html.
I did not yet test for PDF (mostly because I just don't need pdf-outputs in 99.5% of my life, so no real priority in my limited time).
Pre-execution shows no chrome-processes running via System Informer:

When the docx-file gets generated, three instances of chrome.exe get launched:

Of those three chrome instances, two will have the same parent PID, and one will not. Forcefully killing the process with a unique parent PID will result in the script execution to continue, therefore generating the following codelines and giving the other intended document outputs.
Killing either of the two chrome instances with identical PID will not do anything.
Killing the unique PID will resolve the issue. It will also kill the remaining two processes automatically.
Not killing any processes and rerunning the build.R script after the docx-file is generated will again result in the docx-file to be generated, and launch an additional 3 chrome.exe processes. As before, there will be one with a unique parent PID. As before, killing that will result in this running instance to continue running.
So... I got little idea what is actually going on here, or why this happens.
Any help and suggestions are welcome.
I'll happily provide more information if required.
Info dump
R version as given by
version
via the build.R-script executed:Complete return given by the execution of
build.R
:Return of
quarto check
via command prompt:Footnotes
Note that the final line throwing an error on
print(all_times)
is intentional in this case. It has nothing to do with the issue, and removing the infringing line will not yield different results. ↩Sidenote: When automated via my script, the function
GetStdStreams_WithInput()
will execute the command directly, without going through cmd.exe itself. Does not yield different results. ↩AHK is windows-only ↩
Specifically, this branch ↩
Beta Was this translation helpful? Give feedback.
All reactions