@mdream/js
Advanced tools
+21
-10
@@ -1028,7 +1028,18 @@ import { a as NO_SPACING, c as TABLE_ROW_SPACING, g as TagIdMap, i as LIST_ITEM_SPACING, t as BLOCKQUOTE_SPACING } from "./const.mjs"; | ||
| } else if (nextCharCode === SLASH_CHAR) { | ||
| const inQuotes = state.inSingleQuote || state.inDoubleQuote || state.inBacktick; | ||
| if (state.currentNode?.tagHandler?.isNonNesting && inQuotes) { | ||
| textBuffer += htmlChunk[i]; | ||
| i++; | ||
| continue; | ||
| if (state.currentNode?.tagHandler?.isNonNesting) { | ||
| if (state.inSingleQuote || state.inDoubleQuote || state.inBacktick) { | ||
| textBuffer += htmlChunk[i]; | ||
| i++; | ||
| continue; | ||
| } | ||
| let peekEnd = i + 2; | ||
| while (peekEnd < chunkLength) { | ||
| const c = htmlChunk.charCodeAt(peekEnd); | ||
| if (c === GT_CHAR || isWhitespace(c)) break; | ||
| peekEnd++; | ||
| } | ||
| if ((TagIdMap[htmlChunk.substring(i + 2, peekEnd).toLowerCase()] ?? -1) !== state.currentNode.tagId) { | ||
| textBuffer += htmlChunk[i++]; | ||
| continue; | ||
| } | ||
| } | ||
@@ -1062,10 +1073,6 @@ if (textBuffer.length > 0) { | ||
| const tagName = htmlChunk.substring(tagNameStart, tagNameEnd).toLowerCase(); | ||
| if (!tagName) { | ||
| i = tagNameEnd; | ||
| break; | ||
| } | ||
| const tagId = TagIdMap[tagName] ?? -1; | ||
| i2 = tagNameEnd; | ||
| if (state.currentNode?.tagHandler?.isNonNesting) { | ||
| if (tagId !== state.currentNode?.tagId) { | ||
| if (!tagName || tagId !== state.currentNode?.tagId) { | ||
| textBuffer += htmlChunk[i++]; | ||
@@ -1075,2 +1082,6 @@ continue; | ||
| } | ||
| if (!tagName) { | ||
| textBuffer += htmlChunk[i++]; | ||
| continue; | ||
| } | ||
| if (textBuffer.length > 0) { | ||
@@ -1077,0 +1088,0 @@ processTextBuffer(textBuffer, state, handleEvent); |
+1
-1
| { | ||
| "name": "@mdream/js", | ||
| "type": "module", | ||
| "version": "1.0.0-beta.12", | ||
| "version": "1.0.0-beta.14", | ||
| "description": "JavaScript HTML-to-Markdown engine for mdream. Escape hatch for hooks and edge runtimes.", | ||
@@ -6,0 +6,0 @@ "author": { |
164951
0.22%3760
0.29%