@xingwangzhe/stalux 1.23.1 → 1.23.3
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 +2 -3
- package/package.json +2 -2
- package/src/index.ts +16 -5
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ bun add @xingwangzhe/stalux # Install theme (all dependencies included)
|
|
|
23
23
|
bunx stalux init # Generate stalux/ content directory
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Then configure `astro.config.mjs
|
|
26
|
+
Then configure `astro.config.mjs`. Mermaid (including MDAST detection and HAST/SVG rendering) is injected by Stalux automatically, so no manual Mermaid configuration is needed:
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
29
|
import { defineConfig } from "astro/config";
|
|
@@ -31,7 +31,6 @@ import { satteri } from "@astrojs/markdown-satteri";
|
|
|
31
31
|
import sitemap from "@astrojs/sitemap";
|
|
32
32
|
import expressiveCode from "astro-expressive-code";
|
|
33
33
|
import stalux from "@xingwangzhe/stalux";
|
|
34
|
-
import { mermaidHast } from "@xingwangzhe/satteri-mermaid";
|
|
35
34
|
import { photoswipe } from "@xingwangzhe/satteri-photoswipe";
|
|
36
35
|
|
|
37
36
|
export default defineConfig({
|
|
@@ -45,7 +44,7 @@ export default defineConfig({
|
|
|
45
44
|
markdown: {
|
|
46
45
|
processor: satteri({
|
|
47
46
|
features: { math: true, smartPunctuation: true, gfm: true, frontmatter: true },
|
|
48
|
-
hastPlugins: [photoswipe()
|
|
47
|
+
hastPlugins: [photoswipe()],
|
|
49
48
|
}),
|
|
50
49
|
},
|
|
51
50
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingwangzhe/stalux",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.3",
|
|
4
4
|
"description": "A powerful, modern Astro blog theme — use as template or install as plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -106,6 +106,6 @@
|
|
|
106
106
|
"typescript": "^7.0.2"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"astro": "7.2.
|
|
109
|
+
"astro": "7.2.2"
|
|
110
110
|
}
|
|
111
111
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync } from "
|
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
|
|
15
|
+
import { mermaidMdast, mermaidHast } from "@xingwangzhe/satteri-mermaid";
|
|
15
16
|
import type { AstroIntegration } from "astro";
|
|
16
17
|
import { fontProviders } from "astro/config";
|
|
17
18
|
// pagefind 是 ESM-only 包,需要在模块顶层导入
|
|
@@ -296,10 +297,9 @@ export function stalux(options: StaluxOptions = {}): AstroIntegration {
|
|
|
296
297
|
|
|
297
298
|
logger.info(`Stalux initialized (contentDir: ${opt.contentDir})`);
|
|
298
299
|
|
|
299
|
-
// 5. 注入 satteri
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
// 去重是必须的:重复注册 featureFlagsMdast 会导致字数统计翻倍。
|
|
300
|
+
// 5. 注入 satteri 插件(Mermaid/字数统计/特性标记/数学公式),按插件 name 去重
|
|
301
|
+
// 两种模式都由集成补齐默认插件,消费方只需配置 Satteri 的基础 features 和自定义插件。
|
|
302
|
+
// 去重是必须的:重复注册 Mermaid 或 featureFlagsMdast 会导致渲染异常或字数统计翻倍。
|
|
303
303
|
try {
|
|
304
304
|
const processor = (config.markdown?.processor ?? undefined) as
|
|
305
305
|
| { name?: string; options?: { mdastPlugins?: any[]; hastPlugins?: any[] } }
|
|
@@ -318,10 +318,21 @@ export function stalux(options: StaluxOptions = {}): AstroIntegration {
|
|
|
318
318
|
}
|
|
319
319
|
list.push(plugin);
|
|
320
320
|
};
|
|
321
|
+
pushUnique(mdastPlugins, mermaidMdast());
|
|
321
322
|
pushUnique(mdastPlugins, temml());
|
|
322
323
|
pushUnique(mdastPlugins, featureFlagsMdast);
|
|
324
|
+
pushUnique(
|
|
325
|
+
hastPlugins,
|
|
326
|
+
mermaidHast({
|
|
327
|
+
responsive: true,
|
|
328
|
+
theme: "dark",
|
|
329
|
+
themeOverrides: { clusterBorder: "#cccccc" },
|
|
330
|
+
}),
|
|
331
|
+
);
|
|
323
332
|
pushUnique(hastPlugins, featureFlagsHast);
|
|
324
|
-
logger.debug(
|
|
333
|
+
logger.debug(
|
|
334
|
+
"Stalux: injected satteri plugins (mermaid/temml/feature-flags)",
|
|
335
|
+
);
|
|
325
336
|
} else {
|
|
326
337
|
logger.warn(
|
|
327
338
|
"Stalux: markdown.processor 不是 satteri,无法注入字数统计/数学公式插件。" +
|