Skip to content

v1.3.0 — Obsidian callout / details 折叠

Choose a tag to compare

@DedsecLemon DedsecLemon released this 24 Oct 16:39
· 7 commits to main since this release

v1.3.0 — Obsidian 的 callout 按 Obsidian 的方式折叠

合订本《高性价比人生指南》用可折叠 callout 存来源:全文 768 处 > [!cite]- 来源(点开展开)。面板自带一个逐行渲染器(client.js 的 renderMarkdown),它只认 > 引用块,于是标记原样显示、几百个 DOI 直接铺在正文里 —— 折叠只存在于 Obsidian,面板里等于没折。

改了什么

  • 三种折叠状态,与 Obsidian 一致:- 默认折叠、+ 展开但可折、无标记展开且不可折
  • 点击标题行折叠/展开(<button aria-expanded> + ▸ 旋转),按类型取 Obsidian 的竖线色与 10% 底色;cite 是自定义类型,用中性石板色
  • 折叠的正文仍挂在 DOM 里(只 display:none):展开不需要重新取数,大纲(读 [data-outline])也不会因折叠变形
  • 顺带支持原生 <details>/<summary> —— 同一篇笔记末尾的 41 条术语表就是这种,里面的表格照常渲染
  • callout / <details> 的正文各自带独立锚点前缀,不与整篇标题撞号

可验证

  • render-check 新增 20 项断言:三种折叠状态、标题、正文仍是 markdown、标记不泄漏、<details> 里的表格、非 callout 的引用块仍保持 2px 竖线
  • 对真实笔记端到端:按面板当时的上限取前 3,000 行 → 202/202 个来源块折叠、标题在位、DOI 保留在 DOM
  • README 中英各加一节;CI 全绿

English

v1.3.0 renders Obsidian callouts the way the reading view does. The compiled guide ends all 767 of its items with a folded > [!cite]- 来源(点开展开) source block, and treating every > as a quote put the marker on screen and hundreds of DOIs into the prose. - starts folded, + starts open but foldable, and a bare [!type] is open and not foldable — Obsidian's three states. The header is a real <button aria-expanded> with a rotating caret; the body stays mounted and is hidden with CSS, so opening one needs no refetch and the outline never changes shape when a block folds. Raw <details>/<summary> — the same note's 41-term glossary — renders as the same control, table and all. render-check pins the three states, the title, the markdown inside the body, the table inside <details>, and that a block which is not a callout keeps the quote typography (2px rule, 24px indent).