@readme/markdown 9.1.6 → 9.2.1
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/components/HTMLBlock/index.tsx +5 -3
- package/dist/main.js +30263 -42592
- package/dist/main.node.js +18 -20
- package/dist/main.node.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
2
|
|
|
4
3
|
const MATCH_SCRIPT_TAGS = /<script\b[^>]*>([\s\S]*?)<\/script *>\n?/gim;
|
|
5
4
|
|
|
@@ -21,11 +20,14 @@ interface Props {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const HTMLBlock = ({ children = '', runScripts, safeMode = false }: Props) => {
|
|
24
|
-
|
|
23
|
+
if (typeof children !== 'string') {
|
|
24
|
+
throw new TypeError('HTMLBlock: children must be a string');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const html = children;
|
|
25
28
|
// eslint-disable-next-line no-param-reassign
|
|
26
29
|
runScripts = typeof runScripts !== 'boolean' ? runScripts === 'true' : runScripts;
|
|
27
30
|
|
|
28
|
-
if (typeof html !== 'string') html = renderToStaticMarkup(html);
|
|
29
31
|
const [cleanedHtml, exec] = extractScripts(html);
|
|
30
32
|
|
|
31
33
|
useEffect(() => {
|