@astrojs/markdoc 0.5.0-rc.1 → 0.5.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 +48 -17
- package/components/TreeNode.ts +5 -8
- package/dist/html/index.d.ts +2 -2
- package/dist/html/index.js +2 -2
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -42,15 +42,15 @@ npm install @astrojs/markdoc
|
|
|
42
42
|
|
|
43
43
|
Then, apply this integration to your `astro.config.*` file using the `integrations` property:
|
|
44
44
|
|
|
45
|
-
```
|
|
46
|
-
// astro.config.mjs
|
|
47
|
-
import { defineConfig } from 'astro/config';
|
|
48
|
-
import markdoc from '@astrojs/markdoc';
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
45
|
+
```diff lang="js" "markdoc()"
|
|
46
|
+
// astro.config.mjs
|
|
47
|
+
import { defineConfig } from 'astro/config';
|
|
48
|
+
+ import markdoc from '@astrojs/markdoc';
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
// ...
|
|
51
|
+
integrations: [markdoc()],
|
|
52
|
+
// ^^^^^^^^^
|
|
53
|
+
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Editor Integration
|
|
@@ -344,6 +344,36 @@ Now, you can call this function from any Markdoc content entry:
|
|
|
344
344
|
|
|
345
345
|
📚 [See the Markdoc documentation](https://markdoc.dev/docs/functions#creating-a-custom-function) for more on using variables or functions in your content.
|
|
346
346
|
|
|
347
|
+
### Markdoc Language Server
|
|
348
|
+
|
|
349
|
+
If you are using VS Code, there is an official [Markdoc language extension](https://marketplace.visualstudio.com/items?itemName=Stripe.markdoc-language-support) that includes syntax highlighting and autocomplete for configured tags. [See the language server on GitHub](https://github.com/markdoc/language-server.git) for more information.
|
|
350
|
+
|
|
351
|
+
To set up the extension, create a `markdoc.config.json` file into the project root with following content:
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
[
|
|
355
|
+
{
|
|
356
|
+
"id": "my-site",
|
|
357
|
+
"path": "src/content",
|
|
358
|
+
"schema": {
|
|
359
|
+
"path": "markdoc.config.mjs",
|
|
360
|
+
"type": "esm",
|
|
361
|
+
"property": "default",
|
|
362
|
+
"watch": true
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
]
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
The `schema` property contains all information to configure the language server for Astro content collections. It accepts following properties:
|
|
369
|
+
|
|
370
|
+
- `path`: The path to the configuration file.
|
|
371
|
+
- `type`: The type of module your configuration file uses (`esm` allows `import` syntax).
|
|
372
|
+
- `property`: The exported property name that contains the configuration object.
|
|
373
|
+
- `watch`: Tell the server to watch for changes in the configuration.
|
|
374
|
+
|
|
375
|
+
The top-level `path` property tells the server where content is located. Since Markdoc is specific to content collections, you can use `src/content`.
|
|
376
|
+
|
|
347
377
|
### Pass Markdoc variables
|
|
348
378
|
|
|
349
379
|
You may need to pass [variables][markdoc-variables] to your content. This is useful when passing SSR parameters like A/B tests.
|
|
@@ -413,15 +443,16 @@ By default, Markdoc will not recognize HTML markup as semantic content.
|
|
|
413
443
|
|
|
414
444
|
To achieve a more Markdown-like experience, where HTML elements can be included alongside your content, set `allowHTML:true` as a `markdoc` integration option. This will enable HTML parsing in Markdoc markup.
|
|
415
445
|
|
|
416
|
-
```js
|
|
417
|
-
// astro.config.mjs
|
|
418
|
-
import { defineConfig } from 'astro/config';
|
|
419
|
-
import markdoc from '@astrojs/markdoc';
|
|
446
|
+
```diff lang="js" "allowHTML: true"
|
|
447
|
+
// astro.config.mjs
|
|
448
|
+
import { defineConfig } from 'astro/config';
|
|
449
|
+
import markdoc from '@astrojs/markdoc';
|
|
420
450
|
|
|
421
|
-
export default defineConfig({
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
451
|
+
export default defineConfig({
|
|
452
|
+
// ...
|
|
453
|
+
+ integrations: [markdoc({ allowHTML: true })],
|
|
454
|
+
// ^^^^^^^^^^^^^^^
|
|
455
|
+
});
|
|
425
456
|
```
|
|
426
457
|
|
|
427
458
|
> **Warning**
|
package/components/TreeNode.ts
CHANGED
|
@@ -92,14 +92,11 @@ export const ComponentNode = createComponent({
|
|
|
92
92
|
// `result.propagators` has been moved to `result._metadata.propagators`
|
|
93
93
|
// TODO: remove this fallback in the next markdoc integration major
|
|
94
94
|
const propagators = result._metadata.propagators || result.propagators;
|
|
95
|
-
propagators.
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
);
|
|
95
|
+
propagators.add({
|
|
96
|
+
init() {
|
|
97
|
+
return headAndContent;
|
|
98
|
+
},
|
|
99
|
+
});
|
|
103
100
|
|
|
104
101
|
return headAndContent;
|
|
105
102
|
}
|
package/dist/html/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { htmlTag } from './tagdefs/html.tag';
|
|
2
|
-
export { htmlTokenTransform } from './transform/html-token-transform';
|
|
1
|
+
export { htmlTag } from './tagdefs/html.tag.js';
|
|
2
|
+
export { htmlTokenTransform } from './transform/html-token-transform.js';
|
package/dist/html/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { htmlTag } from "./tagdefs/html.tag";
|
|
2
|
-
import { htmlTokenTransform } from "./transform/html-token-transform";
|
|
1
|
+
import { htmlTag } from "./tagdefs/html.tag.js";
|
|
2
|
+
import { htmlTokenTransform } from "./transform/html-token-transform.js";
|
|
3
3
|
export {
|
|
4
4
|
htmlTag,
|
|
5
5
|
htmlTokenTransform
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/markdoc",
|
|
3
3
|
"description": "Add support for Markdoc in your Astro site",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -57,32 +57,32 @@
|
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@markdoc/markdoc": "^0.3.0",
|
|
60
|
-
"esbuild": "^0.
|
|
60
|
+
"esbuild": "^0.19.2",
|
|
61
61
|
"github-slugger": "^2.0.0",
|
|
62
62
|
"gray-matter": "^4.0.3",
|
|
63
63
|
"htmlparser2": "^9.0.0",
|
|
64
64
|
"kleur": "^4.1.5",
|
|
65
|
-
"shiki": "^0.14.
|
|
66
|
-
"zod": "
|
|
67
|
-
"@astrojs/internal-helpers": "0.2.0
|
|
68
|
-
"@astrojs/prism": "3.0.0
|
|
65
|
+
"shiki": "^0.14.3",
|
|
66
|
+
"zod": "3.21.1",
|
|
67
|
+
"@astrojs/internal-helpers": "0.2.0",
|
|
68
|
+
"@astrojs/prism": "3.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"astro": "^3.
|
|
71
|
+
"astro": "^3.2.2"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/chai": "^4.3.5",
|
|
75
75
|
"@types/html-escaper": "^3.0.0",
|
|
76
|
-
"@types/markdown-it": "^
|
|
77
|
-
"@types/mocha": "^
|
|
76
|
+
"@types/markdown-it": "^13.0.0",
|
|
77
|
+
"@types/mocha": "^10.0.1",
|
|
78
78
|
"chai": "^4.3.7",
|
|
79
79
|
"devalue": "^4.3.2",
|
|
80
|
-
"linkedom": "^0.
|
|
81
|
-
"mocha": "^
|
|
82
|
-
"rollup": "^3.
|
|
83
|
-
"vite": "^4.4.
|
|
84
|
-
"@astrojs/markdown-remark": "3.
|
|
85
|
-
"astro": "3.
|
|
80
|
+
"linkedom": "^0.15.1",
|
|
81
|
+
"mocha": "^10.2.0",
|
|
82
|
+
"rollup": "^3.28.1",
|
|
83
|
+
"vite": "^4.4.9",
|
|
84
|
+
"@astrojs/markdown-remark": "3.2.0",
|
|
85
|
+
"astro": "3.2.2",
|
|
86
86
|
"astro-scripts": "0.0.14"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|