@marvalt/wparser 0.1.58 → 0.1.59
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/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +16 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/defaultRegistry.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2437,6 +2437,22 @@ const Paragraph = ({ block, context }) => {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
// If innerHTML contains HTML elements but no shortcodes, render it directly (preserves links, formatting, etc.)
|
|
2439
2439
|
if (hasHTML && block.innerHTML) {
|
|
2440
|
+
// Check if innerHTML already contains a paragraph tag - if so, extract content to avoid double nesting
|
|
2441
|
+
const trimmedContent = htmlContent.trim();
|
|
2442
|
+
if (trimmedContent.startsWith('<p') && trimmedContent.endsWith('</p>')) {
|
|
2443
|
+
// Extract content from paragraph tag
|
|
2444
|
+
const contentMatch = trimmedContent.match(/<p[^>]*>(.*?)<\/p>/s);
|
|
2445
|
+
if (contentMatch) {
|
|
2446
|
+
const innerContent = contentMatch[1];
|
|
2447
|
+
// Check if inner content also has a paragraph (double nesting)
|
|
2448
|
+
if (innerContent.trim().startsWith('<p')) {
|
|
2449
|
+
// Render as div to avoid invalid HTML
|
|
2450
|
+
return jsxRuntimeExports.jsx("div", { className: buildClassName(spacing, textAlign, textColorClass, fontSizeClass), dangerouslySetInnerHTML: { __html: innerContent } });
|
|
2451
|
+
}
|
|
2452
|
+
// Render the extracted content in a paragraph
|
|
2453
|
+
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign, textColorClass, fontSizeClass), dangerouslySetInnerHTML: { __html: innerContent } });
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2440
2456
|
return jsxRuntimeExports.jsx("p", { className: buildClassName(spacing, textAlign, textColorClass, fontSizeClass), dangerouslySetInnerHTML: { __html: htmlContent } });
|
|
2441
2457
|
}
|
|
2442
2458
|
// No HTML and no shortcodes, just render plain text content
|