@contentbit/astro 0.6.1 → 0.7.1
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/README.md +4 -4
- package/components/ContentBlocks.astro +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ export const collections = {
|
|
|
21
21
|
```astro
|
|
22
22
|
---
|
|
23
23
|
import { genericBlocks } from '@contentbit/blocks'
|
|
24
|
-
import {
|
|
24
|
+
import { assertValidDocument, compileDocument, createBlockRegistry } from '@contentbit/core'
|
|
25
25
|
import { ContentBlocks } from '@contentbit/astro/components'
|
|
26
26
|
import { getEntry } from 'astro:content'
|
|
27
27
|
import MyCallout from '../components/MyCallout.astro'
|
|
@@ -30,14 +30,14 @@ const entry = await getEntry('articles', 'example')
|
|
|
30
30
|
if (!entry?.body) throw new Error('Entry "example" not found.')
|
|
31
31
|
|
|
32
32
|
const registry = createBlockRegistry().use(genericBlocks())
|
|
33
|
-
const
|
|
33
|
+
const document = assertValidDocument(compileDocument(entry.body, registry), entry.id)
|
|
34
34
|
---
|
|
35
35
|
|
|
36
36
|
<ContentBlocks document={document} components={{ callout: MyCallout }} />
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
For static pages
|
|
40
|
-
build. To validate every content file in CI with `file:line:col` diagnostics,
|
|
39
|
+
For static pages `assertValidDocument` throws formatted diagnostics, so invalid
|
|
40
|
+
content fails the build. To validate every content file in CI with `file:line:col` diagnostics,
|
|
41
41
|
run the CLI: `contentbit validate "content/**/*.md"`.
|
|
42
42
|
|
|
43
43
|
Render blocks with your own Astro components via
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProcessedDocumentNode } from '@contentbit/core'
|
|
3
3
|
import type { AstroBlockContext, AstroMarkdownRenderer } from '@contentbit/astro'
|
|
4
4
|
|
|
5
5
|
import { defaultRenderMarkdown } from '@contentbit/astro'
|
|
6
6
|
import RenderNodes from './RenderNodes.astro'
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
/** A
|
|
10
|
-
document:
|
|
9
|
+
/** A processed document from compileDocument() or validateDocument(). */
|
|
10
|
+
document: ProcessedDocumentNode
|
|
11
11
|
/**
|
|
12
12
|
* Per-block Astro component overrides, keyed by block name. An override
|
|
13
13
|
* receives the block's validated props spread as component props, plus
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentbit/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Astro renderer for Content Blocks: .astro components for rendering validated documents, with per-block component overrides.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@contentbit/core": "0.
|
|
38
|
+
"@contentbit/core": "0.7.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^25.9.2",
|
|
42
42
|
"astro": "^7.0.0",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
44
|
"vitest": "^4.0.17",
|
|
45
|
-
"@contentbit/blocks": "0.
|
|
45
|
+
"@contentbit/blocks": "0.7.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"astro": "^5.0.0 || ^6.0.0 || ^7.0.0"
|