claude-export icon indicating copy to clipboard operation
claude-export copied to clipboard

Changing `DIV` hierarchy

Open 7shi opened this issue 1 year ago • 0 comments

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

7shi avatar Apr 30 '24 12:04 7shi