vitepress-allyouneed 0.4.0 → 0.4.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/CHANGELOG.md +16 -0
- package/README.md +13 -0
- package/dist/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/theme/components/VaultGraph.vue +29 -4
- package/dist/theme/styles/graph.css +7 -3
- package/dist/vitepress.cjs +24 -4
- package/dist/vitepress.cjs.map +1 -1
- package/dist/vitepress.js +24 -4
- package/dist/vitepress.js.map +1 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [0.4.1] - 2026-05-21
|
|
6
|
+
|
|
7
|
+
修 0.4.0 几个回归 + 小幅 UX 优化。
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **数字排序坑**:`1. Masse / 10. Energie / 11. Impuls / 2. Dichte / 3. ...` —— title 比较改成 `localeCompare(b, undefined, { numeric: true })`(natural sort)。现在 `1, 2, 3, ..., 10, 11` 按数值排,而不是字典序的 `1, 10, 11, 2, 3`。影响 `sidebarAuto.sortBy` 的 `'title'` 与 `'order-then-title'`(后者在 order 缺失时 fallback 到 title)。
|
|
11
|
+
- **`autoFolderIndex` 警告刷屏**:dev 模式 `server.restart()` 会反复触发,加 module-level once-flag 只报一次;同时把 message 写得更可操作("delete this field from your .vitepress/config.ts")。
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **`markdown-it-mathjax3` 友好提示**:用户在 vitepress config 写 `markdown: { math: true }` 但没装 `markdown-it-mathjax3` 时,wrapper 自动报一条带安装命令的提示。包加为 optional peer dependency,装与不装都不阻塞。
|
|
15
|
+
- **VaultGraph 视觉/性能**:节点默认无边框(更 Obsidian-like,hover/active 才描边)。大图(>200 节点)启用 `alphaDecay` 加速 + 每 N 帧才更新一次 DOM,显著降卡。500 节点可用,1000+ 建议拆 vault。
|
|
16
|
+
|
|
17
|
+
### Docs
|
|
18
|
+
- README 加 "当前版本 0.4.1" + 0.3.x → 0.4.x 升级速览。
|
|
19
|
+
- DOCS.md 内 `v0.3.10` 提法统一改成 `v0.4.0`(autoFolderIndex 删除事件实际发布在 0.4.0)。
|
|
20
|
+
|
|
5
21
|
## [0.4.0] - 2026-05-21
|
|
6
22
|
|
|
7
23
|
**0.x.0 = breaking-ish minor bump**(按 0.x SemVer 约定大改 → 二位号 bump)。
|
package/README.md
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
Forked from [`actuallysomecat/markdown-it-wikilinks-plus`](https://github.com/actuallysomecat/markdown-it-wikilinks-plus) (MIT) 并针对 VitePress 大幅重写。
|
|
6
6
|
|
|
7
|
+
## 当前版本:0.4.1(2026-05-21)
|
|
8
|
+
|
|
9
|
+
**0.4.x 重要变更(从 0.3.x 升级看这里)**
|
|
10
|
+
|
|
11
|
+
- **`sidebarAuto.autoFolderIndex` 已删除**。文件夹链接由 `sidebarAuto.folderLinkOrder`(默认 `['same-name', 'index', 'readme', 'first-file']`)在 sidebar/nav/wikilink 解析时直接处理,不再生成 `index.md` 文件。配置里还留着这个字段会在控制台 warn 一次,删掉就行。
|
|
12
|
+
- **`folderLinkOrder`** 新增 — 自定义文件夹链接来源顺序;`[]` 表示文件夹不可点。
|
|
13
|
+
- **数字排序修正(0.4.1)**:`1, 2, 10, 11` 真按数字大小排,不再字典序成 `1, 10, 11, 2`。
|
|
14
|
+
- **`markdown.math: true`** 自动检测 — 没装 `markdown-it-mathjax3` 时给清晰提示,一行 `npm i -D markdown-it-mathjax3` 即可。
|
|
15
|
+
- **dev HMR**:`.md` add/remove 或 `_sidebar.md` 改动自动 server restart,sidebar 立即刷新。
|
|
16
|
+
- **leading-number 锚点**:`#13` 现在能匹 `## 13) Optik`、`13: ...`、`13, ...`、`13 — ...`。不匹 `13.5 Sub`(避免吃版本号)。
|
|
17
|
+
|
|
18
|
+
完整 changelog 见 [`CHANGELOG.md`](./CHANGELOG.md);配置参考见 [`DOCS.md`](./DOCS.md)。
|
|
19
|
+
|
|
7
20
|
## 这个包做什么
|
|
8
21
|
|
|
9
22
|
- 让 VitePress 直接把你的 **Obsidian vault 当作 srcDir 用**,你照常写笔记,剩下交给插件:
|
package/dist/index.cjs
CHANGED
|
@@ -3520,8 +3520,9 @@ function stripBase(url, base) {
|
|
|
3520
3520
|
return "/" + url.slice(b.length);
|
|
3521
3521
|
}
|
|
3522
3522
|
function compareEntries(a, b, opts) {
|
|
3523
|
+
const collateOpts = { numeric: true, sensitivity: "base" };
|
|
3523
3524
|
if (opts.sortBy === "title") {
|
|
3524
|
-
return opts.formatItemTitle(a).localeCompare(opts.formatItemTitle(b));
|
|
3525
|
+
return opts.formatItemTitle(a).localeCompare(opts.formatItemTitle(b), void 0, collateOpts);
|
|
3525
3526
|
}
|
|
3526
3527
|
if (opts.sortBy === "mtime-desc") {
|
|
3527
3528
|
return b.mtime - a.mtime;
|
|
@@ -3529,7 +3530,7 @@ function compareEntries(a, b, opts) {
|
|
|
3529
3530
|
const oa = readOrder(a, opts.orderKey);
|
|
3530
3531
|
const ob = readOrder(b, opts.orderKey);
|
|
3531
3532
|
if (oa !== ob) return oa - ob;
|
|
3532
|
-
return opts.formatItemTitle(a).localeCompare(opts.formatItemTitle(b));
|
|
3533
|
+
return opts.formatItemTitle(a).localeCompare(opts.formatItemTitle(b), void 0, collateOpts);
|
|
3533
3534
|
}
|
|
3534
3535
|
function readOrder(entry, key) {
|
|
3535
3536
|
const v = entry.frontmatter[key];
|
|
@@ -3864,6 +3865,23 @@ function resolveSimple(raw, index, options, currentSourceRel) {
|
|
|
3864
3865
|
}
|
|
3865
3866
|
|
|
3866
3867
|
// src/vitepress.ts
|
|
3868
|
+
var autoFolderIndexWarned = false;
|
|
3869
|
+
var mathHintShown = false;
|
|
3870
|
+
async function maybeHintMathPackage(config) {
|
|
3871
|
+
if (mathHintShown) return;
|
|
3872
|
+
const md = config.markdown;
|
|
3873
|
+
const wantsMath = md?.math === true || md?.math !== null && !Array.isArray(md?.math) && typeof md?.math === "object";
|
|
3874
|
+
if (!wantsMath) return;
|
|
3875
|
+
mathHintShown = true;
|
|
3876
|
+
const modName = "markdown-it-mathjax3";
|
|
3877
|
+
try {
|
|
3878
|
+
await import(modName);
|
|
3879
|
+
} catch {
|
|
3880
|
+
console.warn(
|
|
3881
|
+
"[vitepress-allyouneed] `markdown.math: true` set but `markdown-it-mathjax3` is missing.\n Install it once: npm i -D markdown-it-mathjax3\n (then no further setup \u2014 VitePress + this plugin will pick it up automatically.)"
|
|
3882
|
+
);
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3867
3885
|
function defineConfigWithAllYouNeed(config, pluginOptions = {}) {
|
|
3868
3886
|
const vpExclude = Array.isArray(config.srcExclude) ? config.srcExclude : [];
|
|
3869
3887
|
const mergedOptions = {
|
|
@@ -3879,6 +3897,7 @@ function defineConfigWithAllYouNeed(config, pluginOptions = {}) {
|
|
|
3879
3897
|
]
|
|
3880
3898
|
}
|
|
3881
3899
|
};
|
|
3900
|
+
void maybeHintMathPackage(config);
|
|
3882
3901
|
const vitePlugin = viteAllYouNeed(mergedOptions);
|
|
3883
3902
|
const existingVite = typeof config.vite === "object" && config.vite !== null ? config.vite : {};
|
|
3884
3903
|
const existingPlugins = Array.isArray(existingVite.plugins) ? existingVite.plugins : [];
|
|
@@ -3915,9 +3934,10 @@ function defineConfigWithAllYouNeed(config, pluginOptions = {}) {
|
|
|
3915
3934
|
const shouldFill = sidebarMode === "force" || !userProvided;
|
|
3916
3935
|
if (shouldFill) {
|
|
3917
3936
|
try {
|
|
3918
|
-
if (sidebarAuto.autoFolderIndex !== void 0) {
|
|
3937
|
+
if (sidebarAuto.autoFolderIndex !== void 0 && !autoFolderIndexWarned) {
|
|
3938
|
+
autoFolderIndexWarned = true;
|
|
3919
3939
|
console.warn(
|
|
3920
|
-
"vitepress-allyouneed
|
|
3940
|
+
"[vitepress-allyouneed] `sidebarAuto.autoFolderIndex` was removed in v0.4.0. No-op now \u2014 please delete this field from your .vitepress/config.ts. Folder URLs are resolved via `folderLinkOrder` (default: same-name \u2192 index \u2192 README \u2192 first-file). Old index.md files with our sentinel can be deleted by hand."
|
|
3921
3941
|
);
|
|
3922
3942
|
}
|
|
3923
3943
|
const materializeMode = sidebarAuto.materialize ?? "off";
|