@keystatic/templates-nextjs 0.0.30 → 0.0.32

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @keystatic/templates-nextjs
2
2
 
3
+ ## 0.0.32
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a129ea4`](https://github.com/Thinkmill/keystatic/commit/a129ea4ea46a5d9c2ddec8aef4313d98cf13a575), [`73aa1b8`](https://github.com/Thinkmill/keystatic/commit/73aa1b856b7100d1ac033eb16bee5e7f630a2c3e), [`73aa1b8`](https://github.com/Thinkmill/keystatic/commit/73aa1b856b7100d1ac033eb16bee5e7f630a2c3e), [`a1a71c1`](https://github.com/Thinkmill/keystatic/commit/a1a71c1ab2313c4c0a85fdce3f9a802a14580ece)]:
8
+ - @keystatic/core@0.5.19
9
+ - @keystatic/next@5.0.1
10
+
11
+ ## 0.0.31
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1164](https://github.com/Thinkmill/keystatic/pull/1164) [`be255f9`](https://github.com/Thinkmill/keystatic/commit/be255f9446c3e1b1c47cadcdd0e5154d7cffc68a) Thanks [@emmatown](https://github.com/emmatown)! - Switch from deprecated `fields.document` to `fields.markdoc`
16
+
17
+ - Updated dependencies [[`86bd966`](https://github.com/Thinkmill/keystatic/commit/86bd966ff35981185030ce0850b8041e8a2dc5bb), [`dc7e028`](https://github.com/Thinkmill/keystatic/commit/dc7e0287b1cd1e6b4d09e3b39d390054b60fe130)]:
18
+ - @keystatic/core@0.5.18
19
+ - @keystatic/next@5.0.1
20
+
3
21
  ## 0.0.30
4
22
 
5
23
  ### Patch Changes
@@ -1,5 +1,8 @@
1
- import { DocumentRenderer } from '@keystatic/core/renderer';
1
+ import '../styles.css';
2
+ import React from 'react';
3
+ import Markdoc from '@markdoc/markdoc';
2
4
  import { reader } from '../reader';
5
+ import { markdocConfig } from '../../keystatic.config';
3
6
 
4
7
  export default async function Post({ params }: { params: { slug: string } }) {
5
8
  const { slug } = params;
@@ -8,12 +11,20 @@ export default async function Post({ params }: { params: { slug: string } }) {
8
11
 
9
12
  if (!post) return <div>Post not found!</div>;
10
13
 
14
+ const { node } = await post.content();
15
+
16
+ const errors = Markdoc.validate(node, markdocConfig);
17
+ if (errors.length) {
18
+ console.error(errors);
19
+ throw new Error('Invalid content');
20
+ }
21
+
22
+ const renderable = Markdoc.transform(node, markdocConfig);
23
+
11
24
  return (
12
25
  <div>
13
26
  <h1>{post.title}</h1>
14
- <div>
15
- <DocumentRenderer document={await post.content()} />
16
- </div>
27
+ {Markdoc.renderers.react(renderable, React)}
17
28
  </div>
18
29
  );
19
30
  }
@@ -1,5 +1,7 @@
1
1
  import { config, collection, fields } from '@keystatic/core';
2
2
 
3
+ export const markdocConfig = fields.markdoc.createMarkdocConfig({});
4
+
3
5
  export default config({
4
6
  storage: {
5
7
  kind: 'local',
@@ -12,13 +14,7 @@ export default config({
12
14
  format: { contentField: 'content' },
13
15
  schema: {
14
16
  title: fields.slug({ name: { label: 'Title' } }),
15
- content: fields.document({
16
- label: 'Content',
17
- formatting: true,
18
- dividers: true,
19
- links: true,
20
- images: true,
21
- }),
17
+ content: fields.markdoc({ label: 'Content' }),
22
18
  },
23
19
  }),
24
20
  },
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@keystatic/templates-nextjs",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
+ "@markdoc/markdoc": "^0.4.0",
6
7
  "next": "^14.1.3",
7
8
  "react": "^18.2.0",
8
9
  "react-dom": "^18.2.0",
9
- "@keystatic/core": "^0.5.17",
10
+ "@keystatic/core": "^0.5.19",
10
11
  "@keystatic/next": "^5.0.1"
11
12
  },
12
13
  "devDependencies": {
@@ -1,9 +0,0 @@
1
- import '../styles.css';
2
-
3
- export default function RootLayout({
4
- children,
5
- }: {
6
- children: React.ReactNode;
7
- }) {
8
- return <>{children}</>;
9
- }
package/next.config.js DELETED
@@ -1,4 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- module.exports = {
3
- reactStrictMode: false,
4
- };