@void/md 1.3.0 → 1.5.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.
- package/dist/{compile-B0tLGZa4.mjs → compile-BCD-iOV3.mjs} +9 -17
- package/dist/index.d.mts +1 -1
- package/dist/{metadata-TdHmXD-i.mjs → metadata-BoVkSwbJ.mjs} +1 -2
- package/dist/{plugin-ieYHo6qp.d.mts → plugin-CZ4JTnkJ.d.mts} +0 -6
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.mjs +9 -16
- package/dist/runtime/index.d.mts +1 -3
- package/dist/runtime/index.mjs +1 -2
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as extractHeadings } from "./metadata-
|
|
1
|
+
import { t as extractHeadings } from "./metadata-BoVkSwbJ.mjs";
|
|
2
2
|
import matter from "gray-matter";
|
|
3
3
|
import MarkdownExit from "markdown-exit";
|
|
4
4
|
import anchor from "markdown-it-anchor";
|
|
@@ -9,7 +9,7 @@ import attrs from "markdown-it-attrs";
|
|
|
9
9
|
import { full } from "markdown-it-emoji";
|
|
10
10
|
import { bundledLanguages, createHighlighter, isSpecialLang } from "shiki";
|
|
11
11
|
import container from "markdown-it-container";
|
|
12
|
-
|
|
12
|
+
// src/plugins/containers.ts
|
|
13
13
|
function createContainer(md, klass, defaultTitle) {
|
|
14
14
|
return [
|
|
15
15
|
container,
|
|
@@ -36,8 +36,7 @@ function createContainer(md, klass, defaultTitle) {
|
|
|
36
36
|
function containerPlugin(md) {
|
|
37
37
|
md.use(...createContainer(md, "tip", "TIP")).use(...createContainer(md, "info", "INFO")).use(...createContainer(md, "warning", "WARNING")).use(...createContainer(md, "danger", "DANGER")).use(...createContainer(md, "details", "Details"));
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
//#region src/plugins/github-alerts.ts
|
|
39
|
+
// src/plugins/github-alerts.ts
|
|
41
40
|
const markerRE = /^\[!(TIP|NOTE|INFO|IMPORTANT|WARNING|CAUTION|DANGER)\]([^\n\r]*)/i;
|
|
42
41
|
const titleMark = {
|
|
43
42
|
tip: "TIP",
|
|
@@ -85,8 +84,7 @@ function gitHubAlertsPlugin(md) {
|
|
|
85
84
|
return `<div class="${type} custom-block github-alert"><p class="custom-block-title">${title}</p>\n`;
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/plugins/image.ts
|
|
87
|
+
// src/plugins/image.ts
|
|
90
88
|
const EXTERNAL_URL_RE$1 = /^[a-z]+:/i;
|
|
91
89
|
/**
|
|
92
90
|
* Normalizes relative image paths and optionally adds loading="lazy".
|
|
@@ -105,8 +103,7 @@ function imagePlugin(md, options) {
|
|
|
105
103
|
return imageRule(tokens, idx, mdOptions, env, self);
|
|
106
104
|
};
|
|
107
105
|
}
|
|
108
|
-
|
|
109
|
-
//#region src/plugins/line-numbers.ts
|
|
106
|
+
// src/plugins/line-numbers.ts
|
|
110
107
|
/**
|
|
111
108
|
* Adds a line number gutter to code blocks that opt in with `:line-numbers`.
|
|
112
109
|
* `{=N}` sets the start line.
|
|
@@ -127,8 +124,7 @@ function lineNumberPlugin(md) {
|
|
|
127
124
|
return rawCode.replace(/<\/div>$/, `${lineNumbersWrapper}</div>`).replace(/"(language-[^"]*?)"/, "\"$1 line-numbers-mode\"");
|
|
128
125
|
};
|
|
129
126
|
}
|
|
130
|
-
|
|
131
|
-
//#region src/plugins/link.ts
|
|
127
|
+
// src/plugins/link.ts
|
|
132
128
|
const EXTERNAL_URL_RE = /^[a-z]+:/i;
|
|
133
129
|
const EXTERNAL_ATTRS = {
|
|
134
130
|
target: "_blank",
|
|
@@ -156,8 +152,7 @@ function linkPlugin(md) {
|
|
|
156
152
|
return self.renderToken(tokens, idx, mdOptions);
|
|
157
153
|
};
|
|
158
154
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/plugins/pre-wrapper.ts
|
|
155
|
+
// src/plugins/pre-wrapper.ts
|
|
161
156
|
function extractLang(info) {
|
|
162
157
|
return /^[a-zA-Z0-9-_]+/.exec(info)?.[0].replace(/-vue$/, "").replace(/^vue-html$/, "template").replace(/^ansi$/, "") || "";
|
|
163
158
|
}
|
|
@@ -189,8 +184,7 @@ function preWrapperPlugin(md) {
|
|
|
189
184
|
return `<div class="language-${lang}${active}"><button title="Copy Code" class="copy"></button><span class="lang">${lang}</span>` + highlighted + `</div>`;
|
|
190
185
|
};
|
|
191
186
|
}
|
|
192
|
-
|
|
193
|
-
//#region src/plugins/toc.ts
|
|
187
|
+
// src/plugins/toc.ts
|
|
194
188
|
const TOC_RE = /^\[\[toc\]\]$/i;
|
|
195
189
|
const TOC_LEVELS = [2, 3];
|
|
196
190
|
function renderHeaders(headers) {
|
|
@@ -229,8 +223,7 @@ function tocPlugin(md) {
|
|
|
229
223
|
return renderHeaders(extractHeadings(tokens).filter((heading) => TOC_LEVELS.includes(heading.depth)));
|
|
230
224
|
};
|
|
231
225
|
}
|
|
232
|
-
|
|
233
|
-
//#region src/compile.ts
|
|
226
|
+
// src/compile.ts
|
|
234
227
|
let compilerPromise = null;
|
|
235
228
|
async function getCompiler(options) {
|
|
236
229
|
if (compilerPromise) return compilerPromise;
|
|
@@ -311,5 +304,4 @@ async function compile(source, options) {
|
|
|
311
304
|
title
|
|
312
305
|
};
|
|
313
306
|
}
|
|
314
|
-
//#endregion
|
|
315
307
|
export { compile };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FrontmatterContext, setFrontmatter, useFrontmatter } from "./runtime/index.mjs";
|
|
2
|
-
import { n as MdPage } from "./plugin-
|
|
2
|
+
import { n as MdPage } from "./plugin-CZ4JTnkJ.mjs";
|
|
3
3
|
export { FrontmatterContext, type MdPage, setFrontmatter, useFrontmatter };
|
|
@@ -2,7 +2,7 @@ import matter from "gray-matter";
|
|
|
2
2
|
import MarkdownExit from "markdown-exit";
|
|
3
3
|
import anchor from "markdown-it-anchor";
|
|
4
4
|
import footnote from "markdown-it-footnote";
|
|
5
|
-
|
|
5
|
+
// src/metadata.ts
|
|
6
6
|
let metadataCompiler = null;
|
|
7
7
|
function getMetadataCompiler() {
|
|
8
8
|
if (metadataCompiler) return metadataCompiler;
|
|
@@ -41,5 +41,4 @@ function extractMetadata(source) {
|
|
|
41
41
|
title: frontmatter.title ?? headings.find((heading) => heading.depth === 1)?.text ?? ""
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { extractMetadata as n, extractHeadings as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Plugin } from "vite";
|
|
2
|
-
//#region src/compile.d.ts
|
|
3
2
|
type Heading = Readonly<{
|
|
4
3
|
depth: number;
|
|
5
4
|
slug: string;
|
|
@@ -25,8 +24,6 @@ type CompileOptions = Readonly<{
|
|
|
25
24
|
langs?: ReadonlyArray<string>;
|
|
26
25
|
};
|
|
27
26
|
}>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/extract-script.d.ts
|
|
30
27
|
type IslandImport = {
|
|
31
28
|
name: string;
|
|
32
29
|
specifier: string;
|
|
@@ -40,8 +37,6 @@ type ScriptExtraction = Readonly<{
|
|
|
40
37
|
islandImports: Array<IslandImport>;
|
|
41
38
|
clientCode: string | null;
|
|
42
39
|
}>;
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/plugin.d.ts
|
|
45
40
|
type MdPage = Readonly<{
|
|
46
41
|
path: string;
|
|
47
42
|
title: string;
|
|
@@ -56,5 +51,4 @@ type MarkdownOptions = Readonly<{
|
|
|
56
51
|
shiki?: CompileOptions["shiki"];
|
|
57
52
|
}>;
|
|
58
53
|
declare function voidMarkdown(options?: MarkdownOptions): Array<Plugin>;
|
|
59
|
-
//#endregion
|
|
60
54
|
export { ScriptExtraction as a, IslandImport as i, MdPage as n, CompileOptions as o, voidMarkdown as r, CompileResult as s, MarkdownOptions as t };
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ScriptExtraction, i as IslandImport, n as MdPage, o as CompileOptions, r as voidMarkdown, s as CompileResult, t as MarkdownOptions } from "./plugin-
|
|
1
|
+
import { a as ScriptExtraction, i as IslandImport, n as MdPage, o as CompileOptions, r as voidMarkdown, s as CompileResult, t as MarkdownOptions } from "./plugin-CZ4JTnkJ.mjs";
|
|
2
2
|
export { type CompileOptions, type CompileResult, type IslandImport, MarkdownOptions, MdPage, type ScriptExtraction, voidMarkdown };
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as extractMetadata } from "./metadata-
|
|
1
|
+
import { n as extractMetadata } from "./metadata-BoVkSwbJ.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, resolve } from "pathslash";
|
|
@@ -6,7 +6,7 @@ import { glob } from "tinyglobby";
|
|
|
6
6
|
import { normalizePath } from "vite";
|
|
7
7
|
import { pageFileEnvironment, resolvePagesDir } from "void/pages";
|
|
8
8
|
import { editIslandSource, findIslandImports } from "void/pages-islands-plugin";
|
|
9
|
-
|
|
9
|
+
// src/emit-shared.ts
|
|
10
10
|
const ISLAND_TAG_RE = /<([A-Z]\w*)\s*((?:[^>/"']|"[^"]*"|'[^']*')*)\/\s*>|<([A-Z]\w*)\s*((?:[^>/"']|"[^"]*"|'[^']*')*)>([\s\S]*?)<\/\3\s*>/g;
|
|
11
11
|
function findIslandTags(html, names) {
|
|
12
12
|
const matches = [];
|
|
@@ -64,8 +64,7 @@ function buildRenderChunks(html, islandImports) {
|
|
|
64
64
|
}
|
|
65
65
|
return chunks;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
//#region src/emit-react.ts
|
|
67
|
+
// src/emit-react.ts
|
|
69
68
|
function emitReactComponent(result, islandImports) {
|
|
70
69
|
const chunks = buildRenderChunks(result.html, islandImports);
|
|
71
70
|
let code = `import React from "react";\n`;
|
|
@@ -116,8 +115,7 @@ export default function MarkdownPage() {
|
|
|
116
115
|
`;
|
|
117
116
|
return code;
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
//#region src/emit-solid.ts
|
|
118
|
+
// src/emit-solid.ts
|
|
121
119
|
function emitSolidComponent(result, islandImports) {
|
|
122
120
|
const chunks = buildRenderChunks(result.html, islandImports);
|
|
123
121
|
const importAliasByName = /* @__PURE__ */ new Map();
|
|
@@ -165,8 +163,7 @@ export default function MarkdownPage() {
|
|
|
165
163
|
`;
|
|
166
164
|
return code;
|
|
167
165
|
}
|
|
168
|
-
|
|
169
|
-
//#region src/emit-svelte.ts
|
|
166
|
+
// src/emit-svelte.ts
|
|
170
167
|
function toSvelteLiteral(value) {
|
|
171
168
|
return JSON.stringify(value).replace(/<\//g, "<\\/");
|
|
172
169
|
}
|
|
@@ -213,8 +210,7 @@ ${body.join("\n")}
|
|
|
213
210
|
`;
|
|
214
211
|
return source;
|
|
215
212
|
}
|
|
216
|
-
|
|
217
|
-
//#region src/emit-vue.ts
|
|
213
|
+
// src/emit-vue.ts
|
|
218
214
|
function emitVueComponent(result, islandImports) {
|
|
219
215
|
const chunks = buildRenderChunks(result.html, islandImports);
|
|
220
216
|
let code = `import { defineComponent, h, createStaticVNode, provide } from "vue";\n`;
|
|
@@ -256,8 +252,7 @@ export default defineComponent({
|
|
|
256
252
|
`;
|
|
257
253
|
return code;
|
|
258
254
|
}
|
|
259
|
-
|
|
260
|
-
//#region src/extract-script.ts
|
|
255
|
+
// src/extract-script.ts
|
|
261
256
|
const SCRIPT_RE = /^<script\b[^>]*>([\s\S]*?)<\/script>\s*\n?/;
|
|
262
257
|
function extractScript(source) {
|
|
263
258
|
const match = source.match(SCRIPT_RE);
|
|
@@ -285,8 +280,7 @@ function extractScript(source) {
|
|
|
285
280
|
}))).code.trim() : script) || null
|
|
286
281
|
};
|
|
287
282
|
}
|
|
288
|
-
|
|
289
|
-
//#region src/plugin.ts
|
|
283
|
+
// src/plugin.ts
|
|
290
284
|
const MD_CLIENT_ENTRY_ID = "virtual:void-md-client";
|
|
291
285
|
const ADAPTER_PLUGIN_NAMES = {
|
|
292
286
|
"void-vue:pages": "vue",
|
|
@@ -487,7 +481,7 @@ export function useFrontmatter() { return useContext(FrontmatterContext) ?? {};
|
|
|
487
481
|
islandId
|
|
488
482
|
};
|
|
489
483
|
});
|
|
490
|
-
const { compile } = await import("./compile-
|
|
484
|
+
const { compile } = await import("./compile-BCD-iOV3.mjs");
|
|
491
485
|
const result = await compile(body, { shiki: options?.shiki });
|
|
492
486
|
if (adapter === "vue") return {
|
|
493
487
|
code: emitVueComponent(result, islands),
|
|
@@ -528,5 +522,4 @@ function generateMdClientEntry(scripts) {
|
|
|
528
522
|
lines.push(`if (mdScriptId && mdScripts[mdScriptId]) mdScripts[mdScriptId]();`);
|
|
529
523
|
return lines.join("\n");
|
|
530
524
|
}
|
|
531
|
-
//#endregion
|
|
532
525
|
export { voidMarkdown };
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtime/index.d.ts
|
|
2
1
|
export declare function useFrontmatter(): Record<string, unknown>;
|
|
3
2
|
/**
|
|
4
3
|
* @deprecated Internal to generated Markdown components and not available with
|
|
@@ -11,5 +10,4 @@ export declare const FrontmatterContext: Record<string, unknown> | null;
|
|
|
11
10
|
* every framework adapter. Use `useFrontmatter()`. Removed in the next major
|
|
12
11
|
* version.
|
|
13
12
|
*/
|
|
14
|
-
export declare function setFrontmatter(_frontmatter: Record<string, unknown>): void;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare function setFrontmatter(_frontmatter: Record<string, unknown>): void;
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime/index.ts
|
|
2
2
|
function useFrontmatter() {
|
|
3
3
|
return {};
|
|
4
4
|
}
|
|
@@ -14,5 +14,4 @@ const FrontmatterContext = null;
|
|
|
14
14
|
* version.
|
|
15
15
|
*/
|
|
16
16
|
function setFrontmatter(_frontmatter) {}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { FrontmatterContext, setFrontmatter, useFrontmatter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/md",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Markdown pages with layouts and interactive islands for Void.",
|
|
5
5
|
"homepage": "https://void.cloud",
|
|
6
6
|
"bugs": {
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"tinyglobby": "^0.2.17"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/node": "^26.6.
|
|
55
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
56
|
-
"vite-plus": "1.
|
|
57
|
-
"void": "1.
|
|
54
|
+
"@types/node": "^26.6.6",
|
|
55
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
56
|
+
"vite-plus": "1.4.0",
|
|
57
|
+
"void": "1.5.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"vite": "^8.0.0",
|
|
61
|
-
"void": "1.
|
|
61
|
+
"void": "1.5.0"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "vp pack",
|