1+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings' ;
12import { ConstructorBlock , PageContent } from '@gravity-ui/page-constructor' ;
23import { contentTransformer } from '@gravity-ui/page-constructor/server' ;
34import yaml from 'js-yaml' ;
@@ -16,15 +17,17 @@ type TransformPageContentPropsType = {
1617 lang : Lang ;
1718 region ?: string ;
1819 typographyConfig ?: TypographyConfigType ;
20+ plugins ?: MarkdownItPluginCb [ ] ;
1921} ;
2022
2123type TransformBlocksPropsType = {
2224 blocks : ConstructorBlock [ ] ;
2325 lang : Lang ;
2426 typographyConfig ?: TypographyConfigType ;
27+ plugins ?: MarkdownItPluginCb [ ] ;
2528} ;
2629
27- const transformer = ( { blocks, lang, typographyConfig} : TransformBlocksPropsType ) =>
30+ const transformer = ( { blocks, lang, typographyConfig, plugins } : TransformBlocksPropsType ) =>
2831 contentTransformer ( {
2932 content : {
3033 blocks : blocks || [ ] ,
@@ -35,6 +38,7 @@ const transformer = ({blocks, lang, typographyConfig}: TransformBlocksPropsType)
3538 ...typographyConfig ,
3639 ...getExtendTypographyConfig ( ) ,
3740 } ,
41+ plugins,
3842 } ,
3943 } ) ;
4044
@@ -45,13 +49,15 @@ const transformer = ({blocks, lang, typographyConfig}: TransformBlocksPropsType)
4549 * @param lang - runtime app lang
4650 * @param region - runtime app region
4751 * @param typographyConfig - page-constructor extend typography config
52+ * @param plugins - YFM plugins
4853 * @returns transformed content
4954 */
5055export const transformPageContent = ( {
5156 content,
5257 lang,
5358 region,
5459 typographyConfig = { } ,
60+ plugins,
5561} : TransformPageContentPropsType ) => {
5662 try {
5763 const transformedContent = filterContent ( yaml . load ( content ) as PageContent , { lang, region} ) ;
@@ -61,6 +67,7 @@ export const transformPageContent = ({
6167 blocks : transformedContent . blocks ,
6268 lang,
6369 typographyConfig,
70+ plugins,
6471 } ) ;
6572
6673 transformedContent . blocks = transformedBlocks ;
0 commit comments