@snack-uikit/markdown 0.5.43 → 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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## <small>0.5.44 (2026-02-04)</small>
7
+
8
+ * feat(PDS-3492): added opportunity inject plugins to Markdown ([01bf82d](https://github.com/cloud-ru-tech/snack-uikit/commit/01bf82d))
9
+
10
+
11
+
12
+
13
+
6
14
  ## <small>0.5.43 (2026-01-19)</small>
7
15
 
8
16
  * chore(FF-6693): migrate tests from TestCafe to Playwright ([f32aff8](https://github.com/cloud-ru-tech/snack-uikit/commit/f32aff8))
package/README.md CHANGED
@@ -98,6 +98,9 @@ function Example() {
98
98
  | className | `string` | - | CSS-класс |
99
99
  | components | `Partial<Omit<NormalComponents, keyof SpecialComponents> & SpecialComponents>` | {} | Переопределение компонентов по умолчанию и добавление новых в CodeEditor |
100
100
  | onCopyClick | `() => void` | - | Действие при клике на кнопку копирования кода |
101
+ | skipHtml | `boolean` | true | Игнор HTML в Markdown |
102
+ | remarkPlugins | `PluggableList` | [] | Список remark плагинов для использования. @see {@link https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins Список remark плагинов} |
103
+ | rehypePlugins | `PluggableList` | - | Список rehype плагинов для использования. @see {@link https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins Список rehype плагинов} |
101
104
  ## MarkdownEditor
102
105
  ### Props
103
106
  | name | type | default value | description |
@@ -1,4 +1,4 @@
1
- import { Components } from 'react-markdown';
1
+ import { Components, Options } from 'react-markdown';
2
2
  import { WithSupportProps } from '@snack-uikit/utils';
3
3
  export type MarkdownProps = WithSupportProps<{
4
4
  /** Текст c разметкой */
@@ -9,5 +9,20 @@ export type MarkdownProps = WithSupportProps<{
9
9
  components?: Components;
10
10
  /** Действие при клике на кнопку копирования кода */
11
11
  onCopyClick?(): void;
12
+ /**
13
+ * Игнор HTML в Markdown
14
+ * @default true
15
+ */
16
+ skipHtml?: boolean;
17
+ /**
18
+ * Список remark плагинов для использования.
19
+ * @see {@link https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins | Список remark плагинов}
20
+ */
21
+ remarkPlugins?: Options['remarkPlugins'];
22
+ /**
23
+ * Список rehype плагинов для использования.
24
+ * @see {@link https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins | Список rehype плагинов}
25
+ */
26
+ rehypePlugins?: Options['rehypePlugins'];
12
27
  }>;
13
- export declare function Markdown({ value, className, onCopyClick, components, ...rest }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare function Markdown({ value, className, onCopyClick, skipHtml, remarkPlugins, rehypePlugins, components, ...rest }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
@@ -28,16 +28,20 @@ function Markdown(_a) {
28
28
  value,
29
29
  className,
30
30
  onCopyClick,
31
+ skipHtml = true,
32
+ remarkPlugins = [],
33
+ rehypePlugins,
31
34
  components = {}
32
35
  } = _a,
33
- rest = __rest(_a, ["value", "className", "onCopyClick", "components"]);
36
+ rest = __rest(_a, ["value", "className", "onCopyClick", "skipHtml", "remarkPlugins", "rehypePlugins", "components"]);
34
37
  return (0, jsx_runtime_1.jsx)("div", Object.assign({
35
38
  className: className
36
39
  }, (0, utils_1.extractSupportProps)(rest), {
37
40
  children: value && (0, jsx_runtime_1.jsx)(react_markdown_1.default, {
38
41
  className: styles_module_scss_1.default.markdown,
39
- remarkPlugins: [remark_gfm_1.default],
40
- skipHtml: true,
42
+ remarkPlugins: [remark_gfm_1.default, ...remarkPlugins],
43
+ rehypePlugins: rehypePlugins,
44
+ skipHtml: skipHtml,
41
45
  components: Object.assign({
42
46
  code: props => (0, jsx_runtime_1.jsx)(helperComponents_1.Code, Object.assign({}, props, {
43
47
  onClick: onCopyClick
@@ -5,7 +5,6 @@
5
5
  padding-right:var(--space-markdown-preview-padding, 14px);
6
6
  border-radius:var(--radius-markdown-preview-container, 4px);
7
7
  border-width:var(--border-width-markdown-preview-container, 1px);
8
- border-style:solid;
9
8
  }
10
9
  .viewWrapper[data-validation=default]{
11
10
  background-color:var(--sys-neutral-background1-level, #fdfdfd);
@@ -39,6 +38,9 @@
39
38
  border-color:var(--sys-red-accent-default, #cb3f3e);
40
39
  outline-color:var(--sys-red-decor-activated, #fbab99);
41
40
  }
41
+ .viewWrapper{
42
+ border-style:solid;
43
+ }
42
44
 
43
45
  .editor{
44
46
  display:flex;
@@ -1,4 +1,4 @@
1
- import { Components } from 'react-markdown';
1
+ import { Components, Options } from 'react-markdown';
2
2
  import { WithSupportProps } from '@snack-uikit/utils';
3
3
  export type MarkdownProps = WithSupportProps<{
4
4
  /** Текст c разметкой */
@@ -9,5 +9,20 @@ export type MarkdownProps = WithSupportProps<{
9
9
  components?: Components;
10
10
  /** Действие при клике на кнопку копирования кода */
11
11
  onCopyClick?(): void;
12
+ /**
13
+ * Игнор HTML в Markdown
14
+ * @default true
15
+ */
16
+ skipHtml?: boolean;
17
+ /**
18
+ * Список remark плагинов для использования.
19
+ * @see {@link https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins | Список remark плагинов}
20
+ */
21
+ remarkPlugins?: Options['remarkPlugins'];
22
+ /**
23
+ * Список rehype плагинов для использования.
24
+ * @see {@link https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins | Список rehype плагинов}
25
+ */
26
+ rehypePlugins?: Options['rehypePlugins'];
12
27
  }>;
13
- export declare function Markdown({ value, className, onCopyClick, components, ...rest }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare function Markdown({ value, className, onCopyClick, skipHtml, remarkPlugins, rehypePlugins, components, ...rest }: MarkdownProps): import("react/jsx-runtime").JSX.Element;
@@ -16,6 +16,6 @@ import { extractSupportProps } from '@snack-uikit/utils';
16
16
  import { Blockquote, Code, Divider, Link, Table } from '../../helperComponents';
17
17
  import styles from './styles.module.css';
18
18
  export function Markdown(_a) {
19
- var { value, className, onCopyClick, components = {} } = _a, rest = __rest(_a, ["value", "className", "onCopyClick", "components"]);
20
- return (_jsx("div", Object.assign({ className: className }, extractSupportProps(rest), { children: value && (_jsx(ReactMarkdown, { className: styles.markdown, remarkPlugins: [remarkGfm], skipHtml: true, components: Object.assign({ code: props => _jsx(Code, Object.assign({}, props, { onClick: onCopyClick })), table: Table, hr: Divider, blockquote: Blockquote, a: Link }, components), children: value })) })));
19
+ var { value, className, onCopyClick, skipHtml = true, remarkPlugins = [], rehypePlugins, components = {} } = _a, rest = __rest(_a, ["value", "className", "onCopyClick", "skipHtml", "remarkPlugins", "rehypePlugins", "components"]);
20
+ return (_jsx("div", Object.assign({ className: className }, extractSupportProps(rest), { children: value && (_jsx(ReactMarkdown, { className: styles.markdown, remarkPlugins: [remarkGfm, ...remarkPlugins], rehypePlugins: rehypePlugins, skipHtml: skipHtml, components: Object.assign({ code: props => _jsx(Code, Object.assign({}, props, { onClick: onCopyClick })), table: Table, hr: Divider, blockquote: Blockquote, a: Link }, components), children: value })) })));
21
21
  }
@@ -5,7 +5,6 @@
5
5
  padding-right:var(--space-markdown-preview-padding, 14px);
6
6
  border-radius:var(--radius-markdown-preview-container, 4px);
7
7
  border-width:var(--border-width-markdown-preview-container, 1px);
8
- border-style:solid;
9
8
  }
10
9
  .viewWrapper[data-validation=default]{
11
10
  background-color:var(--sys-neutral-background1-level, #fdfdfd);
@@ -39,6 +38,9 @@
39
38
  border-color:var(--sys-red-accent-default, #cb3f3e);
40
39
  outline-color:var(--sys-red-decor-activated, #fbab99);
41
40
  }
41
+ .viewWrapper{
42
+ border-style:solid;
43
+ }
42
44
 
43
45
  .editor{
44
46
  display:flex;