@uiw/react-md-editor 3.14.3 → 3.14.4

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.
@@ -53,7 +53,7 @@ export default function Markdown(props) {
53
53
  mdStr = rehype().data('settings', {
54
54
  fragment: true
55
55
  }).use(rehypePrism, {
56
- ignoreMissing: false
56
+ ignoreMissing: true
57
57
  }).processSync(mdStr).toString();
58
58
  } catch (error) {}
59
59
  }
@@ -40,7 +40,7 @@
40
40
  "../../../src/components/TextArea/Markdown.tsx"
41
41
  ],
42
42
  "sourcesContent": [
43
- "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: false })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
43
+ "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
44
44
  ],
45
45
  "mappings": "AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,OAAvC,QAAsD,OAAtD;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,mBAAxB;AAEA,SAASC,aAAT,QAA8B,eAA9B;;;AAEA,SAASC,WAAT,CAAqBC,KAArB,EAAoC;EAClC,OAAOA,KAAK,CACTC,OADI,CACI,qDADJ,EAC4DC,GAAD,IAAiB;IAC/E,OAAOA,GAAG,CAACD,OAAJ,CACL,QADK,EAEJE,CAAD,IAAgB,CAAC;MAAE,KAAK,MAAP;MAAe,KAAK,MAApB;MAA4B,KAAK,OAAjC;MAA0C,KAAK;IAA/C,CAAD,EAAsFA,CAAtF,CAFX,CAAP;EAID,CANI,EAOJF,OAPI,CAQH,QARG,EASFE,CAAD,IAAgB,CAAC;IAAE,KAAK,MAAP;IAAe,KAAK,MAApB;IAA4B,KAAK,OAAjC;IAA0C,KAAK;EAA/C,CAAD,EAAsFA,CAAtF,CATb,CAAP;AAWD;;AAID,eAAe,SAASC,QAAT,CAAkBC,KAAlB,EAAwC;EACrD,IAAM;IAAEC;EAAF,IAAgBD,KAAtB;EACA,IAAM;IAAEE,QAAQ,GAAG,EAAb;IAAiBC,eAAjB;IAAkCC;EAAlC,IAA+ChB,UAAU,CAACK,aAAD,CAA/D;EACA,IAAMY,MAAM,gBAAGlB,KAAK,CAACmB,SAAN,EAAf;EACAjB,SAAS,CAAC,MAAM;IACd,IAAIgB,MAAM,CAACE,OAAP,IAAkBH,QAAtB,EAAgC;MAC9BA,QAAQ,CAAC;QAAEI,WAAW,EAAEH,MAAM,CAACE;MAAtB,CAAD,CAAR;IACD,CAHa,CAId;;EACD,CALQ,EAKN,EALM,CAAT;EAOA,OAAOjB,OAAO,CAAC,MAAM;IACnB,IAAI,CAACY,QAAL,EAAe;MACb,oBAAO;QAAK,GAAG,EAAEG,MAAV;QAAkB,SAAS,EAAKJ,SAAL;MAA3B,EAAP;IACD;;IACD,IAAIQ,KAAK,uCAAoCR,SAApC,0EAA+GP,WAAW,CACjIQ,QADiI,CAA1H,oBAAT;;IAIA,IAAIC,eAAJ,EAAqB;MACnB,IAAI;QACFM,KAAK,GAAGlB,MAAM,GACXmB,IADK,CACA,UADA,EACY;UAAEC,QAAQ,EAAE;QAAZ,CADZ,EAELC,GAFK,CAEDpB,WAFC,EAEY;UAAEqB,aAAa,EAAE;QAAjB,CAFZ,EAGLC,WAHK,CAGOL,KAHP,EAILM,QAJK,EAAR;MAKD,CAND,CAME,OAAOC,KAAP,EAAc,CAAE;IACnB;;IAED,oBAAO7B,KAAK,CAAC8B,aAAN,CAAoB,KAApB,EAA2B;MAChCC,SAAS,EAAE,qBADqB;MAEhCC,uBAAuB,EAAE;QAAEC,MAAM,EAAEX,KAAK,IAAI;MAAnB;IAFO,CAA3B,CAAP;EAID,CAtBa,EAsBX,CAACP,QAAD,EAAWG,MAAX,EAAmBJ,SAAnB,CAtBW,CAAd;AAuBD"
46
46
  }
@@ -73,7 +73,7 @@ function Markdown(props) {
73
73
  mdStr = (0, _rehype.rehype)().data('settings', {
74
74
  fragment: true
75
75
  }).use(_rehypePrismPlus["default"], {
76
- ignoreMissing: false
76
+ ignoreMissing: true
77
77
  }).processSync(mdStr).toString();
78
78
  } catch (error) {}
79
79
  }
@@ -40,7 +40,7 @@
40
40
  "../../../src/components/TextArea/Markdown.tsx"
41
41
  ],
42
42
  "sourcesContent": [
43
- "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: false })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
43
+ "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
44
44
  ],
45
45
  "mappings": ";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAEA,SAASA,WAAT,CAAqBC,KAArB,EAAoC;EAClC,OAAOA,KAAK,CACTC,OADI,CACI,qDADJ,EAC2D,UAACC,GAAD,EAAiB;IAC/E,OAAOA,GAAG,CAACD,OAAJ,CACL,QADK,EAEL,UAACE,CAAD;MAAA,OAAiB;QAAE,KAAK,MAAP;QAAe,KAAK,MAApB;QAA4B,KAAK,OAAjC;QAA0C,KAAK;MAA/C,CAAD,CAAsFA,CAAtF,CAAhB;IAAA,CAFK,CAAP;EAID,CANI,EAOJF,OAPI,CAQH,QARG,EASH,UAACE,CAAD;IAAA,OAAiB;M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AS,EAAE,qBADqB;MAEhCC,uBAAuB,EAAE;QAAEC,MAAM,EAAEb,KAAK,IAAI;MAAnB;IAFO,CAA3B,CAAP;EAID,CAtBM,EAsBJ,CAACV,QAAD,EAAWG,MAAX,EAAmBN,SAAnB,CAtBI,CAAP;AAuBD"
46
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-md-editor",
3
- "version": "3.14.3",
3
+ "version": "3.14.4",
4
4
  "description": "A markdown editor with preview, implemented with React.js and TypeScript.",
5
5
  "homepage": "https://uiwjs.github.io/react-md-editor/",
6
6
  "author": "kenny wang <wowohoo@qq.com>",
@@ -43,7 +43,7 @@ export default function Markdown(props: MarkdownProps) {
43
43
  try {
44
44
  mdStr = rehype()
45
45
  .data('settings', { fragment: true })
46
- .use(rehypePrism, { ignoreMissing: false })
46
+ .use(rehypePrism, { ignoreMissing: true })
47
47
  .processSync(mdStr)
48
48
  .toString();
49
49
  } catch (error) {}