@astrojs/markdoc 0.0.2 → 0.0.3
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +6 -0
- package/README.md +18 -18
- package/dist/index.d.ts +2 -11
- package/dist/index.js +3 -1
- package/dist/utils.js +2 -0
- package/package.json +2 -2
- package/src/index.ts +8 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[36m@astrojs/markdoc:build: [0mcache hit, replaying output [2m30bf30e6debacf79[0m
|
|
2
|
+
[36m@astrojs/markdoc:build: [0m
|
|
3
|
+
[36m@astrojs/markdoc:build: [0m> @astrojs/markdoc@0.0.3 build /home/runner/work/astro/astro/packages/integrations/markdoc
|
|
4
|
+
[36m@astrojs/markdoc:build: [0m> astro-scripts build "src/**/*.ts" && tsc
|
|
5
|
+
[36m@astrojs/markdoc:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @astrojs/markdoc
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6552](https://github.com/withastro/astro/pull/6552) [`392ba3e4d`](https://github.com/withastro/astro/commit/392ba3e4d55f73ce9194bd94a2243f1aa62af079) Thanks [@bluwy](https://github.com/bluwy)! - Fix integration return type
|
|
8
|
+
|
|
3
9
|
## 0.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -113,21 +113,21 @@ import markdoc from '@astrojs/markdoc';
|
|
|
113
113
|
|
|
114
114
|
// https://astro.build/config
|
|
115
115
|
export default defineConfig({
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
integrations: [
|
|
117
|
+
markdoc({
|
|
118
|
+
tags: {
|
|
119
|
+
aside: {
|
|
120
|
+
render: 'Aside',
|
|
121
121
|
attributes: {
|
|
122
122
|
// Component props as attribute definitions
|
|
123
123
|
// See Markdoc's documentation on defining attributes
|
|
124
124
|
// https://markdoc.dev/docs/attributes#defining-attributes
|
|
125
125
|
type: { type: String },
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
],
|
|
131
131
|
});
|
|
132
132
|
```
|
|
133
133
|
|
|
@@ -159,11 +159,11 @@ import markdoc from '@astrojs/markdoc';
|
|
|
159
159
|
|
|
160
160
|
// https://astro.build/config
|
|
161
161
|
export default defineConfig({
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
integrations: [
|
|
163
|
+
markdoc({
|
|
164
|
+
nodes: {
|
|
165
|
+
heading: {
|
|
166
|
+
render: 'Heading',
|
|
167
167
|
// Markdoc requires type defs for each attribute.
|
|
168
168
|
// These should mirror the `Props` type of the component
|
|
169
169
|
// you are rendering.
|
|
@@ -172,10 +172,10 @@ export default defineConfig({
|
|
|
172
172
|
attributes: {
|
|
173
173
|
level: { type: String },
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
}),
|
|
178
|
+
],
|
|
179
179
|
});
|
|
180
180
|
```
|
|
181
181
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
import type { Config } from '@markdoc/markdoc';
|
|
2
|
-
import type { AstroIntegration
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
hooks: Omit<AstroIntegration['hooks'], 'astro:config:setup'> & {
|
|
6
|
-
'astro:config:setup': (params: HookParameters<'astro:config:setup'> & {
|
|
7
|
-
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
8
|
-
}) => void | Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default function markdoc(markdocConfig?: Config): IntegrationWithPrivateHooks;
|
|
12
|
-
export {};
|
|
2
|
+
import type { AstroIntegration } from 'astro';
|
|
3
|
+
export default function markdoc(markdocConfig?: Config): AstroIntegration;
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,8 @@ function markdoc(markdocConfig = {}) {
|
|
|
11
11
|
return {
|
|
12
12
|
name: "@astrojs/markdoc",
|
|
13
13
|
hooks: {
|
|
14
|
-
"astro:config:setup": async (
|
|
14
|
+
"astro:config:setup": async (params) => {
|
|
15
|
+
const { updateConfig, config, addContentEntryType } = params;
|
|
15
16
|
function getEntryInfo({ fileUrl, contents }) {
|
|
16
17
|
const parsed = parseFrontmatter(contents, fileURLToPath(fileUrl));
|
|
17
18
|
return {
|
|
@@ -38,6 +39,7 @@ function markdoc(markdocConfig = {}) {
|
|
|
38
39
|
return;
|
|
39
40
|
validateRenderProperties(markdocConfig, config);
|
|
40
41
|
const body = getEntryInfo({
|
|
42
|
+
// Can't use `pathToFileUrl` - Vite IDs are not plain file paths
|
|
41
43
|
fileUrl: new URL(prependForwardSlash(id), "file://"),
|
|
42
44
|
contents: code
|
|
43
45
|
}).body;
|
package/dist/utils.js
CHANGED
|
@@ -22,6 +22,8 @@ class MarkdocError extends Error {
|
|
|
22
22
|
super(...params);
|
|
23
23
|
this.type = "MarkdocError";
|
|
24
24
|
const {
|
|
25
|
+
// Use default code for unknown errors in Astro core
|
|
26
|
+
// We don't have a best practice for integration error codes yet
|
|
25
27
|
code = 99999,
|
|
26
28
|
name,
|
|
27
29
|
title = "MarkdocError",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/markdoc",
|
|
3
3
|
"description": "Add support for Markdoc pages in your Astro site",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/chai": "^4.3.1",
|
|
34
34
|
"@types/html-escaper": "^3.0.0",
|
|
35
35
|
"@types/mocha": "^9.1.1",
|
|
36
|
-
"astro": "2.1.
|
|
36
|
+
"astro": "2.1.4",
|
|
37
37
|
"astro-scripts": "0.0.14",
|
|
38
38
|
"chai": "^4.3.6",
|
|
39
39
|
"devalue": "^4.2.0",
|
package/src/index.ts
CHANGED
|
@@ -11,24 +11,19 @@ import {
|
|
|
11
11
|
prependForwardSlash,
|
|
12
12
|
} from './utils.js';
|
|
13
13
|
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
params: HookParameters<'astro:config:setup'> & {
|
|
19
|
-
// `contentEntryType` is not a public API
|
|
20
|
-
// Add type defs here
|
|
21
|
-
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
22
|
-
}
|
|
23
|
-
) => void | Promise<void>;
|
|
24
|
-
};
|
|
14
|
+
type SetupHookParams = HookParameters<'astro:config:setup'> & {
|
|
15
|
+
// `contentEntryType` is not a public API
|
|
16
|
+
// Add type defs here
|
|
17
|
+
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
|
25
18
|
};
|
|
26
19
|
|
|
27
|
-
export default function markdoc(markdocConfig: Config = {}):
|
|
20
|
+
export default function markdoc(markdocConfig: Config = {}): AstroIntegration {
|
|
28
21
|
return {
|
|
29
22
|
name: '@astrojs/markdoc',
|
|
30
23
|
hooks: {
|
|
31
|
-
'astro:config:setup': async (
|
|
24
|
+
'astro:config:setup': async (params) => {
|
|
25
|
+
const { updateConfig, config, addContentEntryType } = params as SetupHookParams;
|
|
26
|
+
|
|
32
27
|
function getEntryInfo({ fileUrl, contents }: { fileUrl: URL; contents: string }) {
|
|
33
28
|
const parsed = parseFrontmatter(contents, fileURLToPath(fileUrl));
|
|
34
29
|
return {
|