@astrojs/markdoc 1.0.0-alpha.0 → 1.0.0-alpha.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/dist/content-entry-type.js +2 -2
- package/dist/extensions/shiki.js +10 -2
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +0 -1
- package/package.json +4 -4
|
@@ -61,13 +61,13 @@ async function getContentEntryType({
|
|
|
61
61
|
const usedTags = getUsedTags(ast);
|
|
62
62
|
let componentConfigByTagMap = {};
|
|
63
63
|
for (const tag of usedTags) {
|
|
64
|
-
const render =
|
|
64
|
+
const render = markdocConfig.tags?.[tag]?.render;
|
|
65
65
|
if (isComponentConfig(render)) {
|
|
66
66
|
componentConfigByTagMap[tag] = render;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
let componentConfigByNodeMap = {};
|
|
70
|
-
for (const [nodeType, schema] of Object.entries(
|
|
70
|
+
for (const [nodeType, schema] of Object.entries(markdocConfig.nodes ?? {})) {
|
|
71
71
|
const render = schema?.render;
|
|
72
72
|
if (isComponentConfig(render)) {
|
|
73
73
|
componentConfigByNodeMap[nodeType] = render;
|
package/dist/extensions/shiki.js
CHANGED
|
@@ -2,14 +2,22 @@ import { createShikiHighlighter } from "@astrojs/markdown-remark";
|
|
|
2
2
|
import Markdoc from "@markdoc/markdoc";
|
|
3
3
|
import { unescapeHTML } from "astro/runtime/server/index.js";
|
|
4
4
|
async function shiki(config) {
|
|
5
|
-
const highlighter = await createShikiHighlighter(
|
|
5
|
+
const highlighter = await createShikiHighlighter({
|
|
6
|
+
langs: config?.langs,
|
|
7
|
+
theme: config?.theme,
|
|
8
|
+
themes: config?.themes
|
|
9
|
+
});
|
|
6
10
|
return {
|
|
7
11
|
nodes: {
|
|
8
12
|
fence: {
|
|
9
13
|
attributes: Markdoc.nodes.fence.attributes,
|
|
10
14
|
async transform({ attributes }) {
|
|
11
15
|
const lang = typeof attributes.language === "string" ? attributes.language : "plaintext";
|
|
12
|
-
const html = await highlighter.
|
|
16
|
+
const html = await highlighter.codeToHtml(attributes.content, lang, {
|
|
17
|
+
wrap: config?.wrap,
|
|
18
|
+
defaultColor: config?.defaultColor,
|
|
19
|
+
transformers: config?.transformers
|
|
20
|
+
});
|
|
13
21
|
return unescapeHTML(html);
|
|
14
22
|
}
|
|
15
23
|
}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MarkdownHeading } from '@astrojs/markdown-remark';
|
|
2
2
|
import { type NodeType, type RenderableTreeNode } from '@markdoc/markdoc';
|
|
3
3
|
import type { AstroInstance } from 'astro';
|
|
4
|
-
import {
|
|
4
|
+
import type { AstroMarkdocConfig } from './config.js';
|
|
5
5
|
import type { MarkdocIntegrationOptions } from './options.js';
|
|
6
6
|
/**
|
|
7
7
|
* Merge user config with default config and set up context (ex. heading ID slugger)
|
package/dist/runtime.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Markdoc, {
|
|
2
2
|
} from "@markdoc/markdoc";
|
|
3
3
|
import { createComponent, renderComponent } from "astro/runtime/server/index.js";
|
|
4
|
-
import {} from "./config.js";
|
|
5
4
|
import { setupHeadingConfig } from "./heading-ids.js";
|
|
6
5
|
import { htmlTag } from "./html/tagdefs/html.tag.js";
|
|
7
6
|
async function setupConfig(userConfig = {}, options) {
|
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": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"gray-matter": "^4.0.3",
|
|
63
63
|
"htmlparser2": "^9.1.0",
|
|
64
64
|
"@astrojs/internal-helpers": "0.4.1",
|
|
65
|
-
"@astrojs/markdown-remark": "6.0.0-alpha.
|
|
65
|
+
"@astrojs/markdown-remark": "6.0.0-alpha.1",
|
|
66
66
|
"@astrojs/prism": "3.1.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@types/markdown-it": "^14.1.2",
|
|
73
73
|
"devalue": "^5.0.0",
|
|
74
74
|
"linkedom": "^0.18.4",
|
|
75
|
-
"vite": "^5.4.
|
|
76
|
-
"astro": "5.0.0-alpha.
|
|
75
|
+
"vite": "^5.4.2",
|
|
76
|
+
"astro": "5.0.0-alpha.3",
|
|
77
77
|
"astro-scripts": "0.0.14"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|