html2md4llm 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const inlineElements = ['span', 'a', 'strong', 'em', 'code', 'b', 'i'];
|
|
2
|
-
const blockElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul', 'ol', 'pre', 'br', 'div', 'section', 'table'];
|
|
2
|
+
const blockElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul', 'ol', 'pre', 'br', 'hr', 'img', 'div', 'section', 'table'];
|
|
3
3
|
const tableSections = ['thead', 'tbody', 'tfoot'];
|
|
4
4
|
|
|
5
5
|
function normalizeTableCell(text) {
|
|
@@ -114,7 +114,7 @@ export function generate(node, indent = 0) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// If only one child and no special handling for this tag, pass through transparently
|
|
117
|
-
const hasSpecialHandling = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul', 'ol', 'pre', 'br', 'strong', 'b', 'em', 'i', 'code', 'a'].includes(tag);
|
|
117
|
+
const hasSpecialHandling = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'ul', 'ol', 'pre', 'br', 'hr', 'strong', 'b', 'em', 'i', 'code', 'a'].includes(tag);
|
|
118
118
|
if (children.length === 1 && !hasSpecialHandling) {
|
|
119
119
|
return generate(children[0], indent);
|
|
120
120
|
}
|
|
@@ -206,6 +206,7 @@ export function generate(node, indent = 0) {
|
|
|
206
206
|
|
|
207
207
|
// Line break
|
|
208
208
|
if (tag === 'br') return '\n';
|
|
209
|
+
if (tag === 'hr') return '---';
|
|
209
210
|
|
|
210
211
|
// Default: just return children
|
|
211
212
|
return childText;
|