Skip to content

Commit

Permalink
feat!: yfm instead of html (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
niktverd authored Dec 23, 2024
1 parent 1879248 commit 67f4529
Show file tree
Hide file tree
Showing 60 changed files with 1,020 additions and 240 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-playwright-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v2
uses: actions/download-artifact@v4
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
Expand Down
23 changes: 23 additions & 0 deletions .storybook/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
import yfm from '@diplodoc/transform';
import {TitleItemProps} from '../src';

export const yfmTransform = (content: string) => yfm(content).result.html;
export const yfmTransformInline = (content: string) =>
yfm(content, {renderInline: true}).result.html;
export const transformTitle = (title: string | TitleItemProps) => {
if (!title) {
return undefined;
}

if (typeof title === 'string') {
return yfmTransformInline(title);
}

const {text, ...rest} = title;

return {...rest, text: yfmTransformInline(text)};
};
export const transformOptionalTitle = (title?: string | TitleItemProps) => {
if (!title) {
return undefined;
}

return transformTitle(title);
};
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Changelog


## [5.31.1](https://github.com/gravity-ui/page-constructor/compare/v5.31.0...v5.31.1) (2024-12-05)


### Bug Fixes

* **VideoBlock:** fix add search params to src ([#1085](https://github.com/gravity-ui/page-constructor/issues/1085)) ([b0d8f52](https://github.com/gravity-ui/page-constructor/commit/b0d8f52e4809bf939991644d41bf44da853133d7))

## [5.31.0](https://github.com/gravity-ui/page-constructor/compare/v5.30.1...v5.31.0) (2024-12-04)


### Features

* brand footer ([#1084](https://github.com/gravity-ui/page-constructor/issues/1084)) ([0aafcf5](https://github.com/gravity-ui/page-constructor/commit/0aafcf5d08dc32f53d27a8c0298d60a6957854d1))

## [5.30.1](https://github.com/gravity-ui/page-constructor/compare/v5.30.0...v5.30.1) (2024-11-15)


Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ const Page: React.PropsWithChildren<PageProps> = ({content}) => (

```typescript
interface PageConstructorProps {
content: PageContent; //Blocks data in JSON format.
content: PageContent; // Blocks data in JSON format.
shouldRenderBlock?: ShouldRenderBlock; // A function that is invoked when rendering each block and lets you set conditions for its display.
custom?: Custom; //Custom blocks (see `Customization`).
renderMenu?: () => React.ReactNode; //A function that renders the page menu with navigation (we plan to add rendering for the default menu version).
custom?: Custom; // Custom blocks (see `Customization`).
renderMenu?: () => React.ReactNode; // A function that renders the page menu with navigation (we plan to add rendering for the default menu version).
navigation?: NavigationData; // Navigation data for using navigation component in JSON format
isBranded?: boolean; // If true, adds a footer that links to https://gravity-ui.com/. Try BrandFooter component for more customization.
}

interface PageConstructorProviderProps {
Expand Down
Loading

0 comments on commit 67f4529

Please sign in to comment.