1
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings' ;
1
2
import { ConstructorBlock , PageContent } from '@gravity-ui/page-constructor' ;
2
3
import { contentTransformer } from '@gravity-ui/page-constructor/server' ;
3
4
import yaml from 'js-yaml' ;
@@ -16,15 +17,17 @@ type TransformPageContentPropsType = {
16
17
lang : Lang ;
17
18
region ?: string ;
18
19
typographyConfig ?: TypographyConfigType ;
20
+ plugins ?: MarkdownItPluginCb [ ] ;
19
21
} ;
20
22
21
23
type TransformBlocksPropsType = {
22
24
blocks : ConstructorBlock [ ] ;
23
25
lang : Lang ;
24
26
typographyConfig ?: TypographyConfigType ;
27
+ plugins ?: MarkdownItPluginCb [ ] ;
25
28
} ;
26
29
27
- const transformer = ( { blocks, lang, typographyConfig} : TransformBlocksPropsType ) =>
30
+ const transformer = ( { blocks, lang, typographyConfig, plugins } : TransformBlocksPropsType ) =>
28
31
contentTransformer ( {
29
32
content : {
30
33
blocks : blocks || [ ] ,
@@ -35,6 +38,7 @@ const transformer = ({blocks, lang, typographyConfig}: TransformBlocksPropsType)
35
38
...typographyConfig ,
36
39
...getExtendTypographyConfig ( ) ,
37
40
} ,
41
+ plugins,
38
42
} ,
39
43
} ) ;
40
44
@@ -45,13 +49,15 @@ const transformer = ({blocks, lang, typographyConfig}: TransformBlocksPropsType)
45
49
* @param lang - runtime app lang
46
50
* @param region - runtime app region
47
51
* @param typographyConfig - page-constructor extend typography config
52
+ * @param plugins - YFM plugins
48
53
* @returns transformed content
49
54
*/
50
55
export const transformPageContent = ( {
51
56
content,
52
57
lang,
53
58
region,
54
59
typographyConfig = { } ,
60
+ plugins,
55
61
} : TransformPageContentPropsType ) => {
56
62
try {
57
63
const transformedContent = filterContent ( yaml . load ( content ) as PageContent , { lang, region} ) ;
@@ -61,6 +67,7 @@ export const transformPageContent = ({
61
67
blocks : transformedContent . blocks ,
62
68
lang,
63
69
typographyConfig,
70
+ plugins,
64
71
} ) ;
65
72
66
73
transformedContent . blocks = transformedBlocks ;
0 commit comments