Skip to content

Commit 42d7db6

Browse files
committed
silence graphviz warnings, the hard way
1 parent 8f865f6 commit 42d7db6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core/handlers/dot.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,26 @@ const dotHandler: LanguageHandler = {
5454
options: Record<string, unknown>,
5555
) {
5656
const cellContent = handlerContext.cellContent(cell);
57+
5758
const graphvizModule = await import(
5859
resourcePath(join("js", "graphviz-wasm.js"))
5960
);
6061
let svg;
62+
const oldConsoleLog = console.log;
63+
const oldConsoleWarn = console.warn;
64+
console.log = () => {};
65+
console.warn = () => {};
6166
try {
6267
svg = await graphvizModule.graphviz().layout(
6368
cellContent.value,
6469
"svg",
6570
options["graph-layout"],
6671
);
72+
console.log = oldConsoleLog;
73+
console.warn = oldConsoleWarn;
6774
} catch (e) {
75+
console.log = oldConsoleLog;
76+
console.warn = oldConsoleWarn;
6877
const m = (e.message as string).match(
6978
/(.*)syntax error in line (\d+)(.*)/,
7079
);

0 commit comments

Comments
 (0)