Skip to content

v1.4.0 — 跨笔记锚点落到标题与块

Choose a tag to compare

@DedsecLemon DedsecLemon released this 24 Oct 16:45
· 8 commits to main since this release

v1.4.0 — 跨笔记的 [[笔记#标题]] 会落到标题上,#^块id 也会

以前 [[笔记#标题]] 只打开笔记、把锚点丢掉;[[笔记#^块id]] 根本没有落点。原因很具体:渲染器只把笔记名交给导航器,而页面上没有任何元素带块 id。

改了什么

  • 锚点跟着点击一起走,由 pendingAnchors 按库内路径转交:目标是另一个标签页实例,没画完就无从滚动,所以由接收页在渲染完成后取走
  • matchHeading 统一匹配规则:Obsidian 的标题原文优先 → GitHub 式 slug → 唯一包含匹配(本库沙盘笔记就是 [[笔记#整合性]] 指 5.1 整合性 (Integration));命中多个则拒绝,不去猜
  • ^块id:段落或列表项末尾的 ^id 渲染成 data-block-id,不作为文字显示;同页 [[#^id]] 与跨页 [[笔记#^id]] 都能落到块上
  • 找不到时明确提示「找不到标题 / 找不到块」,而不是没反应

可验证

  • 对真实知识库:8 个真实跨笔记链接里 6 个现在能落到标题上;其余 2 个指向的文本在目标笔记里不是标题(内容问题,不是渲染器问题 —— 一个该指 七、团体箱庭标准指导语与规则(增强版),另一个 "四不"原则 是列表项,适合用块引用)
  • render-check 新增 10 项断言:锚点随笔记链接传递、段落与列表项的 data-block-id、标记不泄漏、四条匹配规则(含歧义拒绝)

English

v1.4.0 makes [[note#heading]] land on the heading and [[note#^block-id]] land on the block. The anchor now travels with the click and is handed over in pendingAnchors keyed by vault path, because the opened note is a different tab instance that cannot scroll before it has drawn. matchHeading owns the rules — Obsidian's exact heading text, then a GitHub-style slug, then a unique containment match, which is how this vault's sandplay notes are written ([[笔记#整合性]] for 5.1 整合性 (Integration)); an ambiguous anchor is refused rather than guessed. A trailing ^id on a paragraph or list item becomes data-block-id and never appears as text, so block links work same-note and cross-note. Against the real vault, 6 of the 8 real cross-note links resolve to a heading; the other two name text that is not a heading in their target note — a content issue, not a renderer one. render-check pins the anchor travelling with the link, the block ids on paragraphs and list items, the marker never leaking, and the four matching rules including the ambiguity refusal.