@gravity-ui/blog-constructor 5.7.1 → 5.8.0-alpha.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.
@@ -76,7 +76,7 @@ unpredictable css rules order in build */
76
76
  }
77
77
  @supports (-webkit-line-clamp: 5) {
78
78
  .bc-post-card__description {
79
- max-height: auto;
79
+ max-height: none;
80
80
  -webkit-line-clamp: 5;
81
81
  }
82
82
  }
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
2
3
  import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
3
4
  import { IBrowser, IDevice } from 'ua-parser-js';
4
5
  import { Locale } from '../models/locale';
@@ -176,3 +177,6 @@ export declare enum PostCardTitleHeadingLevel {
176
177
  H2 = "h2",
177
178
  H3 = "h3"
178
179
  }
180
+ export interface TransformPostOptions {
181
+ plugins?: MarkdownItPluginCb[];
182
+ }
@@ -76,7 +76,7 @@ unpredictable css rules order in build */
76
76
  }
77
77
  @supports (-webkit-line-clamp: 5) {
78
78
  .bc-post-card__description {
79
- max-height: auto;
79
+ max-height: none;
80
80
  -webkit-line-clamp: 5;
81
81
  }
82
82
  }
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
2
3
  import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
3
4
  import { IBrowser, IDevice } from 'ua-parser-js';
4
5
  import { Locale } from '../models/locale';
@@ -176,3 +177,6 @@ export declare enum PostCardTitleHeadingLevel {
176
177
  H2 = "h2",
177
178
  H3 = "h3"
178
179
  }
180
+ export interface TransformPostOptions {
181
+ plugins?: MarkdownItPluginCb[];
182
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "5.7.1",
3
+ "version": "5.8.0-alpha.0",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,3 +1,4 @@
1
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
1
2
  import { Lang } from '../models/locale';
2
3
  type TypographyConfigType = {
3
4
  [x: string]: Record<string, unknown>;
@@ -7,6 +8,7 @@ type TransformPageContentPropsType = {
7
8
  lang: Lang;
8
9
  region?: string;
9
10
  typographyConfig?: TypographyConfigType;
11
+ plugins?: MarkdownItPluginCb[];
10
12
  };
11
13
  /**
12
14
  * Func for transform blog page content
@@ -15,7 +17,8 @@ type TransformPageContentPropsType = {
15
17
  * @param lang - runtime app lang
16
18
  * @param region - runtime app region
17
19
  * @param typographyConfig - page-constructor extend typography config
20
+ * @param plugins - YFM plugins
18
21
  * @returns transformed content
19
22
  */
20
- export declare const transformPageContent: ({ content, lang, region, typographyConfig, }: TransformPageContentPropsType) => any;
23
+ export declare const transformPageContent: ({ content, lang, region, typographyConfig, plugins, }: TransformPageContentPropsType) => any;
21
24
  export {};
@@ -6,13 +6,14 @@ const server_1 = require("@gravity-ui/page-constructor/server");
6
6
  const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
7
7
  const config_1 = require("./config");
8
8
  const contentFilter_1 = require("./contentFilter");
9
- const transformer = ({ blocks, lang, typographyConfig }) => (0, server_1.contentTransformer)({
9
+ const transformer = ({ blocks, lang, typographyConfig, plugins }) => (0, server_1.contentTransformer)({
10
10
  content: {
11
11
  blocks: blocks || [],
12
12
  },
13
13
  options: {
14
14
  lang,
15
15
  customConfig: Object.assign(Object.assign({}, typographyConfig), (0, config_1.getExtendTypographyConfig)()),
16
+ plugins,
16
17
  },
17
18
  });
18
19
  /**
@@ -22,9 +23,10 @@ const transformer = ({ blocks, lang, typographyConfig }) => (0, server_1.content
22
23
  * @param lang - runtime app lang
23
24
  * @param region - runtime app region
24
25
  * @param typographyConfig - page-constructor extend typography config
26
+ * @param plugins - YFM plugins
25
27
  * @returns transformed content
26
28
  */
27
- const transformPageContent = ({ content, lang, region, typographyConfig = {}, }) => {
29
+ const transformPageContent = ({ content, lang, region, typographyConfig = {}, plugins, }) => {
28
30
  try {
29
31
  const transformedContent = (0, contentFilter_1.filterContent)(js_yaml_1.default.load(content), { lang, region });
30
32
  if (transformedContent.blocks) {
@@ -32,6 +34,7 @@ const transformPageContent = ({ content, lang, region, typographyConfig = {}, })
32
34
  blocks: transformedContent.blocks,
33
35
  lang,
34
36
  typographyConfig,
37
+ plugins,
35
38
  });
36
39
  transformedContent.blocks = transformedBlocks;
37
40
  }
@@ -1,4 +1,4 @@
1
- import { PostData } from '../models/common';
1
+ import { PostData, TransformPostOptions } from '../models/common';
2
2
  import { Lang } from '../models/locale';
3
3
  /**
4
4
  * Func for transform post data
@@ -6,6 +6,7 @@ import { Lang } from '../models/locale';
6
6
  * @param postData - post data
7
7
  * @param lang - runtime language
8
8
  *
9
+ * @param plugins - YFM plugins list
9
10
  * @returns -prepared post
10
11
  */
11
- export declare const transformPost: (postData: PostData, lang: Lang) => PostData;
12
+ export declare const transformPost: (postData: PostData, lang: Lang, { plugins }?: TransformPostOptions) => PostData;
@@ -9,9 +9,10 @@ const server_1 = require("@gravity-ui/page-constructor/server");
9
9
  * @param postData - post data
10
10
  * @param lang - runtime language
11
11
  *
12
+ * @param plugins - YFM plugins list
12
13
  * @returns -prepared post
13
14
  */
14
- const transformPost = (postData, lang) => {
15
+ const transformPost = (postData, lang, { plugins } = {}) => {
15
16
  if (!postData) {
16
17
  // eslint-disable-next-line no-console
17
18
  console.error('Post not found');
@@ -19,6 +20,6 @@ const transformPost = (postData, lang) => {
19
20
  }
20
21
  const { tags, title, metaTitle, description } = postData, post = tslib_1.__rest(postData, ["tags", "title", "metaTitle", "description"]);
21
22
  return Object.assign(Object.assign({}, post), { title,
22
- tags, textTitle: (0, server_1.typografToText)(title, lang), htmlTitle: (0, server_1.typografToHTML)(title, lang), metaTitle: metaTitle || title, description: (0, server_1.yfmTransformer)(lang, description) });
23
+ tags, textTitle: (0, server_1.typografToText)(title, lang), htmlTitle: (0, server_1.typografToHTML)(title, lang), metaTitle: metaTitle || title, description: (0, server_1.yfmTransformer)(lang, description, { plugins }) });
23
24
  };
24
25
  exports.transformPost = transformPost;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
2
3
  import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
3
4
  import { IBrowser, IDevice } from 'ua-parser-js';
4
5
  import { Locale } from '../models/locale';
@@ -176,3 +177,6 @@ export declare enum PostCardTitleHeadingLevel {
176
177
  H2 = "h2",
177
178
  H3 = "h3"
178
179
  }
180
+ export interface TransformPostOptions {
181
+ plugins?: MarkdownItPluginCb[];
182
+ }