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,3 +1,5 @@
import Markdoc from '@markdoc/markdoc';
import { Cms, CmsClient } from '@kit/cms';
import { createKeystaticReader } from './create-reader';
@@ -138,7 +140,8 @@ class KeystaticClient implements CmsClient {
? new Date(item.entry.publishedAt)
: new Date();
const content = await item.entry.content();
const markdoc = await item.entry.content();
const content = Markdoc.transform(markdoc.node);
return {
id: item.slug,