@lobehub/ui 5.49.0 → 5.49.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.
@@ -25,6 +25,7 @@ interface TypographyProps extends DivProps {
25
25
  ref?: Ref<HTMLDivElement>;
26
26
  }
27
27
  interface SyntaxMarkdownProps {
28
+ /** Parse and render sanitized inline HTML in Markdown content. */
28
29
  allowHtml?: boolean;
29
30
  allowHtmlList?: ElementType[];
30
31
  animated?: boolean;
@@ -24,7 +24,7 @@ declare const styles: {
24
24
  declare const rootVariants: (props?: ({
25
25
  shadow?: boolean | null | undefined;
26
26
  size?: "large" | "middle" | "small" | null | undefined;
27
- variant?: "filled" | "borderless" | "outlined" | null | undefined;
27
+ variant?: "borderless" | "filled" | "outlined" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
29
  //#endregion
30
30
  export { rootVariants, styles };
@@ -6,11 +6,13 @@ import { rehypeKatexDir } from "../../Markdown/plugins/rehypeKatexDir.mjs";
6
6
  import { useMemo } from "react";
7
7
  import { rehypeGithubAlerts } from "rehype-github-alerts";
8
8
  import rehypeRaw from "rehype-raw";
9
+ import rehypeSanitize from "rehype-sanitize";
9
10
  //#region src/hooks/useMarkdown/useMarkdownRehypePlugins.ts
10
11
  const useMarkdownRehypePlugins = () => {
11
12
  const { enableLatex, enableCustomFootnotes, enableGithubAlert, allowHtml, rehypePlugins = [], rehypePluginsAhead = [] } = useMarkdownContext();
12
13
  const memoPlugins = useMemo(() => [
13
14
  allowHtml && rehypeRaw,
15
+ allowHtml && rehypeSanitize,
14
16
  enableGithubAlert && rehypeGithubAlerts,
15
17
  enableLatex && rehypeKatex,
16
18
  enableLatex && rehypeKatexDir,
@@ -1 +1 @@
1
- {"version":3,"file":"useMarkdownRehypePlugins.mjs","names":[],"sources":["../../../src/hooks/useMarkdown/useMarkdownRehypePlugins.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport rehypeRaw from 'rehype-raw';\nimport type { Pluggable } from 'unified';\n\nimport { useMarkdownContext } from '@/Markdown/components/MarkdownProvider';\nimport { rehypeCustomFootnotes } from '@/Markdown/plugins/rehypeCustomFootnotes';\nimport { rehypeKatex } from '@/Markdown/plugins/rehypeKatex';\nimport { rehypeKatexDir } from '@/Markdown/plugins/rehypeKatexDir';\n\nexport const useMarkdownRehypePlugins = (): Pluggable[] => {\n const {\n enableLatex,\n enableCustomFootnotes,\n enableGithubAlert,\n allowHtml,\n rehypePlugins = [],\n rehypePluginsAhead = [],\n } = useMarkdownContext();\n\n const memoPlugins = useMemo(\n () =>\n [\n allowHtml && rehypeRaw,\n enableGithubAlert && rehypeGithubAlerts,\n enableLatex && rehypeKatex,\n enableLatex && rehypeKatexDir,\n enableCustomFootnotes && rehypeCustomFootnotes,\n ].filter(Boolean) as Pluggable[],\n [enableLatex, enableGithubAlert, enableCustomFootnotes, allowHtml],\n );\n\n return useMemo(\n () => [...rehypePluginsAhead, ...memoPlugins, ...rehypePlugins],\n [rehypePlugins, memoPlugins, rehypePluginsAhead],\n );\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,iCAA8C;CACzD,MAAM,EACJ,aACA,uBACA,mBACA,WACA,gBAAgB,CAAC,GACjB,qBAAqB,CAAC,MACpB,mBAAmB;CAEvB,MAAM,cAAc,cAEhB;EACE,aAAa;EACb,qBAAqB;EACrB,eAAe;EACf,eAAe;EACf,yBAAyB;CAC3B,CAAC,CAAC,OAAO,OAAO,GAClB;EAAC;EAAa;EAAmB;EAAuB;CAAS,CACnE;CAEA,OAAO,cACC;EAAC,GAAG;EAAoB,GAAG;EAAa,GAAG;CAAa,GAC9D;EAAC;EAAe;EAAa;CAAkB,CACjD;AACF"}
1
+ {"version":3,"file":"useMarkdownRehypePlugins.mjs","names":[],"sources":["../../../src/hooks/useMarkdown/useMarkdownRehypePlugins.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { rehypeGithubAlerts } from 'rehype-github-alerts';\nimport rehypeRaw from 'rehype-raw';\nimport rehypeSanitize from 'rehype-sanitize';\nimport type { Pluggable } from 'unified';\n\nimport { useMarkdownContext } from '@/Markdown/components/MarkdownProvider';\nimport { rehypeCustomFootnotes } from '@/Markdown/plugins/rehypeCustomFootnotes';\nimport { rehypeKatex } from '@/Markdown/plugins/rehypeKatex';\nimport { rehypeKatexDir } from '@/Markdown/plugins/rehypeKatexDir';\n\nexport const useMarkdownRehypePlugins = (): Pluggable[] => {\n const {\n enableLatex,\n enableCustomFootnotes,\n enableGithubAlert,\n allowHtml,\n rehypePlugins = [],\n rehypePluginsAhead = [],\n } = useMarkdownContext();\n\n const memoPlugins = useMemo(\n () =>\n [\n allowHtml && rehypeRaw,\n // Parse untrusted HTML into nodes, then remove unsafe elements and attributes.\n allowHtml && rehypeSanitize,\n enableGithubAlert && rehypeGithubAlerts,\n enableLatex && rehypeKatex,\n enableLatex && rehypeKatexDir,\n enableCustomFootnotes && rehypeCustomFootnotes,\n ].filter(Boolean) as Pluggable[],\n [enableLatex, enableGithubAlert, enableCustomFootnotes, allowHtml],\n );\n\n return useMemo(\n () => [...rehypePluginsAhead, ...memoPlugins, ...rehypePlugins],\n [rehypePlugins, memoPlugins, rehypePluginsAhead],\n );\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAa,iCAA8C;CACzD,MAAM,EACJ,aACA,uBACA,mBACA,WACA,gBAAgB,CAAC,GACjB,qBAAqB,CAAC,MACpB,mBAAmB;CAEvB,MAAM,cAAc,cAEhB;EACE,aAAa;EAEb,aAAa;EACb,qBAAqB;EACrB,eAAe;EACf,eAAe;EACf,yBAAyB;CAC3B,CAAC,CAAC,OAAO,OAAO,GAClB;EAAC;EAAa;EAAmB;EAAuB;CAAS,CACnE;CAEA,OAAO,cACC;EAAC,GAAG;EAAoB,GAAG;EAAa,GAAG;CAAa,GAC9D;EAAC;EAAe;EAAa;CAAkB,CACjD;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "5.49.0",
3
+ "version": "5.49.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -199,6 +199,7 @@
199
199
  "react-zoom-pan-pinch": "^4.0.3",
200
200
  "rehype-github-alerts": "^4.2.0",
201
201
  "rehype-raw": "^7.0.0",
202
+ "rehype-sanitize": "^6.0.0",
202
203
  "remark-breaks": "^4.0.0",
203
204
  "remark-cjk-friendly": "^2.3.1",
204
205
  "remark-gfm": "^4.0.1",