Integrate Markdoc library with Keystatic CMS.

The commit introduces the '@markdoc/markdoc' library to the Keystatic CMS. It modifies related functions and components such as 'KeystaticDocumentRenderer' and 'keystatic-client' to transform and render content using Markdoc. Additionally, the commit refactors 'keystatic.config.ts' file for more legible content field setup and adds related dependencies in the package.
This commit is contained in:
giancarlo
2024-05-07 15:33:25 +07:00
parent 05255cbebe
commit 171a404379
5 changed files with 65 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
import { DocumentElement } from '@keystatic/core';
import { DocumentRenderer } from '@keystatic/core/renderer';
import * as React from 'react';
export function KeystaticDocumentRenderer(props: { content: unknown }) {
return <DocumentRenderer document={props.content as DocumentElement[]} />;
import Markdoc from '@markdoc/markdoc';
export function KeystaticDocumentRenderer({ content }: { content: unknown }) {
return Markdoc.renderers.react(content as string, React);
}