@snack-uikit/markdown 0.5.42 → 0.5.44

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Markdown",
7
- "version": "0.5.42",
7
+ "version": "0.5.44",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -35,16 +35,16 @@
35
35
  "license": "Apache-2.0",
36
36
  "scripts": {},
37
37
  "dependencies": {
38
- "@snack-uikit/code-editor": "0.7.12",
39
- "@snack-uikit/divider": "3.2.10",
40
- "@snack-uikit/fields": "0.51.14",
41
- "@snack-uikit/link": "0.17.15",
42
- "@snack-uikit/toggles": "0.13.23",
43
- "@snack-uikit/typography": "0.8.11",
44
- "@snack-uikit/utils": "4.0.0",
38
+ "@snack-uikit/code-editor": "0.7.13",
39
+ "@snack-uikit/divider": "3.2.11",
40
+ "@snack-uikit/fields": "0.51.15",
41
+ "@snack-uikit/link": "0.17.16",
42
+ "@snack-uikit/toggles": "0.13.24",
43
+ "@snack-uikit/typography": "0.8.12",
44
+ "@snack-uikit/utils": "4.0.1",
45
45
  "classnames": "2.5.1",
46
46
  "react-markdown": "7.1.1",
47
47
  "remark-gfm": "3.0.1"
48
48
  },
49
- "gitHead": "4de5382fadcce4bc5c8ee3b51f792ce0499356e4"
49
+ "gitHead": "ead33312875be117fa347cae9acf307fb65842b0"
50
50
  }
@@ -1,4 +1,4 @@
1
- import ReactMarkdown, { Components } from 'react-markdown';
1
+ import ReactMarkdown, { Components, Options } from 'react-markdown';
2
2
  import remarkGfm from 'remark-gfm';
3
3
 
4
4
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
@@ -15,16 +15,41 @@ export type MarkdownProps = WithSupportProps<{
15
15
  components?: Components;
16
16
  /** Действие при клике на кнопку копирования кода */
17
17
  onCopyClick?(): void;
18
+ /**
19
+ * Игнор HTML в Markdown
20
+ * @default true
21
+ */
22
+ skipHtml?: boolean;
23
+ /**
24
+ * Список remark плагинов для использования.
25
+ * @see {@link https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins | Список remark плагинов}
26
+ */
27
+ remarkPlugins?: Options['remarkPlugins'];
28
+ /**
29
+ * Список rehype плагинов для использования.
30
+ * @see {@link https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins | Список rehype плагинов}
31
+ */
32
+ rehypePlugins?: Options['rehypePlugins'];
18
33
  }>;
19
34
 
20
- export function Markdown({ value, className, onCopyClick, components = {}, ...rest }: MarkdownProps) {
35
+ export function Markdown({
36
+ value,
37
+ className,
38
+ onCopyClick,
39
+ skipHtml = true,
40
+ remarkPlugins = [],
41
+ rehypePlugins,
42
+ components = {},
43
+ ...rest
44
+ }: MarkdownProps) {
21
45
  return (
22
46
  <div className={className} {...extractSupportProps(rest)}>
23
47
  {value && (
24
48
  <ReactMarkdown
25
49
  className={styles.markdown}
26
- remarkPlugins={[remarkGfm]}
27
- skipHtml
50
+ remarkPlugins={[remarkGfm, ...remarkPlugins]}
51
+ rehypePlugins={rehypePlugins}
52
+ skipHtml={skipHtml}
28
53
  components={{
29
54
  code: props => <Code {...props} onClick={onCopyClick} />,
30
55
  table: Table,