@astrojs/markdoc 1.0.0-beta.9 → 1.0.0
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.
|
@@ -90,9 +90,9 @@ function parseInlineStyles(style, options) {
|
|
|
90
90
|
}
|
|
91
91
|
function comment() {
|
|
92
92
|
const pos = position();
|
|
93
|
-
if (FORWARD_SLASH
|
|
93
|
+
if (FORWARD_SLASH !== style.charAt(0) || ASTERISK !== style.charAt(1)) return;
|
|
94
94
|
let i = 2;
|
|
95
|
-
while (EMPTY_STRING
|
|
95
|
+
while (EMPTY_STRING !== style.charAt(i) && (ASTERISK !== style.charAt(i) || FORWARD_SLASH !== style.charAt(i + 1))) {
|
|
96
96
|
++i;
|
|
97
97
|
}
|
|
98
98
|
i += 2;
|
|
@@ -16,7 +16,7 @@ function htmlTokenTransform(tokenizer, tokens) {
|
|
|
16
16
|
if (first.type === "paragraph_open" && second.type === "inline" && third && third.type === "paragraph_close" && Array.isArray(second.children)) {
|
|
17
17
|
for (const tok of second.children) {
|
|
18
18
|
if (tok.type === "text") {
|
|
19
|
-
if (tok.content.trim()
|
|
19
|
+
if (tok.content.trim() === textBuffer.trim()) {
|
|
20
20
|
tok.content = textBuffer;
|
|
21
21
|
}
|
|
22
22
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -17,6 +17,7 @@ async function setupConfig(userConfig = {}, options) {
|
|
|
17
17
|
if (options?.allowHTML) {
|
|
18
18
|
merged = mergeConfig(merged, HTML_CONFIG);
|
|
19
19
|
}
|
|
20
|
+
syncTagNodeAttributes(merged);
|
|
20
21
|
return merged;
|
|
21
22
|
}
|
|
22
23
|
function setupConfigSync(userConfig = {}, options) {
|
|
@@ -25,6 +26,7 @@ function setupConfigSync(userConfig = {}, options) {
|
|
|
25
26
|
if (options?.allowHTML) {
|
|
26
27
|
merged = mergeConfig(merged, HTML_CONFIG);
|
|
27
28
|
}
|
|
29
|
+
syncTagNodeAttributes(merged);
|
|
28
30
|
return merged;
|
|
29
31
|
}
|
|
30
32
|
function mergeConfig(configA, configB) {
|
|
@@ -61,6 +63,29 @@ function mergeConfig(configA, configB) {
|
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
}
|
|
66
|
+
function syncTagNodeAttributes(config) {
|
|
67
|
+
const builtinTags = Markdoc.tags;
|
|
68
|
+
const builtinNodes = Markdoc.nodes;
|
|
69
|
+
for (const name of Object.keys(builtinTags)) {
|
|
70
|
+
if (!(name in builtinNodes)) continue;
|
|
71
|
+
const tagSchema = config.tags[name];
|
|
72
|
+
const nodeSchema = config.nodes[name];
|
|
73
|
+
const tagAttrs = tagSchema?.attributes;
|
|
74
|
+
const nodeAttrs = nodeSchema?.attributes;
|
|
75
|
+
if (!tagAttrs && !nodeAttrs) continue;
|
|
76
|
+
const mergedAttrs = { ...tagAttrs, ...nodeAttrs };
|
|
77
|
+
if (tagSchema) {
|
|
78
|
+
config.tags[name] = { ...tagSchema, attributes: mergedAttrs };
|
|
79
|
+
} else {
|
|
80
|
+
config.tags[name] = { ...builtinTags[name], attributes: mergedAttrs };
|
|
81
|
+
}
|
|
82
|
+
if (nodeSchema) {
|
|
83
|
+
config.nodes[name] = { ...nodeSchema, attributes: mergedAttrs };
|
|
84
|
+
} else {
|
|
85
|
+
config.nodes[name] = { ...builtinNodes[name], attributes: mergedAttrs };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
64
89
|
function transformRespectsRender(transform, configKey) {
|
|
65
90
|
const source = transform.toString();
|
|
66
91
|
return source.includes(`config.nodes?.${configKey}?.render`) || source.includes(`config.tags?.${configKey}?.render`);
|
package/dist/utils.js
CHANGED
|
@@ -26,7 +26,7 @@ function isValidUrl(str) {
|
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const componentConfigSymbol = Symbol.for("@astrojs/markdoc/component-config");
|
|
29
|
+
const componentConfigSymbol = /* @__PURE__ */ Symbol.for("@astrojs/markdoc/component-config");
|
|
30
30
|
function isComponentConfig(value) {
|
|
31
31
|
return typeof value === "object" && value !== null && componentConfigSymbol in value;
|
|
32
32
|
}
|
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
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -57,22 +57,22 @@
|
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@markdoc/markdoc": "^0.5.4",
|
|
60
|
-
"esbuild": "^0.
|
|
60
|
+
"esbuild": "^0.27.3",
|
|
61
61
|
"github-slugger": "^2.0.0",
|
|
62
62
|
"htmlparser2": "^10.1.0",
|
|
63
|
-
"@astrojs/internal-helpers": "0.8.0
|
|
64
|
-
"@astrojs/markdown-remark": "7.0.0
|
|
65
|
-
"@astrojs/prism": "4.0.0
|
|
63
|
+
"@astrojs/internal-helpers": "0.8.0",
|
|
64
|
+
"@astrojs/markdown-remark": "7.0.0",
|
|
65
|
+
"@astrojs/prism": "4.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"astro": "^6.0.0-alpha.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/markdown-it": "^14.1.2",
|
|
72
|
-
"devalue": "^5.6.
|
|
72
|
+
"devalue": "^5.6.3",
|
|
73
73
|
"linkedom": "^0.18.12",
|
|
74
74
|
"vite": "^7.3.1",
|
|
75
|
-
"astro": "6.0.0
|
|
75
|
+
"astro": "6.0.0",
|
|
76
76
|
"astro-scripts": "0.0.14"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|