Fixes cyclic error
parent
fc6165000c
commit
5a022ae6a0
|
@ -3,6 +3,7 @@ import {
|
||||||
collectNodesOfType,
|
collectNodesOfType,
|
||||||
findNodeOfType,
|
findNodeOfType,
|
||||||
ParseTree,
|
ParseTree,
|
||||||
|
removeParentPointers,
|
||||||
renderToText,
|
renderToText,
|
||||||
traverseTree,
|
traverseTree,
|
||||||
} from "$sb/lib/tree.ts";
|
} from "$sb/lib/tree.ts";
|
||||||
|
@ -414,15 +415,20 @@ function render(
|
||||||
body: t.children![0].text!.slice(1),
|
body: t.children![0].text!.slice(1),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case "Entity":
|
||||||
|
return t.children![0].text!;
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
case undefined:
|
case undefined:
|
||||||
return t.text!;
|
return t.text!;
|
||||||
default:
|
default:
|
||||||
if (options.failOnUnknown) {
|
if (options.failOnUnknown) {
|
||||||
|
removeParentPointers(t);
|
||||||
console.error("Not handling", JSON.stringify(t, null, 2));
|
console.error("Not handling", JSON.stringify(t, null, 2));
|
||||||
throw new Error(`Unknown markdown node type ${t.type}`);
|
throw new Error(`Unknown markdown node type ${t.type}`);
|
||||||
} else {
|
} else {
|
||||||
// Falling back to rendering verbatim
|
// Falling back to rendering verbatim
|
||||||
|
removeParentPointers(t);
|
||||||
console.warn("Not handling", JSON.stringify(t, null, 2));
|
console.warn("Not handling", JSON.stringify(t, null, 2));
|
||||||
return renderToText(t);
|
return renderToText(t);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue