Repository navigation
MarkdownAura v1.6.0
MarkdownAura 1.6.0
阅读轨迹:打开过的每一份文档和文件夹都会被记住,而且你停在哪一节,再打开时就回到那一节。 这是这个阅读器第一次有了"历史"——此前它只有 session.recent:十条文件夹路径,没有时间、没有位置,显示为完整路径(菜单里八条、空状态里三条),而且只是"打开过哪些文件夹"。
- 三处入口,全部是屏幕上已有的东西,没有新增 chrome。 标题栏的标记(原来只是一块没有任何 handler 的装饰)现在是应用菜单:
recently opened在最上面,随后是设置 / 帮助 / 关于;标签条的⋯(all tabs)菜单在标签列表之后多了一段recently opened(滤掉已打开的,所以同一个名字不会出现两次);ctrl shift P照旧是那个扁平菜单,只是行变得有用了:名字 · 目录+ 右侧时间,末尾全部 N 条 —— 打开列表。 - 浮层是主表面:按最后触碰分组(今天 / 昨天 / 本周 / 更早——不是按第一次打开,三月份打开、今早又读过的文档属于"今天"),可过滤,每行第二行是
读到 §<标题>,路径已不存在的条目加删除线,底部clear history(上界 100 条 / 90 天,写在浮层的页脚里,而不是藏在一个没人知道的常量里)。 - 打开即恢复。 位置存的是标题文本 + 文档比例——绝不是 heading id(id 每次渲染重新分配,跨会话的 id 指向空气;这也是 §5 的
outlineHit是字符串的原因),而且解析走的是解析出的标题表,不是textContent(渲染器给每个标题塞了一个#锚点,文本比对会永远落空)。标题没了就退回到比例。落进去的位置会在跳转之前写回标签页,这样紧随其后的防抖保存不会把"刚恢复的地方"覆盖成"文档顶部"。 - 有界,独立成文件。
reading-trail.json在session.json旁边——绝不在它里面:那个文件 500 ms 防抖重写一次,且version不认识就"干净开始",追加型列表放进去会同时放大写入量和升级风险。session.recent瘦身成一个事实:下次启动恢复哪个文件夹。missing是派生的(trail_list时逐个stat),不入库。 - 没有新增 chrome、没有新增设置、没有存储迁移。 标题栏的标记从一个装饰变成了控件(它现在是
<button>,这也把它从拖拽区名单里解救出来——no-drag只认.titlebar button/.tab/input,一个 div 加 click 在构建版里什么都不做)。Tab.outlineHit从"存在、未接线"变为真的接线(SPEC §5 的 v1 状态因此更新)。 - 刻意不做:diff 视图(那是另一个渲染器)、"最常阅读"排序(
opens已记录,将来要用就是一行)、侧栏里的常驻历史(§1 纵向空间给正文、§3 第二个面板是大纲)。原型阶段考虑过的第三种形态在 mockup 里被否掉了。
验证:先在 mockup 里成型(IMPL §11 记着原型定下的事),再按 IMPL §10 的办法真机验证——cargo build --release 出的二进制(内嵌的是 dev URL,故前端由 Vite 提供)+ MARKDOWNAURA_BROWSER_ARGS=--remote-debugging-port=9222,三处入口逐一点过(真窗口里标记是 <button> 且 -webkit-app-region: no-drag,拖拽区吞点击的坑已实测排除);恢复路径两种都走了:标题命中(toast 已回到 §Engines, measured,标题落在滚动容器顶下方 12px,精确)与标题不存在(回落到文档 40% 处,且落定后存下来的标题自愈为读者真正所在的 Engines);missing 行删除线、过滤、esc、clear history 全部实测。cargo test 103 通过(新增 12,全部围绕轨迹的规则:上限、去重、窗口按最后触碰、位置只更新已知条目、百分比夹取、原子写不留临时文件、missing 派生不入库),npx tsc --noEmit、check:prose、check:rawhtml 通过。
真机跑出来两个 bug,都已修:missing 原本用 #[serde(skip)],结果字段既进不了文件、也进不了 IPC 响应——浮层把已删除的文件画成还在;改为单独的线上类型 EntryView(Entry + 派生的 missing),"文件里永不存派生事实"成了类型层面的事实。滚动侦测的宽容度是 8px,而跳转把标题停在 12px 处——于是每次跳转(大纲点击、脚注回跳、轨迹恢复)报告的都是上一节,轨迹存的就是错的;两个数字现在是一个具名契约 ANCHOR_OFFSET。两处都写进了 IMPL §11。
存储:reading-trail.json 与 session.json 并列,绝不塞进它——那个文件 500 ms 防抖重写、version 不认识就"干净开始",追加型列表放进去会同时放大写入量和升级风险。session.recent 只剩一个事实:下次启动恢复哪个文件夹。
The reading trail: every document and folder you open is remembered, and opening it again goes back to where you stopped. This is the first "history" the reader has had — until now there was only session.recent: ten folder paths, no timestamps, no position, printed as raw paths (eight in a menu, three in the empty state), and only for folders.
- Three entry points, all already on screen, no new chrome. The window mark (until now a decoration with no handler at all) is the app menu:
recently openedon top, then settings / help / about. The⋯(all tabs) menu gains arecently openedsection below the tab list — filtered to what is not already open, so the same name never appears twice.ctrl shift Pstays the flat menu of eight, but its rows are useful now:name · directorywith the time on the right, ending inall N — open the list. - The sheet is the main surface: grouped by last touch (
today/yesterday/this week/earlier— not first open; a document opened in March and read this morning belongs under today), filterable, one row per entry withread to §<heading>as the second line, a path that is gone struck through, andclear historyin the footer. Bounded — 100 entries, 90 days — with both numbers printed in the footer instead of hidden in a constant. - Opening a document resumes it. The position is the heading's text plus the fraction of the document — never a heading id (assigned per render, so it points at nothing after the next one) — and it is resolved against the parsed headings, not
textContent(the renderer puts a#anchor chip inside every heading, so a text compare silently finds nothing). A heading that is gone falls back to the fraction. The resumed position is written into the tab before the jump, so the debounced save that follows cannot overwrite the place it just resumed with "the top". - Bounded, and in its own file.
reading-trail.jsonbesidesession.json— never inside it: that file is rewritten on a 500 ms debounce and treats an unknownversionas "start clean", so an append-only list in it would grow every state write and make that rule dangerous.session.recentis now one fact: which folder to reopen.missingis derived (trail_liststats each path) and never stored. - No new chrome, no new setting, no storage migration. The title bar's mark turned from a decoration into a control (it is a
<button>now, which is also what lifts it out of the drag region —no-dragonly names.titlebar button/.tab/input, so a div with a click handler would have looked right and done nothing in the built app).Tab.outlineHitwent from "present, not wired" to wired (SPEC §5's status is updated). - Deliberately not done: a diff view (a different renderer), a "most read" sort (
opensis recorded; using it is one line), a permanent history in the sidebar (§1 gives vertical space to content, §3's second panel is the outline). The third candidate shape was rejected in the mockup, on the spot.
Verified — prototyped in the mockup first (IMPL §11 keeps what driving it settled), then on the real app per IMPL §10: cargo build --release + the frontend from the Vite dev server, driven over CDP with MARKDOWNAURA_BROWSER_ARGS=--remote-debugging-port=9222. All three entry points clicked in the built window — the mark is a <button> with -webkit-app-region: no-drag, so the drag region does not swallow it (the trap was called out in IMPL §11 before it was tested). Both resume paths driven: the heading resolves (toast 已回到 §Engines, measured, the heading lands 12px below the scroller top — exact), and the heading does not exist (falls back to 40% of the document, and the stored heading heals to the one the reader is actually under). The sheet's missing row is struck through, the filter narrows to one row, esc closes, clear history empties the list and the mark's tooltip falls back. cargo test 103 passing (12 new, all around the trail's rules: the cap, case-insensitive dedupe, the window by last touch, positions only updating known entries, the clamped percentage, an atomic write that leaves no temp file, and a derived missing that is never stored), npx tsc --noEmit, check:prose and check:rawhtml clean.
Two bugs the real run found, both fixed: missing used #[serde(skip)], which keeps a field out of the file and out of the IPC response — the sheet drew a deleted file as if it were there; the fix is a separate wire type (EntryView), so "the file never stores a derived fact" is now a type-level fact. And the scroll-spy's slack was 8px against a jump that lands a heading 12px down, so every jump (outline clicks, footnote back-refs, the resume) reported the previous heading and the trail stored it; the two numbers are now one named contract (ANCHOR_OFFSET). Both are recorded in IMPL §11.