Skip to content

Commit 635c59b

Browse files
committed
Fixes #37 - redirect stderr to file
1 parent 56e6276 commit 635c59b

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,11 @@ function firstExisting(paths, error) {
134134
error();
135135
}
136136

137-
pandoc.toJSONFilter(mermaid);
137+
pandoc.toJSONFilter(function(type, value, format, meta) {
138+
// redirect stderr to file - if it logs to stdout, then pandoc hangs due to improper json
139+
errFile = path.join(folder, "mermaid-filter.err");
140+
errorLog = fs.createWriteStream(errFile);
141+
var origStdErr = process.stderr.write;
142+
process.stderr.write = errorLog.write.bind(errorLog);
143+
return mermaid(type, value, format, meta);
144+
});

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ sequenceDiagram
2929
John-->>Alice: Great!
3030
```
3131

32+
Bug #37
33+
-------------------
34+
35+
```{.mermaid}
36+
graph LR;
37+
A-->B;
38+
click A callback "Tooltip for a callback"
39+
click B "http://www.github.com" "This is a tooltip for a link"
40+
```

0 commit comments

Comments
 (0)