@vertigis/react-ui 21.7.4 → 21.8.0
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/Markdown/Markdown.d.ts +5 -0
- package/Markdown/Markdown.js +3 -2
- package/package.json +2 -1
package/Markdown/Markdown.d.ts
CHANGED
|
@@ -48,6 +48,11 @@ export interface MarkdownProps extends BoxProps {
|
|
|
48
48
|
* applied to the output. Defaults to `false`.
|
|
49
49
|
*/
|
|
50
50
|
useBasicHtml?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Adds support for the extensions found in GitHub Flavored Markdown.
|
|
53
|
+
* Defaults to `true`.
|
|
54
|
+
*/
|
|
55
|
+
useGitHubFlavoredMarkdown?: boolean;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* A component that renders markdown as React nodes.
|
package/Markdown/Markdown.js
CHANGED
|
@@ -5,6 +5,7 @@ import { useMemo } from "react";
|
|
|
5
5
|
import ReactMarkdown, {} from "react-markdown";
|
|
6
6
|
import rehypeRaw from "rehype-raw";
|
|
7
7
|
import rehypeSanitize from "rehype-sanitize";
|
|
8
|
+
import remarkGfm from "remark-gfm";
|
|
8
9
|
import Box from "../Box/index.js";
|
|
9
10
|
import Link, {} from "../Link/index.js";
|
|
10
11
|
import Typography, {} from "../Typography/index.js";
|
|
@@ -75,7 +76,7 @@ const disallowedInlineElements = [
|
|
|
75
76
|
* However, it is still recommended to set `escapeHtml` to true with untrusted
|
|
76
77
|
* content.
|
|
77
78
|
*/
|
|
78
|
-
const Markdown = ({ markdown, inline, escapeHtml, sanitize, linkTarget = "_blank", children, className, useBasicHtml, ...otherProps }) => {
|
|
79
|
+
const Markdown = ({ markdown, inline, escapeHtml, sanitize, linkTarget = "_blank", children, className, useBasicHtml, useGitHubFlavoredMarkdown = true, ...otherProps }) => {
|
|
79
80
|
const theme = useTheme();
|
|
80
81
|
const disallowedElements = useMemo(() => (inline ? disallowedInlineElements : []), [inline]);
|
|
81
82
|
const components = useMemo(() => useBasicHtml
|
|
@@ -132,6 +133,6 @@ const Markdown = ({ markdown, inline, escapeHtml, sanitize, linkTarget = "_blank
|
|
|
132
133
|
}, variant: "body1" }));
|
|
133
134
|
},
|
|
134
135
|
}, [linkTarget, theme, useBasicHtml]);
|
|
135
|
-
return (_jsx(Box, { component: inline ? "span" : "div", className: clsx("GcxMarkdown", className), ...otherProps, children: _jsx(ReactMarkdown, { components: components, disallowedElements: disallowedElements, rehypePlugins: escapeHtml ? [] : [rehypeRaw, rehypeSanitize], children: children && typeof children === "string" ? children : markdown }) }));
|
|
136
|
+
return (_jsx(Box, { component: inline ? "span" : "div", className: clsx("GcxMarkdown", className), ...otherProps, children: _jsx(ReactMarkdown, { components: components, disallowedElements: disallowedElements, rehypePlugins: escapeHtml ? [] : [rehypeRaw, rehypeSanitize], remarkPlugins: useGitHubFlavoredMarkdown ? [remarkGfm] : [], children: children && typeof children === "string" ? children : markdown }) }));
|
|
136
137
|
};
|
|
137
138
|
export default Markdown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertigis/react-ui",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.8.0",
|
|
4
4
|
"description": "Utilities and React components used in VertiGIS applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vertigis",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"react-markdown": "^10.1.0",
|
|
31
31
|
"rehype-raw": "^7.0.0",
|
|
32
32
|
"rehype-sanitize": "^6.0.0",
|
|
33
|
+
"remark-gfm": "^4.0.1",
|
|
33
34
|
"tslib": "^2.6.2",
|
|
34
35
|
"xss": "^1.0.15"
|
|
35
36
|
},
|