claude-export
claude-export copied to clipboard
Changing `DIV` hierarchy
The div has been added to the chat body and firstChild cannot be retrieved properly.
I can get the content by going down one level.
--- a/src/exportMarkdown.js
+++ b/src/exportMarkdown.js
@@ -15,8 +15,12 @@ const getContents = require("./util/getContents");
var ele = elements[i];
// Get first child
- var firstChild = ele.firstChild;
- if (!firstChild) continue;
+ var firstChild = ele;
+ if (firstChild.firstChild?.tagName === "DIV") {
+ firstChild = firstChild.firstChild;
+ if (firstChild.firstChild?.tagName === "DIV") firstChild = firstChild.firstChild;
+ }
+ if (!firstChild.firstChild) continue;
// Element child
if (firstChild.nodeType === Node.ELEMENT_NODE) {
Note: Update 2024/06/17