@gentorial/engine-vitepress 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gentorial contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # `@gentorial/engine-vitepress`
2
+
3
+ Gentorial 的 VitePress 引擎桥接。它组合 VitePress 配置,安装 `concept`、`generate` Markdown 容器规则,把低干扰生成按钮挂载到对应标题,并将输出区域保留在作者原文之后;课程协议与 AI 请求不在此包中定义。
4
+
5
+ ```ts
6
+ import { gentorialMarkdown } from '@gentorial/engine-vitepress'
7
+ import { defineConfig } from 'vitepress'
8
+
9
+ export default defineConfig({
10
+ title: 'My course',
11
+ srcDir: '../content',
12
+ markdown: {
13
+ config: gentorialMarkdown
14
+ }
15
+ })
16
+ ```
17
+
18
+ `gentorialMarkdown` 是原生 VitePress `markdown.config` 回调,不引入第二套站点配置。旧的 `defineGentorialConfig` 暂时保留兼容,但新项目不再使用。
19
+
20
+ 该回调同时把 `mermaid` fence 转成默认主题的惰性渲染组件;只有页面真正挂载图示时才动态加载 Mermaid。LaTeX 使用 VitePress 内置的 `markdown.math: true`,并由项目安装 `markdown-it-mathjax3`。
@@ -0,0 +1,3 @@
1
+ import type { UserConfig } from 'vitepress';
2
+ /** @deprecated Use VitePress defineConfig with markdown.config: gentorialMarkdown. */
3
+ export declare function defineGentorialConfig<ThemeConfig = unknown>(config: UserConfig<ThemeConfig>): UserConfig<ThemeConfig>;
@@ -0,0 +1,2 @@
1
+ export { defineGentorialConfig } from './config.js';
2
+ export { gentorialMarkdown, installGentorialMarkdown } from './markdown.js';
package/dist/index.js ADDED
@@ -0,0 +1,138 @@
1
+ // src/markdown.ts
2
+ import markdownItContainer from "markdown-it-container";
3
+ import { parseLessonSource } from "@gentorial/content";
4
+ function parseInfo(info) {
5
+ const trimmed = info.trim();
6
+ const idMatch = /^([^\s]+)/.exec(trimmed);
7
+ const id = idMatch?.[1] ?? "";
8
+ const attributes = /* @__PURE__ */ new Map();
9
+ const rest = trimmed.slice(id.length);
10
+ const pattern = /([A-Za-z][\w-]*)=(?:"([^"]*)"|'([^']*)'|([^\s]+))/g;
11
+ let match;
12
+ while (match = pattern.exec(rest)) {
13
+ attributes.set(match[1] ?? "", match[2] ?? match[3] ?? match[4] ?? "");
14
+ }
15
+ return { id, attributes };
16
+ }
17
+ var parsedSourceKey = "__gentorialParsedSource";
18
+ function parsedSourceFromEnvironment(environment) {
19
+ if (typeof environment !== "object" || environment === null) return void 0;
20
+ return Reflect.get(environment, parsedSourceKey);
21
+ }
22
+ function expressionAttribute(md, value) {
23
+ return md.utils.escapeHtml(JSON.stringify(value));
24
+ }
25
+ function sourcePathFromEnvironment(environment) {
26
+ return typeof environment.relativePath === "string" ? environment.relativePath.replaceAll("\\", "/") : "<markdown>";
27
+ }
28
+ function openTokenInfo(tokens, index) {
29
+ const token = tokens[index];
30
+ return parseInfo((token?.info ?? "").trim().replace(/^(concept|generate)\s+/, ""));
31
+ }
32
+ function installGentorialMarkdown(md) {
33
+ const renderFence = md.renderer.rules.fence;
34
+ md.renderer.rules.fence = (tokens, index, options, environment, renderer) => {
35
+ const token = tokens[index];
36
+ if (token?.info.trim() === "mermaid") {
37
+ return `<GentorialMermaid :graph="${expressionAttribute(md, token.content)}" />
38
+ `;
39
+ }
40
+ return renderFence ? renderFence(tokens, index, options, environment, renderer) : renderer.renderToken(tokens, index, options);
41
+ };
42
+ md.core.ruler.before("block", "gentorial_parse_source", (state) => {
43
+ const environment = state.env;
44
+ const file = sourcePathFromEnvironment(environment);
45
+ const parsed = parseLessonSource(state.src, { file });
46
+ environment[parsedSourceKey] = parsed;
47
+ const error = parsed.diagnostics.find((item) => item.severity === "error");
48
+ if (error) {
49
+ const location = error.source ? `${error.source.file}:${error.source.line}` : file;
50
+ throw new Error(`${location} [${error.code}] ${error.message}`);
51
+ }
52
+ });
53
+ md.core.ruler.after("inline", "gentorial_heading_triggers", (state) => {
54
+ const parsed = parsedSourceFromEnvironment(state.env);
55
+ if (!parsed) return;
56
+ for (const generate of parsed.generates) {
57
+ const headingLine = generate.trigger.source.line - 1;
58
+ const headingIndex = state.tokens.findIndex(
59
+ (token) => token.type === "heading_open" && token.map?.[0] === headingLine
60
+ );
61
+ const inline = headingIndex >= 0 ? state.tokens[headingIndex + 1] : void 0;
62
+ if (!inline || inline.type !== "inline" || !inline.children) {
63
+ throw new Error(
64
+ `${generate.trigger.source.file}:${generate.trigger.source.line} \u65E0\u6CD5\u628A\u751F\u6210\u89E6\u53D1\u5668 ${generate.id} \u7ED1\u5B9A\u5230\u6807\u9898`
65
+ );
66
+ }
67
+ const trigger = new state.Token("html_inline", "", 0);
68
+ trigger.content = ` <GentorialGenerateTrigger generate-id="${md.utils.escapeHtml(generate.id)}" label="${md.utils.escapeHtml(generate.scope.heading)}" />`;
69
+ inline.children.push(trigger);
70
+ }
71
+ });
72
+ md.use(markdownItContainer, "concept", {
73
+ validate(parameters) {
74
+ return /^\s*concept\s+[^\s]+/.test(parameters);
75
+ },
76
+ render(tokens, index) {
77
+ if (tokens[index]?.nesting === -1) return "</section>\n";
78
+ const info = openTokenInfo(tokens, index);
79
+ const id = md.utils.escapeHtml(info.id);
80
+ const title = info.attributes.get("title");
81
+ return [
82
+ `<section class="gentorial-concept" data-concept-id="${id}">`,
83
+ title ? `<h3>${md.utils.escapeHtml(title)}</h3>` : ""
84
+ ].join("");
85
+ }
86
+ });
87
+ md.use(markdownItContainer, "generate", {
88
+ validate(parameters) {
89
+ return /^\s*generate\s+[^\s]+/.test(parameters);
90
+ },
91
+ render(tokens, index, _options, environment) {
92
+ if (tokens[index]?.nesting === -1) return "</GentorialGeneratedRegion>\n";
93
+ const info = openTokenInfo(tokens, index);
94
+ const parsed = parsedSourceFromEnvironment(environment);
95
+ const generate = parsed?.generates.find((item) => item.id === info.id);
96
+ if (!generate) {
97
+ throw new Error(`\u65E0\u6CD5\u4ECE\u5DF2\u6821\u9A8C\u7684\u9875\u9762\u6E05\u5355\u4E2D\u627E\u5230\u751F\u6210\u533A\u5757 ${info.id}`);
98
+ }
99
+ const conceptIds = new Set(generate.concepts);
100
+ const concepts = parsed?.concepts.filter((concept) => conceptIds.has(concept.id)) ?? [];
101
+ const fallback = [
102
+ {
103
+ type: "callout",
104
+ tone: "info",
105
+ title: "\u9759\u6001\u56DE\u9000",
106
+ text: "\u4E2A\u6027\u5316\u8BB2\u89E3\u6682\u65F6\u4E0D\u53EF\u7528\uFF1B\u4E0A\u65B9\u4F5C\u8005\u539F\u6587\u4ECD\u53EF\u6B63\u5E38\u9605\u8BFB\u3002"
107
+ }
108
+ ];
109
+ return [
110
+ `<GentorialGeneratedRegion :spec="${expressionAttribute(md, generate)}"`,
111
+ ` :concepts="${expressionAttribute(md, concepts)}"`,
112
+ ` :fallback="${expressionAttribute(md, fallback)}">`
113
+ ].join("");
114
+ }
115
+ });
116
+ }
117
+ var gentorialMarkdown = installGentorialMarkdown;
118
+
119
+ // src/config.ts
120
+ function defineGentorialConfig(config) {
121
+ const configureMarkdown = config.markdown?.config;
122
+ return {
123
+ ...config,
124
+ markdown: {
125
+ ...config.markdown,
126
+ config(markdown) {
127
+ installGentorialMarkdown(markdown);
128
+ configureMarkdown?.(markdown);
129
+ }
130
+ }
131
+ };
132
+ }
133
+ export {
134
+ defineGentorialConfig,
135
+ gentorialMarkdown,
136
+ installGentorialMarkdown
137
+ };
138
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/markdown.ts","../src/config.ts"],"sourcesContent":["import type MarkdownIt from 'markdown-it'\nimport type Token from 'markdown-it/lib/token.mjs'\nimport markdownItContainer from 'markdown-it-container'\nimport { parseLessonSource, type ParsedLessonSource } from '@gentorial/content'\nimport type { LessonBlock } from '@gentorial/core'\n\ntype DirectiveInfo = {\n id: string\n attributes: Map<string, string>\n}\n\nfunction parseInfo(info: string): DirectiveInfo {\n const trimmed = info.trim()\n const idMatch = /^([^\\s]+)/.exec(trimmed)\n const id = idMatch?.[1] ?? ''\n const attributes = new Map<string, string>()\n const rest = trimmed.slice(id.length)\n const pattern = /([A-Za-z][\\w-]*)=(?:\"([^\"]*)\"|'([^']*)'|([^\\s]+))/g\n let match: RegExpExecArray | null\n\n while ((match = pattern.exec(rest))) {\n attributes.set(match[1] ?? '', match[2] ?? match[3] ?? match[4] ?? '')\n }\n\n return { id, attributes }\n}\n\nconst parsedSourceKey = '__gentorialParsedSource'\n\nfunction parsedSourceFromEnvironment(environment: unknown): ParsedLessonSource | undefined {\n if (typeof environment !== 'object' || environment === null) return undefined\n return Reflect.get(environment, parsedSourceKey) as ParsedLessonSource | undefined\n}\n\nfunction expressionAttribute(md: MarkdownIt, value: unknown): string {\n return md.utils.escapeHtml(JSON.stringify(value))\n}\n\nfunction sourcePathFromEnvironment(environment: Record<string, unknown>): string {\n return typeof environment.relativePath === 'string'\n ? environment.relativePath.replaceAll('\\\\', '/')\n : '<markdown>'\n}\n\nfunction openTokenInfo(tokens: Token[], index: number): DirectiveInfo {\n const token = tokens[index]\n return parseInfo((token?.info ?? '').trim().replace(/^(concept|generate)\\s+/, ''))\n}\n\nexport function installGentorialMarkdown(md: MarkdownIt): void {\n const renderFence = md.renderer.rules.fence\n md.renderer.rules.fence = (tokens, index, options, environment, renderer) => {\n const token = tokens[index]\n if (token?.info.trim() === 'mermaid') {\n return `<GentorialMermaid :graph=\"${expressionAttribute(md, token.content)}\" />\\n`\n }\n return renderFence\n ? renderFence(tokens, index, options, environment, renderer)\n : renderer.renderToken(tokens, index, options)\n }\n\n md.core.ruler.before('block', 'gentorial_parse_source', (state) => {\n const environment = state.env as Record<string, unknown>\n const file = sourcePathFromEnvironment(environment)\n const parsed = parseLessonSource(state.src, { file })\n environment[parsedSourceKey] = parsed\n\n const error = parsed.diagnostics.find((item) => item.severity === 'error')\n if (error) {\n const location = error.source ? `${error.source.file}:${error.source.line}` : file\n throw new Error(`${location} [${error.code}] ${error.message}`)\n }\n })\n\n md.core.ruler.after('inline', 'gentorial_heading_triggers', (state) => {\n const parsed = parsedSourceFromEnvironment(state.env)\n if (!parsed) return\n\n for (const generate of parsed.generates) {\n const headingLine = generate.trigger.source.line - 1\n const headingIndex = state.tokens.findIndex(\n (token) => token.type === 'heading_open' && token.map?.[0] === headingLine\n )\n const inline = headingIndex >= 0 ? state.tokens[headingIndex + 1] : undefined\n if (!inline || inline.type !== 'inline' || !inline.children) {\n throw new Error(\n `${generate.trigger.source.file}:${generate.trigger.source.line} ` +\n `无法把生成触发器 ${generate.id} 绑定到标题`\n )\n }\n\n const trigger = new state.Token('html_inline', '', 0)\n trigger.content =\n ` <GentorialGenerateTrigger generate-id=\"${md.utils.escapeHtml(generate.id)}\"` +\n ` label=\"${md.utils.escapeHtml(generate.scope.heading)}\" />`\n inline.children.push(trigger)\n }\n })\n\n md.use(markdownItContainer, 'concept', {\n validate(parameters: string) {\n return /^\\s*concept\\s+[^\\s]+/.test(parameters)\n },\n render(tokens: Token[], index: number) {\n if (tokens[index]?.nesting === -1) return '</section>\\n'\n\n const info = openTokenInfo(tokens, index)\n const id = md.utils.escapeHtml(info.id)\n const title = info.attributes.get('title')\n return [\n `<section class=\"gentorial-concept\" data-concept-id=\"${id}\">`,\n title ? `<h3>${md.utils.escapeHtml(title)}</h3>` : ''\n ].join('')\n }\n })\n\n md.use(markdownItContainer, 'generate', {\n validate(parameters: string) {\n return /^\\s*generate\\s+[^\\s]+/.test(parameters)\n },\n render(tokens: Token[], index: number, _options: unknown, environment: unknown) {\n if (tokens[index]?.nesting === -1) return '</GentorialGeneratedRegion>\\n'\n\n const info = openTokenInfo(tokens, index)\n const parsed = parsedSourceFromEnvironment(environment)\n const generate = parsed?.generates.find((item) => item.id === info.id)\n if (!generate) {\n throw new Error(`无法从已校验的页面清单中找到生成区块 ${info.id}`)\n }\n const conceptIds = new Set(generate.concepts)\n const concepts = parsed?.concepts.filter((concept) => conceptIds.has(concept.id)) ?? []\n const fallback: LessonBlock[] = [\n {\n type: 'callout',\n tone: 'info',\n title: '静态回退',\n text: '个性化讲解暂时不可用;上方作者原文仍可正常阅读。'\n }\n ]\n return [\n `<GentorialGeneratedRegion :spec=\"${expressionAttribute(md, generate)}\"`,\n ` :concepts=\"${expressionAttribute(md, concepts)}\"`,\n ` :fallback=\"${expressionAttribute(md, fallback)}\">`\n ].join('')\n }\n })\n}\n\nexport const gentorialMarkdown = installGentorialMarkdown\n","import type { UserConfig } from 'vitepress'\nimport { installGentorialMarkdown } from './markdown.js'\n\n/** @deprecated Use VitePress defineConfig with markdown.config: gentorialMarkdown. */\nexport function defineGentorialConfig<ThemeConfig = unknown>(\n config: UserConfig<ThemeConfig>\n): UserConfig<ThemeConfig> {\n const configureMarkdown = config.markdown?.config\n\n return {\n ...config,\n markdown: {\n ...config.markdown,\n config(markdown) {\n installGentorialMarkdown(markdown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AC;AACtF,YAAM,WAA0B;AAAA,QAC9B;AAAA,UACE,MAAM;AAAA,UACN,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM;AAAA,QACR;AAAA,MACF;AACA,aAAO;AAAA,QACL,oCAAoC,oBAAoB,IAAI,QAAQ,CAAC;AAAA,QACrE,eAAe,oBAAoB,IAAI,QAAQ,CAAC;AAAA,QAChD,eAAe,oBAAoB,IAAI,QAAQ,CAAC;AAAA,MAClD,EAAE,KAAK,EAAE;AAAA,IACX;AAAA,EACF,CAAC;AACH;AAEO,IAAM,oBAAoB;;;AChJ1B,SAAS,sBACd,QACyB;AACzB,QAAM,oBAAoB,OAAO,UAAU;AAE3C,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU;AAAA,MACR,GAAG,OAAO;AAAA,MACV,OAAO,UAAU;AACf,iCAAyB,QAAQ;AACjC,4BAAoB,QAAQ;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type MarkdownIt from 'markdown-it';
2
+ export declare function installGentorialMarkdown(md: MarkdownIt): void;
3
+ export declare const gentorialMarkdown: typeof installGentorialMarkdown;
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@gentorial/engine-vitepress",
3
+ "version": "0.1.0",
4
+ "description": "VitePress engine integration for Gentorial course directives.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ }
17
+ },
18
+ "keywords": [
19
+ "gentorial",
20
+ "vitepress",
21
+ "education"
22
+ ],
23
+ "license": "MIT",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "dependencies": {
28
+ "markdown-it-container": "^4.0.0",
29
+ "@gentorial/content": "^0.1.0",
30
+ "@gentorial/core": "^0.1.0"
31
+ },
32
+ "peerDependencies": {
33
+ "vitepress": "^1.6.4"
34
+ },
35
+ "devDependencies": {
36
+ "@types/markdown-it": "^14.1.2",
37
+ "@types/markdown-it-container": "^4.0.0",
38
+ "markdown-it": "^14.3.0",
39
+ "vitepress": "^1.6.4"
40
+ },
41
+ "scripts": {
42
+ "build": "tsup src/index.ts --format esm --sourcemap --clean --external vitepress && tsc --emitDeclarationOnly",
43
+ "typecheck": "tsc --noEmit",
44
+ "test": "vitest run --root ../.. --config vitest.config.ts packages/engine-vitepress/src",
45
+ "pack:check": "pnpm pack --dry-run"
46
+ }
47
+ }