claude-export
claude-export copied to clipboard
`OL` is not numbered correctly
Nodes other than li are enumerated, so ol is not numbered correctly.
It can be worked around by counting the numbers.
--- a/src/exportMarkdown.js
+++ b/src/exportMarkdown.js
@@ -43,12 +47,13 @@ const getContents = require("./util/getContents");
// Get list items
if (tag === "OL") {
- childNode.childNodes.forEach((listItemNode, index) => {
+ var index = 0;
+ childNode.childNodes.forEach((listItemNode) => {
if (
listItemNode.nodeType === Node.ELEMENT_NODE &&
listItemNode.tagName === "LI"
) {
- markdown += `${index + 1}. ${
+ markdown += `${++index}. ${
listItemNode.textContent
}\n`;
}