Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca434a8bab | ||
|
|
6195ad1d5d |
No files matched your search
@@ -126,6 +126,9 @@ jobs:
|
||||
## Marqdo ${{ github.ref_name }}
|
||||
|
||||
### 亮点 / Highlights
|
||||
- **v2.5.0**:View 阅读界面重构——暖白金色主题、新 Logo、左右执行标注、导航搜索与悬浮工具栏;离线公式;重跑同次捕获刷新
|
||||
- **v2.5.0**: View reader redesign — warm paper theme, new logo, margin execution notes, navigation/search and floating controls; offline math; same-capture live refresh
|
||||
- **v2.5.0 ext**:扩展包同步 2.5.0 / Ext pack 2.5.0
|
||||
- **v2.4.0**:Oracle journal 作语言值——`foreign.oracle_journal`/`replay_check`;bytecode/frontend 硬化;MSRV 1.81
|
||||
- **v2.4.0**: Oracle journal as language values — foreign.oracle_journal/replay_check; bytecode/frontend hardening; MSRV 1.81
|
||||
- **v2.4.0 ext**:扩展包同步 2.4.0 / Ext pack 2.4.0
|
||||
|
||||
@@ -8,6 +8,36 @@
|
||||
|
||||
### Changed
|
||||
|
||||
## v2.5.0 — 2026-11-07
|
||||
|
||||
### Highlights
|
||||
|
||||
**View 文档阅读界面重构 / View reader redesign**:暖白金色排版、新 Marqdo 标志与花枝羽毛素材;宽屏执行信息左右引出,窄屏回到正文下方;导航、搜索与悬浮工具栏;实时 view 与静态导出同源,公式和素材离线可用。CLI · wasm · ext **2.5.0**。
|
||||
|
||||
**核心表面 Δ(Core surface Δ)**:**无增删**(仍 19 个构造)。本次变更集中于 view 展示与普通文档执行结果刷新;无 Markdown 语法或插件 ABI 变更。
|
||||
|
||||
```bash
|
||||
marqdo view public
|
||||
marqdo view output public -o site
|
||||
```
|
||||
|
||||
### Added
|
||||
|
||||
- 暖白/深色阅读主题、新 Logo、透明花枝与羽毛;顶部导航、正文/函数/文件搜索、阅读设置和悬浮工具栏。
|
||||
- 宽屏执行标注左右排布与避让,点击查看完整捕获值;窄屏、密集段落和打印采用正文内标注。
|
||||
- 内嵌 KaTeX 0.16.22、字体和装饰素材,静态页面断网仍可渲染公式。
|
||||
- 六种屏宽的 live/static 浏览器回归与普通文档重跑结果一致性回归。
|
||||
|
||||
### Fixed
|
||||
|
||||
- 普通文档重跑后,从同一次执行捕获刷新正文、变量与轨迹,避免为更新标注重复执行。
|
||||
- 移除重复的正文 `id="structure"`,确保刷新定位到实际正文;修复搜索框 Escape 关闭与隐藏目录焦点行为。
|
||||
|
||||
### Changed
|
||||
|
||||
- 函数和变量面板按需打开;调用帧与循环轮次选择保留;高级 notebook 操作从工具菜单进入。
|
||||
- CLI、WASM、扩展包和 VS Code / Cursor 扩展同步为 **2.5.0**;扩展包功能沿用 v2.4.0 已发布内容。
|
||||
|
||||
## v2.4.0 — 2026-11-06
|
||||
|
||||
### Highlights
|
||||
|
||||
Generated
+2
-2
@@ -572,7 +572,7 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
||||
|
||||
[[package]]
|
||||
name = "marqdo"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cmd",
|
||||
@@ -611,7 +611,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "marqdo-wasm"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
dependencies = [
|
||||
"marqdo",
|
||||
"serde_json",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marqdo"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
description = "Marqdo — Markdown markers as an interpreted programming language"
|
||||
|
||||
@@ -284,7 +284,9 @@ marqdo catalog public -o .marqdo
|
||||
|
||||
---
|
||||
|
||||
## 现状(v2.4.0)
|
||||
## 现状(v2.5.0)
|
||||
|
||||
- **View 阅读界面(v2.5.0)**:暖白金色主题、新 Logo 与花枝装饰;真实执行信息左右引出、窄屏内联;导航/搜索/阅读设置/工具栏;重跑同步刷新与离线公式。CLI · wasm · ext 同步 **2.5.0**。
|
||||
|
||||
- **Oracle journal 语言值(v2.4.0)**:`foreign.oracle_journal` / `foreign.replay_check` 作普通值;handle/code 拒入 journal;bytecode/frontend 硬化;扩展包同步 **2.4.0**
|
||||
- **Foreign Strong(v2.3.0)**:会话 `handle`(不可过桥)· 仿射 close · `replay_check`/oracle journal · 表 arity refuse · Ω∈\(V_{\mathsf{safe}}\)。扩展包同步 **2.3.0**
|
||||
@@ -333,7 +335,7 @@ marqdo catalog public -o .marqdo
|
||||
- **浏览器 Marqdo(WASM)**:`marqdo wasm build` + 官方 bridge 自启(作者零业务 JS;桥内可含列表/路由/storage/ws/文件/Canvas/音频/Observer/拖放);`lib/browser` + GFM;`web.client_embed`;示例 [browser-hello](examples/browser-hello/) · [browser-app](examples/browser-app/) · [browser-media](examples/browser-media/) · [web-client-site](examples/web-client-site/)([ADR 0002](doc/adr/0002-browser-marqdo-wasm.md) · [D](doc/roadmap/browser-wasm-d.md) · [E](doc/roadmap/browser-wasm-e.md) · [F](doc/roadmap/browser-wasm-f.md))
|
||||
- 选型:[ADR 0001 — Rust](doc/adr/0001-implementation-language.md) · [ADR 0002 — 浏览器 WASM](doc/adr/0002-browser-marqdo-wasm.md)(C0–C5 完结,见 [roadmap/browser-wasm.md](doc/roadmap/browser-wasm.md))· [ADR 0003 — 异步效应](doc/adr/0003-browser-async-effects.md)
|
||||
|
||||
### 如何使用最新 Marqdo(v2.4.0)
|
||||
### 如何使用最新 Marqdo(v2.5.0)
|
||||
|
||||
**安装解释器(任选其一)**
|
||||
|
||||
@@ -348,7 +350,7 @@ marqdo catalog public -o .marqdo
|
||||
```bash
|
||||
# 1) 源码安装(跟 tag 或 main)
|
||||
git clone https://github.com/cflmy/marqdo.git && cd marqdo
|
||||
git checkout v2.4.0 # 或留在 main
|
||||
git checkout v2.5.0 # 或留在 main
|
||||
cargo build --release
|
||||
export PATH="$PWD/target/release:$PATH"
|
||||
marqdo version
|
||||
@@ -389,7 +391,7 @@ marqdo wasm build
|
||||
# → dist/wasm/ … 见 examples/browser-hello/
|
||||
|
||||
# 6) Releases:Windows exe/zip/vsix;Linux CLI zip + native `.so` zip
|
||||
# https://github.com/cflmy/marqdo/releases/tag/v2.4.0
|
||||
# https://github.com/cflmy/marqdo/releases/tag/v2.5.0
|
||||
```
|
||||
|
||||
开发期也可用 `cargo run -- …` 代替已安装的 `marqdo`:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marqdo-wasm"
|
||||
version = "2.4.0"
|
||||
version = "2.5.0"
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
description = "Marqdo interpreter as WebAssembly (browser host bridge)"
|
||||
|
||||
Vendored
+7
@@ -1,3 +1,10 @@
|
||||
marqdo (2.5.0-1ppa1) noble; urgency=medium
|
||||
|
||||
* Marqdo 2.5.0: redesigned document reader, margin execution annotations,
|
||||
offline math/assets, navigation/search, and consistent live result refresh.
|
||||
|
||||
-- Marqdo Maintainers <cflmy@users.noreply.github.com> Sat, 07 Nov 2026 10:00:00 +0800
|
||||
|
||||
marqdo (2.4.0-1ppa1) noble; urgency=medium
|
||||
|
||||
* Marqdo 2.4.0: oracle journal as language values (foreign.oracle_journal /
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# View botanical reader
|
||||
|
||||
Implemented 2026-11-07 for the shared `marqdo view` and `marqdo view output` shell.
|
||||
|
||||
The default is warm paper, serif document text, olive runtime notes, gold accents,
|
||||
and generated transparent blossom/feather ornaments. The M/book logo is embedded
|
||||
SVG. Navigation and the floating toolbar are code-native SVG icons and CSS.
|
||||
|
||||
`src/view/reader.css` is the final theme layer after notebook component styles;
|
||||
`src/view/reader.js` owns reader navigation, dialogs and annotation geometry.
|
||||
Notebook APIs and controls remain available through More → advanced tools.
|
||||
Welcome files get a larger introduction; ordinary files retain compact titles.
|
||||
|
||||
## Runtime notes
|
||||
|
||||
Annotations keep their existing owner band, stable IDs, source anchor, call frame
|
||||
and loop iteration data. On viewports wider than 1000px with 180px available on
|
||||
each side, notes alternate between margin rails with collision avoidance. Dense
|
||||
bands that would drift more than 140px from their statement retain inline notes.
|
||||
Compact screens, printing, and expanded overflow bands use ordinary document
|
||||
flow. Connectors are CSS lines in the gutter, avoiding the paragraph text;
|
||||
hover/focus highlights the precise source anchor. Clicking a note shows its full
|
||||
captured detail. No explanatory prose or runtime values are invented.
|
||||
|
||||
Layout updates after window/font/structure resize, frame selection and live DOM
|
||||
replacement. Static HTML includes the same code and embedded assets. All KaTeX
|
||||
scripts, CSS and fonts are bundled for offline math. Optional syntax highlighting
|
||||
retains the previous CDN progressive enhancement; code remains readable offline.
|
||||
|
||||
`api/session/run_document` now returns prose HTML, bindings and trace JSON from
|
||||
its own capture. The reader applies that capture without rerunning the program.
|
||||
Page tokens prevent a changed source from receiving mismatched annotations.
|
||||
|
||||
## Navigation
|
||||
|
||||
Document returns to prose. Functions/Variables move the real existing panels into
|
||||
a modal and restore them on close, preserving their existing event handlers.
|
||||
Memory shows the captured execution report, labeled as a snapshot on exports.
|
||||
Run navigates to the output section. Search finds document, function and file text.
|
||||
The bottom play button invokes actual live execution; static pages explain how to
|
||||
start a live view. Static clear hides captured output locally; reload restores it.
|
||||
Settings control light/dark theme, text size and annotation visibility. More keeps
|
||||
source, advanced execution controls, file navigation and print within reach.
|
||||
|
||||
## Validation
|
||||
|
||||
Run `cargo test --offline --lib view::` and `cargo test --offline --test gold view_`.
|
||||
The browser regression is `tests/view/reader.browser.cjs <URL>`; it accepts
|
||||
`MARQDO_PLAYWRIGHT_MODULE`, `MARQDO_CHROMIUM`, and optional
|
||||
`MARQDO_SCREENSHOT_DIR`. It blocks HTTPS resources to exercise offline reading,
|
||||
checks six viewport widths, note bounds/collisions, real panel restoration,
|
||||
search, frame selection, note inspection and live/static run behavior.
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.4.0
|
||||
2.5.0
|
||||
@@ -6,7 +6,16 @@ description: Local browse and static export from the interpreter
|
||||
|
||||
# main
|
||||
|
||||
Milestone: `marqdo view` and `view output` (v1.4.1 mid→mid annot leaders + document surface).
|
||||
Version 2.5.0: `marqdo view` and `view output` share a warm paper reader with a new
|
||||
Marqdo logo, serif document text, botanical ornaments, navigation, search and a
|
||||
floating action toolbar. Wide screens place real execution notes in the margins;
|
||||
compact screens keep them below the corresponding paragraph. Click a note to
|
||||
inspect its full captured value. Call and loop frame selectors remain available.
|
||||
|
||||
Static exports embed decorations, KaTeX and math fonts for offline reading. The
|
||||
play button runs the document in live view; static pages retain their captured
|
||||
results and explain how to start a live view. Ordinary document reruns update
|
||||
prose, bindings and notes from the same execution capture.
|
||||
|
||||
Local: `marqdo view public`
|
||||
|
||||
|
||||
@@ -6,7 +6,13 @@ description: 本地浏览与静态导出由解释器生成
|
||||
|
||||
# main
|
||||
|
||||
里程碑:`marqdo view` 与 `view output`(v1.4.1 mid→mid 标注连线 + 文档面)。
|
||||
版本 2.5.0:`marqdo view` 与 `view output` 共用暖白金色阅读界面,新 Marqdo 标志、
|
||||
衬线正文、花枝装饰、导航搜索与底部悬浮工具栏。宽屏将真实执行结果沿左右页边引出,
|
||||
窄屏将标注放回对应段落下方;点击标注可查看完整捕获值,调用帧和循环轮次仍可切换。
|
||||
|
||||
静态导出内嵌装饰素材、KaTeX 与数学字体,断网也能阅读公式。播放按钮在实时 view 中
|
||||
运行文档;静态页面保留导出结果,并提示如何启动实时 view。普通文档重跑后,正文、
|
||||
变量和执行标注使用同一次执行捕获同步刷新。
|
||||
|
||||
本地浏览:`marqdo view public`
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
# Reader assets
|
||||
|
||||
The reader embeds these resources into its shared live/static HTML shell. There are
|
||||
no remote logo, decoration, math-script or math-font requests.
|
||||
|
||||
- `logo.svg`: new project-native geometric M/book mark, olive and champagne gold.
|
||||
`logo.uri` is its base64 data URI for favicon and wordmarks.
|
||||
- `blossom.png`, `feather.png`: original transparent artwork generated with the
|
||||
built-in imagegen tool for this redesign. Their WebP copies are resized browser
|
||||
assets; `.uri` files contain the same WebP bytes as base64 data URIs.
|
||||
- `vendor/`: KaTeX 0.16.22, reused from the workspace's existing local distribution.
|
||||
See `vendor/KATEX-LICENSE`. CSS fonts are embedded as woff2 data URIs, so opening
|
||||
a static export from disk also renders formulas offline.
|
||||
|
||||
## Final generation prompts
|
||||
|
||||
### Blossom
|
||||
|
||||
Use case: illustration-story. Asset type: transparent corner botanical ornament for Marqdo literary executable-document reader. A single elegant cherry blossom branch entering from upper left, thin olive and muted gold stems, delicate ivory and pale blush five-petal blossoms, sparse small olive leaves. Refined East Asian botanical watercolor with very fine warm gold ink contours, airy asymmetrical composition, most flowers concentrated in upper-left quadrant with branch tapering toward lower right. True transparent background, no paper rectangle, no text, no logo, no UI, no shadow. Soft quiet sophisticated editorial style, readable content will be placed beside this ornament. Square canvas.
|
||||
|
||||
### Feather
|
||||
|
||||
Use case: illustration-story. Asset type: small elegant quill ornament for a literary document reader wordmark. One single fine feather, curved stem rising diagonally from lower left to upper right, graceful tapered silhouette, warm pale champagne gold watercolor wash with delicate gold ink veins, restrained antique engraving style, no pen nib, no text, no shadows, no other objects. True transparent background. Portrait composition with clear edges, entire feather visible, sophisticated quiet airy appearance.
|
||||
|
||||
## Updating embedded resources
|
||||
|
||||
After replacing a project asset, regenerate its URI from its bytes (base64 with no
|
||||
line wrapping, prefixed with `data:image/webp;base64,` or
|
||||
`data:image/svg+xml;base64,`). Keep PNG originals for future design edits. No
|
||||
runtime asset server or extra Cargo dependency is required.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 927 KiB |
@@ -0,0 +1 @@
|
||||
data:image/webp;base64,UklGRvRAAQBXRUJQVlA4WAoAAAAQAAAAfwIAfwIAQUxQSIKgAAAF/yckSPD/eGtEpO45DtpGkiSHP+yd6d57AETEBAjR2HVVYePRilhUaE5o7hwv0BgJo1KIUSXH2ZHsch9V9M/h5g3b/kVy4v+77nd1j8Q9REhwd3dYWNzdN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sau3njJZGCNjBAohhLN2am7KYMBgE9OP9/seG4RpumQHhQyqYaLbXj39o8R5uIbifhEQ968QSne4vBtCNXh/+18SAwZcRM5BsWWnYwc6QNJ5z1ljY4lsbF1ty5WS0VNWbg2WAY084YkqBgxguQgCISkpHXxEiyRQfZAx2Iw/55YOYTD5QSHEw45sLifUtjHxtzMeCu40sqiucWO/ICEAYUAxfnPVQxNK2FiAa6ZZC6QHNukMroFnHH9NqQEyIqt08JG7tsSA+PHK+9oSbFBMdjh4voA6k8QCY4ePD3k3ZMDUdEZkhUII81y/mCREUbkQBptJ1146o5hCovRflw5LgmoYY4+/4ebpyaDxUwCkYw4sJZJQjXTmH6Nev++bkNjGlNL+hdLdr4sStfzFVj+WwGAAI4OoGee7bM0KKEx46NYvAxhMqC587orlRICwLine truncated
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -0,0 +1 @@
|
||||
data:image/webp;base64,UklGRrIlAABXRUJQVlA4WAoAAAAQAAAAnwAA7wAAQUxQSPwTAAAB8Mf//2op2fZ9PnvDMMMMiDQm3d0GHtjd3WAreNjdSqjnIXoEdhdiB3oUdoKHIibdBjAIA8zM3uvzfq/vH+u71t547b0e158RMQGSXlUl7aafTrumnY6npZ2dnqlIGVrQ8G/bpJwrVrRPGQVXfbG0TboZF3zeLNWM+sU9JOlVpdsC585MMdL3a4fN/VPMsCXO3Pyq9DJysTNzMySlqoxd6QzmpoumEpW9ap0BcHdISt19lUPUXZFS9ljj4JuQToascAaSgDsrhaiMWOoMJAFzZ6YPlT7LnAHwnZI6VDrNcSD85k5NGZmstP3AGUiQAOBOShet22qLmc4AkD4emCr6jsi0nukMMYQhv1uKqDhmT6l62QEA/TDU9UkPw58/SVo86QCACbi6YxpQFdl16q83Stt3nAGMBWBuXlX5UxGpmbjQPZJt8YKzJPC8IimwZbvjPkG4qGOT+51FQAIkPY+UM9VIj4MveqcxDMIr5CZnhoQeuM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V/TuIqGpGK79gEATub1+6RAC9nsDybkZLUSmvzfcam5FMZUVWLine truncated
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#343f22" d="M8 8v45l9-5V27l15 12 15-12v21l9 5V8L32 28z"/><path fill="#c59a55" d="m8 8 24 20L56 8 32 38z"/><path fill="#fcf9f4" d="m19 17 13 11 13-11-13 17z"/><path fill="#c59a55" d="m27 49 5-5 5 5-5 7z"/></svg>
|
||||
|
After Width: | Height: | Size: 282 B |
@@ -0,0 +1 @@
|
||||
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHBhdGggZmlsbD0iIzM0M2YyMiIgZD0iTTggOHY0NWw5LTVWMjdsMTUgMTIgMTUtMTJ2MjFsOSA1VjhMMzIgMjh6Ii8+PHBhdGggZmlsbD0iI2M1OWE1NSIgZD0ibTggOCAyNCAyMEw1NiA4IDMyIDM4eiIvPjxwYXRoIGZpbGw9IiNmY2Y5ZjQiIGQ9Im0xOSAxNyAxMyAxMSAxMy0xMS0xMyAxN3oiLz48cGF0aCBmaWxsPSIjYzU5YTU1IiBkPSJtMjcgNDkgNS01IDUgNS01IDd6Ii8+PC9zdmc+
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2020 Khan Academy and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex((t=>e.startsWith(t.left)));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const l=c(o,t);if(l){for(let e=0;e<a;e++)r.nextSibling.remove();n+=l.childNodes.length-1,e.replaceChild(l,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&f(r,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()}));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAG2sAA4AAAAA+ZAAAG1TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAhlQIMAmcDBEICoOjbILCdAE2AiQDh3oLhAoABCAFiHAHkiEMgScbF8Yn2LYMqH+3gyd/6PAsswO12yEpWsM7RgaCjQOA0H9txf//n5dUxtAmsKQoiOrc/H9QyJEtsi2GVCpzFfRhZqLYbDKTtn0lSwsTw4QD7NnnQk643jskZDh6Xt7UYM3oxmzbFmaT31X7vZ1Ofhd9hkIf+BQk6AtGG/a+RmtE9xoXbdSFR9FOxB/VXmLkD83DqE4FExWNqd74/RMZBmGaKMQcZltI/65kuqt4ilq1coTJWyVukOiXfAqeKn6l+6QPtVT6rXYGto38SU7e4Uk3/727jLss7jIhrCQkYayEBAhDSEIYIWEkIewlIIiKCAiyxLFBwYljonXt6i7Ouoq1ra1dalvbWmuH/b91/tecWqj/pqac+1YCofNIkRQIBX76ptq8ukczdzwgMCUWWoodMkGQZ3ft6nyKqwI7KeFue1/SHUtaOwqw7TgF5tndJCoYCgA/+62qM3gYoIgYOam9285l9XfxkH/iu38HrbRFKJSoMJjBJjCgES++/OTHN6DBBueVEIYT2GWyRdAHtyHtUsaeIRvdS2u75fbihomUAGb5+yWIaWaO3JdsU7GIyb0Pb3poSrpKiYBzf7AK9SlVxD/8A+daldCmPrcJza8x8r/LpGgixmTJrFgX5G/8hAdL7CvF8O5+/iWvIDC3577J0maohbY0WFRACoy8qQwAew8Jnz+kDUr+8xf1F7W6anTmtgm0NQg6e6tf/qrhuxkLWVNIFCiMTKl8UgjTfNcN7gV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PfW9TZQ7odxrGn7oqPp/T0bnnTvuQ7uDH2N1hb15zTZ3q0XfHzy6s91UpdmS23dvz/YfuHzZdYVI4mw0bA9b3PXcc/S5To7TvYf29SrOUjz9zn4EW9TdUoGzzvYzVGiosOhp0DCAtl5fVbsfVbPeQ5qnOmAdVKyrVsZYBWhvyxsaIRCYydEghut0QAO+rdyRo050ccD9gtdu0VXd1QtnyHXazV9NKY0sgQP7VhBQYw9T798IdUnGyNiDBRAAsiYNinzojGIhgi0EBENu+TGC0CQLMlmdSZOihlnb5e24jIvooNB8CIIg8oMQAgGhU7D6ufIkOilOFierk4WFBkAXMH5gQJ6G7LTHOWfMMPZQCsQwkBXizepGCJBETFCR5zzPo1KU4h1/56mqEFj37Yhm7VAMa33f9P3a5+Zzp6qtqnaLdjE9Xl2JGtF8kG7KN5Sv6J319g37fP8RlvCeuZzKWWn0C0pRwFUQiGybtAmT6Wcjo3z9yEhYMpmnIstVUYCoRqHm8wgwefy4vxCWRAWdUosDuLrpttvchp4IqYoR6x9hyggh00UATsPDw/Q1IG8VnMUYQVSrjVfcWRKhm5UsyYArgOA5m7wSEGSW5VmW5VoWHB6OBJjZIi6AfoNp5s08tRRXFV0BAsmCWTBNtGVus8L0uUZfnsF0hcm2I522KAgg7xPCfuYuV7h/ly69ZL+/lQP0CnZjVki9S7Tp1gNEI1R0Rhb1xNUHAYY2hLq/zrJqgWgUYOeYHEGGqLine truncated
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.katex=t():e.katex=t()}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return Wn}});class r{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;let n,o,s="KaTeX parse error: "+e;const i=t&&t.loc;if(i&&i.start<=i.end){const e=i.lexer.input;n=i.start,o=i.end,n===e.length?s+=" at end of input: ":s+=" at position "+(n+1)+": ";const t=e.slice(n,o).replace(/[^]/g,"$&\u0332");let r,a;r=n>15?"\u2026"+e.slice(n-15,n):e.slice(0,n),a=o+15<e.length?e.slice(o,o+15)+"\u2026":e.slice(o),s+=r+t+a}const a=new Error(s);return a.name="ParseError",a.__proto__=r.prototype,a.position=n,null!=n&&null!=o&&(a.length=o-n),a.rawMessage=e,a}}r.prototype.__proto__=Error.prototype;var n=r;const o=/([A-Z])/g,s={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;const a=function(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?a(e.body[0]):e:"font"===e.type?a(e.body):e};var l={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(i,(e=>s[e]))},hyphenate:function(e){return e.replace(o,"-$1").toLowerCase()},getBaseElem:a,isCharacterBox:function(e){const t=a(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){const t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"}};const h={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>"Infinity"===e?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function c(e){if(e.default)return e.default;const t=e.type,r=Array.isArray(t)?t[0]:t;if("string"!=typeof r)return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class m{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0Line truncated
|
||||
+66
-189
@@ -1,4 +1,4 @@
|
||||
//! HTML shell for `marqdo view` — Apple-inspired monochrome, system fonts only.
|
||||
//! Shared live/static reader shell with an offline, botanical editorial theme.
|
||||
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
|
||||
@@ -1660,6 +1660,10 @@ code.expr {
|
||||
"#
|
||||
}
|
||||
|
||||
fn reader_icon(path: &str) -> String {
|
||||
format!(r#"<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="{}"/></svg>"#, path)
|
||||
}
|
||||
|
||||
pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
format!(
|
||||
r##"<!DOCTYPE html>
|
||||
@@ -1668,29 +1672,34 @@ pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>{title} · marqdo</title>
|
||||
<link rel="icon" href="https://s3.cflmy.cn/logo/Logo.ico" type="image/x-icon"/>
|
||||
<link rel="shortcut icon" href="https://s3.cflmy.cn/logo/Logo.ico" type="image/x-icon"/>
|
||||
<link rel="apple-touch-icon" href="https://s3.cflmy.cn/logo/Logo.png"/>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" crossorigin="anonymous"/>
|
||||
<link rel="icon" href="{reader_logo}" type="image/svg+xml"/>
|
||||
<!-- katex.min.css: bundled for offline reading -->
|
||||
<style>{katex_css}</style>
|
||||
<style>{css}</style>
|
||||
</head>
|
||||
<body>
|
||||
<body class="reader-page">
|
||||
<input type="checkbox" id="nav-toggle"/>
|
||||
<label class="backdrop" for="nav-toggle" aria-hidden="true"></label>
|
||||
<header class="topbar">
|
||||
<label class="nav-btn" for="nav-toggle" aria-label="Menu">☰</label>
|
||||
<div class="brand-row">
|
||||
<img class="logo" src="https://s3.cflmy.cn/logo/Logo.png" width="28" height="28" alt="marqdo"/>
|
||||
<p class="brand">marqdo</p>
|
||||
</div>
|
||||
<header class="reader-header">
|
||||
<button type="button" class="reader-menu icon-button" data-reader-action="files" aria-label="文件目录" aria-expanded="false">{menu_icon}</button>
|
||||
<a class="reader-brand" href="#" aria-label="Marqdo,返回顶部"><img src="{reader_logo}" width="46" height="46" alt=""/><span>Marqdo<small>EXECUTABLE KNOWLEDGE</small></span></a>
|
||||
<button type="button" class="reader-search icon-button" data-reader-action="search" aria-label="搜索文档">{search_icon}</button>
|
||||
<nav class="reader-tabs" aria-label="阅读导航">
|
||||
<button type="button" class="is-active" data-reader-action="document" aria-current="page">文档</button>
|
||||
<button type="button" data-reader-action="functions">函数</button>
|
||||
<button type="button" data-reader-action="variables">变量</button>
|
||||
<button type="button" data-reader-action="memory">内存</button>
|
||||
<button type="button" data-reader-action="execution">运行</button>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="reader-ornament reader-blossom-top" aria-hidden="true"></div>
|
||||
<div class="shell">
|
||||
<aside class="nav">
|
||||
<div class="nav-brand">
|
||||
<div class="brand-row">
|
||||
<img class="logo" src="https://s3.cflmy.cn/logo/Logo.png" width="32" height="32" alt="marqdo"/>
|
||||
<img class="logo" src="{reader_logo}" width="32" height="32" alt="marqdo"/>
|
||||
<div>
|
||||
<p class="brand">marqdo</p>
|
||||
<p class="brand">Marqdo</p>
|
||||
<p class="tagline">view</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1703,6 +1712,22 @@ pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<div class="reader-ornament reader-blossom-bottom" aria-hidden="true"></div>
|
||||
<footer class="reader-footer"><span>MARQDO</span><span>代码即文档 · 文档即知识库 · 知识即可执行</span></footer>
|
||||
<div class="reader-dock" role="toolbar" aria-label="文档操作">
|
||||
<button type="button" class="icon-button" data-reader-action="reload" aria-label="重新加载">{reload_icon}</button>
|
||||
<button type="button" class="icon-button" data-reader-action="settings" aria-label="阅读设置">{settings_icon}</button>
|
||||
<button type="button" class="reader-play icon-button" data-reader-action="run" aria-label="运行文档">{play_icon}</button>
|
||||
<button type="button" class="icon-button" data-reader-action="clear" aria-label="清理输出">{clear_icon}</button>
|
||||
<button type="button" class="icon-button" data-reader-action="more" aria-label="更多操作">{more_icon}</button>
|
||||
</div>
|
||||
<div class="reader-toast" role="status" aria-live="polite" hidden></div>
|
||||
<dialog id="reader-dialog" class="reader-dialog" aria-labelledby="reader-dialog-title"><div class="reader-dialog-head"><h2 id="reader-dialog-title"></h2><button type="button" class="icon-button" data-reader-action="close-dialog" aria-label="关闭">×</button></div><div id="reader-dialog-content"></div></dialog>
|
||||
<style>{reader_css}
|
||||
.reader-hero h1::after {{ background-image:url("{reader_feather}"); }}
|
||||
.reader-blossom-top, .reader-blossom-bottom {{ background-image: url("{reader_blossom}"); }}
|
||||
</style>
|
||||
<script>{reader_js}</script>
|
||||
<dialog class="var-dialog" id="var-dialog" aria-labelledby="var-dialog-title">
|
||||
<div class="var-dialog-sheet">
|
||||
<div class="var-dialog-head">
|
||||
@@ -1712,9 +1737,9 @@ pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
<div class="var-dialog-body" id="var-dialog-body"></div>
|
||||
</div>
|
||||
</dialog>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" crossorigin="anonymous"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body,{{delimiters:[{{left:'$$',right:'$$',display:true}},{{left:'\\(',right:'\\)',display:false}}],ignoredTags:['script','noscript','style','textarea','pre','code','kbd']}});"></script>
|
||||
<script>{katex_js}</script>
|
||||
<script>{katex_render_js}</script>
|
||||
<script>document.addEventListener('DOMContentLoaded', function () {{ renderMathInElement(document.body, {{delimiters:[{{left:'$$',right:'$$',display:true}},{{left:'\\(',right:'\\)',display:false}}], ignoredTags:['script','noscript','style','textarea','pre','code','kbd']}}); if(window.MarqdoReader) window.MarqdoReader.refreshAnnotations(); }});</script>
|
||||
<script defer src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js" crossorigin="anonymous"
|
||||
onload="document.querySelectorAll('pre.code-body code').forEach(function(el){{hljs.highlightElement(el);}});"></script>
|
||||
<script>
|
||||
@@ -2586,177 +2611,13 @@ pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
}});
|
||||
}}
|
||||
|
||||
function ensureBlockLeaders(block) {{
|
||||
var leaders = block.querySelector(":scope > .annot-leaders");
|
||||
if (!leaders) {{
|
||||
leaders = document.createElement("div");
|
||||
leaders.className = "annot-leaders";
|
||||
leaders.setAttribute("aria-hidden", "true");
|
||||
block.insertBefore(leaders, block.firstChild);
|
||||
}}
|
||||
return leaders;
|
||||
}}
|
||||
|
||||
function leaderColor(kind) {{
|
||||
if (kind === "bind") return "#5ac8fa";
|
||||
if (kind === "return") return "#30d158";
|
||||
if (kind === "call" || kind === "expr" || kind === "code") return "#ff9f0a";
|
||||
if (kind === "branch") return "#bf5af2";
|
||||
if (kind === "loop") return "#64d2ff";
|
||||
return "#8e8e93";
|
||||
}}
|
||||
|
||||
function initAnnotLeaders() {{
|
||||
var bands = document.querySelectorAll("[data-annot-band]");
|
||||
if (!bands.length) return;
|
||||
var reduce = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
var narrow = window.matchMedia && window.matchMedia("(max-width: 640px)").matches;
|
||||
|
||||
function layoutBand(band) {{
|
||||
var block = band.closest(".doc-block");
|
||||
if (!block) return;
|
||||
var leaders = ensureBlockLeaders(block);
|
||||
leaders.innerHTML = "";
|
||||
var chipsEl = band.querySelector(".annot-chips");
|
||||
var chips = Array.prototype.slice.call(
|
||||
band.querySelectorAll(".annot-chip:not(.annot-chip-overflow):not([hidden]):not(.is-frame-hidden)")
|
||||
);
|
||||
// Pair chips with anchors; reorder DOM left→right under underlines so
|
||||
// L-leaders do not cross (crowded reverse order looked like missing lines).
|
||||
var items = [];
|
||||
chips.forEach(function (chip) {{
|
||||
var id = chip.getAttribute("data-annot-id") || "";
|
||||
var kind = chip.getAttribute("data-annot-kind") || "";
|
||||
var anchor = id
|
||||
? (block.querySelector('.mq-anchor[data-annot-id="' + id + '"]')
|
||||
|| document.querySelector('.mq-anchor[data-annot-id="' + id + '"]'))
|
||||
: null;
|
||||
// Fallback: match mark kind on this block (frame chips may share a span).
|
||||
if (!anchor) {{
|
||||
var cls = kind === "bind" ? "mq-decl"
|
||||
: kind === "return" ? "mq-return"
|
||||
: (kind === "call" || kind === "expr" || kind === "code") ? "mq-code"
|
||||
: "";
|
||||
if (cls) anchor = block.querySelector(".mq-anchor." + cls);
|
||||
}}
|
||||
if (!anchor) return;
|
||||
if (id) anchor.setAttribute("data-annot-id", id);
|
||||
items.push({{
|
||||
chip: chip,
|
||||
anchor: anchor,
|
||||
kind: kind,
|
||||
x: anchor.getBoundingClientRect().left
|
||||
}});
|
||||
}});
|
||||
items.sort(function (a, b) {{ return a.x - b.x; }});
|
||||
if (chipsEl && items.length) {{
|
||||
items.forEach(function (it) {{ chipsEl.appendChild(it.chip); }});
|
||||
var more = band.querySelector("[data-annot-more]");
|
||||
if (more) chipsEl.appendChild(more);
|
||||
}}
|
||||
if (reduce || narrow || items.length > MAX_VISIBLE_ANNOTS) {{
|
||||
block.classList.add("is-keyed");
|
||||
band.classList.add("is-keyed");
|
||||
items.forEach(function (it, i) {{
|
||||
it.chip.setAttribute("data-annot-key", String(i + 1));
|
||||
}});
|
||||
return;
|
||||
}}
|
||||
block.classList.remove("is-keyed");
|
||||
band.classList.remove("is-keyed");
|
||||
// Mid-bottom of mark → mid-top of chip: vertical, horizontal rail, short stub.
|
||||
var blockRect = block.getBoundingClientRect();
|
||||
var bw = Math.max(1, block.offsetWidth);
|
||||
var bh = Math.max(1, block.offsetHeight);
|
||||
var svgNS = "http://www.w3.org/2000/svg";
|
||||
var svg = document.createElementNS(svgNS, "svg");
|
||||
svg.setAttribute("width", String(bw));
|
||||
svg.setAttribute("height", String(bh));
|
||||
svg.setAttribute("viewBox", "0 0 " + bw + " " + bh);
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
items.forEach(function (it) {{
|
||||
var a = it.anchor.getBoundingClientRect();
|
||||
var c = it.chip.getBoundingClientRect();
|
||||
var x0 = a.left + a.width / 2 - blockRect.left;
|
||||
var y0 = a.bottom - blockRect.top + 1;
|
||||
var x1 = c.left + c.width / 2 - blockRect.left;
|
||||
var y1 = c.top - blockRect.top;
|
||||
if (y1 < y0 + 8) {{
|
||||
y1 = y0 + 12;
|
||||
}}
|
||||
// Short stub into chip top-center; rail sits above that.
|
||||
var stub = Math.min(10, Math.max(6, (y1 - y0) * 0.28));
|
||||
var yRail = y1 - stub;
|
||||
if (yRail < y0 + 4) {{
|
||||
yRail = (y0 + y1) / 2;
|
||||
}}
|
||||
var path = document.createElementNS(svgNS, "path");
|
||||
path.setAttribute("class", "annot-leader annot-" + it.kind);
|
||||
path.setAttribute("stroke", leaderColor(it.kind));
|
||||
// Orthogonal: down from mark mid → across → short down to chip mid.
|
||||
path.setAttribute(
|
||||
"d",
|
||||
"M " + x0.toFixed(1) + " " + y0.toFixed(1) +
|
||||
" L " + x0.toFixed(1) + " " + yRail.toFixed(1) +
|
||||
" L " + x1.toFixed(1) + " " + yRail.toFixed(1) +
|
||||
" L " + x1.toFixed(1) + " " + y1.toFixed(1)
|
||||
);
|
||||
svg.appendChild(path);
|
||||
}});
|
||||
leaders.appendChild(svg);
|
||||
}}
|
||||
|
||||
function layoutAll() {{
|
||||
bands.forEach(layoutBand);
|
||||
}}
|
||||
layoutAll();
|
||||
// Second pass after fonts/layout settle (first paint often has zero chip width).
|
||||
requestAnimationFrame(function () {{ layoutAll(); }});
|
||||
if (document.documentElement.dataset.annotLeadersRo === "1") return;
|
||||
document.documentElement.dataset.annotLeadersRo = "1";
|
||||
if (typeof ResizeObserver !== "undefined") {{
|
||||
var ro = new ResizeObserver(function () {{ layoutAll(); }});
|
||||
bands.forEach(function (b) {{
|
||||
ro.observe(b);
|
||||
var blk = b.closest(".doc-block");
|
||||
if (blk) ro.observe(blk);
|
||||
}});
|
||||
var surface = document.querySelector(".document-surface");
|
||||
if (surface) ro.observe(surface);
|
||||
}}
|
||||
window.addEventListener("resize", layoutAll);
|
||||
|
||||
document.querySelectorAll("[data-annot-more]").forEach(function (btn) {{
|
||||
if (btn.dataset.bound === "1") return;
|
||||
btn.dataset.bound = "1";
|
||||
btn.addEventListener("click", function () {{
|
||||
var band = btn.closest("[data-annot-band]");
|
||||
if (!band) return;
|
||||
band.classList.add("is-expanded");
|
||||
btn.hidden = true;
|
||||
layoutAll();
|
||||
}});
|
||||
}});
|
||||
document.querySelectorAll(".annot-chip").forEach(function (chip) {{
|
||||
if (chip.dataset.focusBound === "1") return;
|
||||
chip.dataset.focusBound = "1";
|
||||
chip.addEventListener("mouseenter", function () {{
|
||||
var id = chip.getAttribute("data-annot-id");
|
||||
if (!id) return;
|
||||
var a = document.querySelector('.mq-anchor[data-annot-id="' + id + '"]');
|
||||
if (a) a.classList.add("is-focus");
|
||||
chip.classList.add("is-focus");
|
||||
}});
|
||||
chip.addEventListener("mouseleave", function () {{
|
||||
var id = chip.getAttribute("data-annot-id");
|
||||
if (!id) return;
|
||||
var a = document.querySelector('.mq-anchor[data-annot-id="' + id + '"]');
|
||||
if (a) a.classList.remove("is-focus");
|
||||
chip.classList.remove("is-focus");
|
||||
}});
|
||||
}});
|
||||
if (window.MarqdoReader) window.MarqdoReader.refreshAnnotations();
|
||||
}}
|
||||
|
||||
window.marqdoInitDocument = function () {{
|
||||
initForeignCards(); initCallPickers(); initLoopPickers(); initAnnotLeaders();
|
||||
}};
|
||||
if (document.readyState === "loading") {{
|
||||
document.addEventListener("DOMContentLoaded", function () {{
|
||||
initForeignCards();
|
||||
@@ -2821,6 +2682,21 @@ pub fn layout(title: &str, nav: &str, main: &str) -> String {
|
||||
"##,
|
||||
title = escape(title),
|
||||
css = stylesheet(),
|
||||
katex_css = include_str!("assets/vendor/katex.min.css"),
|
||||
katex_js = include_str!("assets/vendor/katex.min.js"),
|
||||
katex_render_js = include_str!("assets/vendor/auto-render.min.js"),
|
||||
reader_feather = include_str!("assets/feather.uri"),
|
||||
reader_css = include_str!("reader.css"),
|
||||
reader_js = include_str!("reader.js"),
|
||||
reader_logo = include_str!("assets/logo.uri"),
|
||||
reader_blossom = include_str!("assets/blossom.uri"),
|
||||
menu_icon = reader_icon("M4 6h16M4 12h16M4 18h16"),
|
||||
search_icon = reader_icon("M21 21l-5-5M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0"),
|
||||
reload_icon = reader_icon("M20 7V3l-3 3a8 8 0 1 0 2 11M20 3h-5"),
|
||||
settings_icon = reader_icon("M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8M12 2v3M12 19v3M2 12h3M19 12h3M5 5l2 2M17 17l2 2M5 19l2-2M17 7l2-2"),
|
||||
play_icon = reader_icon("m9 5 11 7-11 7z"),
|
||||
clear_icon = reader_icon("m14 3 4 2-4 8M5 12l8 2 2 6H3zM7 15l-1 4M10 16l-1 4"),
|
||||
more_icon = reader_icon("M5 12h.01M12 12h.01M19 12h.01"),
|
||||
nav = nav,
|
||||
main = main
|
||||
)
|
||||
@@ -3694,8 +3570,8 @@ body.notebook-page .wb-source-text { color: var(--nb-text); }
|
||||
}
|
||||
try { localStorage.setItem(THEME_KEY, theme); } catch (e) {}
|
||||
}
|
||||
var savedTheme = "dark";
|
||||
try { savedTheme = localStorage.getItem(THEME_KEY) || "dark"; } catch (e) {}
|
||||
var savedTheme = "light";
|
||||
try { savedTheme = localStorage.getItem(THEME_KEY) || "light"; } catch (e) {}
|
||||
applyTheme(savedTheme);
|
||||
var live = !!window.MARQDO_VIEW_LIVE;
|
||||
var path = window.MARQDO_FILE_PATH || "";
|
||||
@@ -3924,11 +3800,12 @@ body.notebook-page .wb-source-text { color: var(--nb-text); }
|
||||
}
|
||||
var block = document.getElementById("exec-block");
|
||||
if (block) block.hidden = false;
|
||||
if (window.MarqdoReader) window.MarqdoReader.applyExecution(data);
|
||||
}
|
||||
function runAll(restart) {
|
||||
status(restart ? "restarting…" : "running all…");
|
||||
if (!state.persistent && Object.keys(state.cells).length === 0) {
|
||||
post("api/session/run_document", {}).then(function (r) {
|
||||
post("api/session/run_document", { stdin: cellStdin() }).then(function (r) {
|
||||
renderDocumentResult(r);
|
||||
status(r.ok ? "document run done" : (r.error || "document run failed"));
|
||||
}).catch(function (e) { status(String(e)); });
|
||||
@@ -4291,7 +4168,7 @@ window.MARQDO_VIEW_PAGE_TOKEN = {page_token_js};
|
||||
<h1 class="page">{title}<span class="status-pill {status}">{status_label}</span></h1>
|
||||
<p class="meta">{rel}</p>
|
||||
{notebook}
|
||||
<section class="block structure-block" id="structure">
|
||||
<section class="block structure-block" id="document-section">
|
||||
<h2>文档</h2>
|
||||
{structure_block}
|
||||
</section>
|
||||
|
||||
@@ -110,19 +110,42 @@ fn err(error: String) -> serde_json::Value {
|
||||
|
||||
pub fn api_run_document(root: &Path, body: &str) -> serde_json::Value {
|
||||
let v = body_value(body);
|
||||
let (_rel, abs) = match path_of(root, &v) {
|
||||
let (rel, abs) = match path_of(root, &v) {
|
||||
Ok(p) => p,
|
||||
Err(e) => return err(e),
|
||||
};
|
||||
let source = match std::fs::read_to_string(&abs) {
|
||||
Ok(source) => source,
|
||||
Err(e) => return err(e.to_string()),
|
||||
};
|
||||
let mut opts = crate::RunOptions::default();
|
||||
opts.fs_root = Some(root.to_path_buf());
|
||||
opts.sleep_limit_ms = Some(30_000);
|
||||
opts.stdin_lines = crate::input_feed::split_stdin_text(v["stdin"].as_str().unwrap_or(""));
|
||||
match crate::run_file_capture(&abs, &opts) {
|
||||
Ok(cap) => serde_json::json!({
|
||||
"ok": true,
|
||||
"stdout": cap.stdout,
|
||||
"value": json_value(&cap.value),
|
||||
}),
|
||||
Ok(cap) => {
|
||||
// Render annotations from this exact capture: fetching /api/view-trace
|
||||
// would execute the program a second time and could change its result.
|
||||
let (structure_html, trace_json) = match crate::load::parse_source_auto(&source) {
|
||||
Ok(module) => {
|
||||
let annots = crate::view::annot::build_view_annots(&module, &source, &cap);
|
||||
(
|
||||
crate::view::render::render_module_structure_with_annots(&module, &source, &annots),
|
||||
crate::view::annot::view_execution_report_json(&rel, true, &cap),
|
||||
)
|
||||
}
|
||||
Err(_) => (String::new(), String::new()),
|
||||
};
|
||||
serde_json::json!({
|
||||
"ok": true,
|
||||
"stdout": cap.stdout,
|
||||
"value": json_value(&cap.value),
|
||||
"structure_html": structure_html,
|
||||
"trace_json": trace_json,
|
||||
"bindings_html": crate::view::render::render_bindings_html(&cap.bindings),
|
||||
"page_token": crate::view::page_token_from_source(&rel, &source),
|
||||
})
|
||||
}
|
||||
Err(e) => serde_json::json!({ "ok": false, "error": format!("{e:#}") }),
|
||||
}
|
||||
}
|
||||
@@ -613,3 +636,27 @@ mod replay_api_tests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod reader_run_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn document_run_returns_matching_prose_trace_and_bindings() {
|
||||
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
let rel = format!("target/reader-run-{}.mq.md", std::process::id());
|
||||
let path = root.join(&rel);
|
||||
std::fs::write(&path, "# main\n\n**n = 1**\n**n = n + 1**\n> print text=`n`\n*n*\n").unwrap();
|
||||
let result = api_run_document(&root, &serde_json::json!({"path": rel}).to_string());
|
||||
let _ = std::fs::remove_file(path);
|
||||
assert_eq!(result["ok"], true, "{result}");
|
||||
assert_eq!(result["stdout"].as_str().unwrap().trim(), "2");
|
||||
let trace: serde_json::Value = serde_json::from_str(result["trace_json"].as_str().unwrap()).unwrap();
|
||||
let writes: Vec<_> = trace["events"].as_array().unwrap().iter()
|
||||
.filter(|e| e["name"] == "n").filter_map(|e| e["value_after"].as_str()).collect();
|
||||
assert!(writes.contains(&"1") && writes.contains(&"2"), "{trace}");
|
||||
assert!(result["structure_html"].as_str().unwrap().contains("data-annot-band"));
|
||||
assert!(result["bindings_html"].as_str().unwrap().contains("n"));
|
||||
assert!(!result["page_token"].as_str().unwrap().is_empty());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/* The shared live/export reading theme. All assets are embedded by html::layout. */
|
||||
body.reader-page, body.reader-page.notebook-page, body.reader-page.notebook-page[data-theme="light"] {
|
||||
color-scheme: light;
|
||||
--bg:#fcf9f5; --surface:#fffcf8; --ink:#29251f; --muted:#847565;
|
||||
--line:#e7ddce; --line-strong:#a98243; --fill:#f7f0e5; --hover:#f1e6d5; --focus:#8a622e;
|
||||
--gold:#b88a45; --olive:#52603a; --radius:12px;
|
||||
--serif:"Iowan Old Style","Palatino Linotype","Noto Serif CJK SC","Source Han Serif SC","Songti SC",SimSun,Georgia,serif;
|
||||
--nb-bg:var(--bg); --nb-surface:var(--surface); --nb-surface-2:var(--fill); --nb-surface-3:var(--hover);
|
||||
--nb-border:var(--line); --nb-border-soft:var(--line); --nb-text:var(--ink); --nb-strong:#252019;
|
||||
--nb-muted:var(--muted); --nb-accent:#91692f; --nb-accent-hover:#795623; --nb-success:#52603a;
|
||||
--nb-error:#a63e30; --nb-warning:#996b28; --nb-selection:#efe3ce; --nb-on-accent:#33291b;
|
||||
--nb-topbar:#fcf9f5ee; --nb-code-bg:#f7f2e9; --nb-code-text:var(--ink); --nb-error-bg:#faede7;
|
||||
--nb-error-border:#dba494; --syn-fg:#332c22; --syn-comment:#7d8067; --syn-keyword:#896132;
|
||||
--syn-string:#536741; --syn-number:#a05b36; --syn-variable:#775341; --syn-function:#78622c;
|
||||
--syn-type:#42645b; --syn-meta:#8e677c;
|
||||
background:var(--bg); color:var(--ink); font-size:16px; line-height:1.65;
|
||||
}
|
||||
body.reader-page.notebook-page[data-theme="dark"] {
|
||||
color-scheme:dark; --bg:#24261f; --surface:#2d3027; --ink:#e7e0d2; --muted:#b2a58f;
|
||||
--line:#46483a; --fill:#34372c; --hover:#414333; --focus:#e0bb79; --gold:#d2ac6e; --olive:#beca98;
|
||||
--nb-strong:#f0e8d8; --nb-accent:#b58c4f; --nb-accent-hover:#caa468; --nb-success:#bccb98;
|
||||
--nb-code-bg:#282b23; --nb-selection:#4b4a33; --nb-on-accent:#f5eddc; --nb-code-text:var(--ink);
|
||||
--syn-fg:#e0dbc9; --syn-comment:#a6ab90; --syn-keyword:#dbbb83; --syn-string:#b7ca9b;
|
||||
--syn-number:#d3ae8e; --syn-variable:#e0ba9f; --syn-function:#d3c589; --syn-type:#9fc2b2;
|
||||
}
|
||||
.reader-page *:focus-visible { outline:2px solid var(--gold); outline-offset:4px; }
|
||||
.reader-page button { font-family:var(--sans); }
|
||||
.reader-header { position:relative; z-index:5; max-width:1080px; margin:0 auto; padding:22px 70px 0; text-align:center; }
|
||||
.reader-brand { display:inline-flex; align-items:center; gap:10px; text-align:left; }
|
||||
.reader-brand span { font:32px/1.1 var(--serif); letter-spacing:-1px; }
|
||||
.reader-brand small { display:block; font:9px/2.6 var(--sans); letter-spacing:3px; padding-left:2px; }
|
||||
.reader-tabs { display:flex; justify-content:center; gap:clamp(20px,5vw,70px); border-bottom:1px solid var(--line); margin-top:20px; }
|
||||
.reader-tabs button { position:relative; background:none; border:0; padding:12px 16px; font:20px/1.5 var(--serif); color:var(--ink); cursor:pointer; }
|
||||
.reader-tabs button.is-active { color:var(--focus); }
|
||||
.reader-tabs button.is-active::after { content:""; height:2px; background:var(--gold); position:absolute; bottom:-1px; left:0; right:0; }
|
||||
.icon-button { display:inline-flex; justify-content:center; align-items:center; padding:10px; border:0; background:transparent; color:var(--ink); cursor:pointer; border-radius:50%; }
|
||||
.icon-button:hover { background:var(--hover); }
|
||||
.reader-menu,.reader-search { position:absolute; top:36px; }
|
||||
.reader-menu { left:22px; }.reader-search { right:22px; }
|
||||
body.reader-page .shell { display:block; min-height:65vh; max-width:none; }
|
||||
body.reader-page .panel-wrap { overflow:visible; background:transparent; container-type:normal; }
|
||||
body.reader-page main.panel { max-width:1180px; margin:auto; padding:48px 210px 60px; }
|
||||
body.reader-page .nav { position:fixed; width:min(340px,88vw); top:0; left:0; bottom:0; height:100dvh; z-index:40; background:var(--bg); padding:30px 22px; transform:translateX(-105%); transition:transform .2s ease; box-shadow:10px 0 50px #33241312; }
|
||||
body.reader-page #nav-toggle:checked ~ .shell .nav { transform:translateX(0); }
|
||||
body.reader-page #nav-toggle:checked ~ .backdrop { display:block; z-index:35; }
|
||||
body.reader-page .nav-brand { display:block; margin-bottom:30px; }.reader-page .nav a.file.active { background:var(--fill); color:var(--focus); box-shadow:inset 2px 0 var(--gold); }
|
||||
.reader-ornament { position:absolute; pointer-events:none; background-repeat:no-repeat; background-size:contain; z-index:0; }
|
||||
.reader-blossom-top { top:0; left:0; width:280px; height:330px; opacity:.64; }
|
||||
.reader-blossom-bottom { right:0; bottom:20px; width:250px; height:270px; transform:rotate(180deg); opacity:.55; }
|
||||
body.reader-page { position:relative; }
|
||||
body.reader-page .reader-hero { text-align:center; margin:0 -60px 42px; }
|
||||
.reader-hero .eyebrow { color:var(--focus); font:12px var(--serif); letter-spacing:7px; margin:0 0 8px; }
|
||||
.reader-hero h1 { font:italic 88px/1.15 var(--serif); letter-spacing:-3px; margin:0; color:var(--gold); background:linear-gradient(120deg,#b98b46,#e8c78f 60%,#b98b46); background-clip:text; -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
|
||||
.reader-hero h1::after { content:"❧"; font-size:66px; display:inline-block; margin-left:10px; }
|
||||
.reader-hero .reader-motto { font:15px/1.9 var(--serif); letter-spacing:3px; color:var(--muted); margin:14px 0 0; }
|
||||
body.reader-page h1.page { font:600 30px/1.4 var(--serif); letter-spacing:0; margin:0 0 8px; }
|
||||
body.reader-page .meta { font:12px/1.6 var(--sans); margin-bottom:30px; color:var(--muted); overflow-wrap:anywhere; }
|
||||
body.reader-page .meta::before { content:"▱"; color:var(--gold); margin-right:8px; }
|
||||
body.reader-page .structure-block > h2 { display:none; }
|
||||
body.reader-page .struct-wrap { display:block; }
|
||||
body.reader-page .outline-rail { display:none; }
|
||||
body.reader-page .structure { display:block; border:0; border-radius:0; background:transparent; overflow:visible; }
|
||||
body.reader-page .document-surface { font-family:var(--serif); }
|
||||
body.reader-page .structure .doc-block, body.reader-page .structure > .card { border:0; background:transparent; padding:0; margin:18px 0; border-radius:0; box-shadow:none; }
|
||||
body.reader-page .structure .doc-prose { font:19px/1.72 var(--serif); color:var(--ink); overflow-wrap:anywhere; }
|
||||
body.reader-page .doc-fun-title { font:600 34px/1.4 var(--serif); letter-spacing:0; margin:32px 0 18px; border:0; padding:0 0 0 22px; position:relative; }
|
||||
body.reader-page .doc-fun-title::before { content:""; position:absolute; left:0; top:.2em; bottom:.15em; width:5px; transform:skew(-10deg); background:linear-gradient(#b98b46,#efd3a0,#b98b46); }
|
||||
body.reader-page .doc-imports { display:flex; gap:10px; flex-wrap:wrap; margin:10px 0 26px; }
|
||||
body.reader-page .chip { border:1px solid var(--line); background:var(--fill); border-radius:22px; padding:4px 12px; font:12px/1.5 var(--mono); }
|
||||
body.reader-page .doc-imports .chip::before { content:"◇"; color:var(--gold); margin-right:8px; }
|
||||
body.reader-page .doc-prose code,body.reader-page .mq-anchor { border-radius:6px; padding:2px 5px; background:var(--fill); color:var(--ink); }
|
||||
body.reader-page .mq-anchor { border-bottom:1px solid var(--gold); }
|
||||
body.reader-page .mq-anchor.is-focus { background:var(--hover); outline:1px solid var(--gold); }
|
||||
body.reader-page blockquote { margin:24px 0; padding:18px 22px; background:var(--fill); border:1px solid var(--line); border-radius:9px; color:var(--muted); }
|
||||
body.reader-page blockquote p { margin:0; }
|
||||
body.reader-page .formula-card { background:var(--fill); border:1px solid var(--line); border-left:4px solid var(--gold); border-radius:10px; margin:24px 0; }
|
||||
body.reader-page .code-card { border:1px solid var(--line); border-radius:10px; overflow:hidden; margin:22px 0; }
|
||||
body.reader-page .doc-table { font:14px/1.7 var(--sans); }
|
||||
body.reader-page .doc-table-wrap { margin:22px 0; }
|
||||
body.reader-page .annot-band { padding-top:5px; margin:10px 0; min-height:0; }
|
||||
body.reader-page .annot-chip { font:12px/1.5 var(--sans); padding:5px 10px; background:var(--fill); border-color:var(--line); border-left-color:var(--gold); border-radius:18px; }
|
||||
body.reader-page .annot-chip.annot-return { border-left-color:var(--olive); }
|
||||
body.reader-page .annot-chip:hover,body.reader-page .annot-chip.is-focus { background:var(--hover); }
|
||||
body.reader-page .annot-label { color:var(--olive); }.reader-page .annot-value { color:var(--ink); }
|
||||
/* Side notes retain their owning band and frame attributes. JS only positions them. */
|
||||
body.reader-page .doc-block.has-margin-notes > .annot-band { height:0; margin:0; padding:0; position:static; }
|
||||
body.reader-page .has-margin-notes > .annot-band > .annot-chips { position:static; display:block; }
|
||||
body.reader-page .annot-chip.is-margin-note { position:absolute; width:150px; max-width:none; display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:4px 0; border:0; border-radius:0; background:var(--bg); font:13px/1.55 var(--sans); overflow-wrap:anywhere; z-index:3; }
|
||||
body.reader-page .is-margin-note .annot-label { font:600 18px/1.4 var(--serif); }
|
||||
body.reader-page .is-margin-note .annot-value { max-height:100px; overflow:auto; max-width:100%; }
|
||||
body.reader-page .is-margin-note:hover { background:var(--fill); }
|
||||
body.reader-page .reader-leader { position:absolute; pointer-events:none; height:1px; border-top:1px solid var(--olive); opacity:.65; transform-origin:left center; }
|
||||
.reader-leader::before,.reader-leader::after { content:""; position:absolute; width:4px; height:4px; top:-2px; background:var(--gold); border-radius:50%; }
|
||||
.reader-leader::before { left:0; }.reader-leader::after { right:0; }
|
||||
body.reader-page #notebook-bar,body.reader-page #nb-stdin-bar,body.reader-page #nb-state-actions { display:none; }
|
||||
body.reader-page.reader-tools #notebook-bar,body.reader-page.reader-tools #nb-stdin-bar,body.reader-page.reader-tools #nb-state-actions:not([hidden]) { display:flex; position:static; flex-wrap:wrap; border-radius:10px; margin-bottom:14px; }
|
||||
body.reader-page #nb-status { white-space:normal; }
|
||||
body.reader-page .exec-block { border-top:1px solid var(--line); padding-top:24px; margin-top:46px; }
|
||||
body.reader-page .out,body.reader-page .source { background:var(--fill); border:1px solid var(--line); border-radius:10px; }
|
||||
body.reader-page .source-block { color:var(--muted); font-size:13px; }
|
||||
.reader-dock { position:fixed; z-index:20; bottom:24px; left:50%; transform:translateX(-50%); display:flex; align-items:center; gap:17px; padding:6px 17px; border:1px solid var(--line); border-radius:50px; background:color-mix(in srgb,var(--bg) 90%,transparent); backdrop-filter:blur(18px); box-shadow:0 8px 28px #78562614,inset 0 1px #ffffff55; }
|
||||
.reader-dock .reader-play { width:56px; height:56px; margin:-9px 2px; color:white; background:linear-gradient(125deg,#a97632,#edc57e 55%,#c5964e); border:1px solid #f9e3bb; box-shadow:0 3px 12px #b18c4530; }
|
||||
.reader-play svg { fill:currentColor; width:22px; }
|
||||
.reader-footer { position:relative; padding:32px 20px 125px; display:flex; flex-direction:column; gap:10px; align-items:center; color:var(--muted); font:11px/1.8 var(--sans); letter-spacing:2px; border-top:1px solid var(--line); background:linear-gradient(170deg,transparent,var(--fill)); }
|
||||
.reader-footer > :first-child { letter-spacing:5px; color:var(--gold); }
|
||||
.reader-dialog,.reader-page .var-dialog { color:var(--ink); background:var(--bg); border:1px solid var(--line); border-radius:16px; width:min(620px,calc(100vw - 32px)); max-height:80dvh; padding:24px; box-shadow:0 20px 90px #33241325; }
|
||||
.reader-dialog::backdrop,.reader-page .var-dialog::backdrop { background:#29251f50; backdrop-filter:blur(5px); }
|
||||
.reader-dialog-head { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:16px; }
|
||||
.reader-dialog-head h2 { font:24px var(--serif); margin:0; }
|
||||
.reader-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; font:12px/1.6 var(--mono); }
|
||||
.reader-dialog input[type="search"] { width:100%; background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:8px; padding:12px; font:15px var(--sans); }
|
||||
.reader-dialog button.reader-option { display:block; width:100%; padding:12px; margin:8px 0; text-align:left; background:var(--fill); color:var(--ink); border:1px solid var(--line); border-radius:8px; cursor:pointer; }
|
||||
.reader-dialog .vars-panel { max-height:none; }.reader-dialog .outline-section { border:0; background:transparent; }
|
||||
.reader-toast { position:fixed; z-index:60; bottom:110px; left:50%; transform:translateX(-50%); max-width:calc(100vw - 32px); padding:10px 18px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); box-shadow:0 4px 25px #33241318; font:13px/1.5 var(--sans); }
|
||||
body.reader-page.reader-large .doc-prose { font-size:22px; }
|
||||
body.reader-page.reader-hide-notes .annot-band,body.reader-page.reader-hide-notes .annot-leaders { display:none; }
|
||||
.reader-search-result { display:block; padding:12px 0; border-bottom:1px solid var(--line); font:14px/1.6 var(--sans); }
|
||||
@media(min-width:1500px) { .reader-blossom-top { width:340px; height:390px; } }
|
||||
@media(max-width:1000px) {
|
||||
body.reader-page main.panel { max-width:800px; padding:35px 42px 50px; }
|
||||
.reader-blossom-top { width:175px; opacity:.4; }
|
||||
body.reader-page .reader-hero { margin:0 0 35px; }
|
||||
}
|
||||
@media(max-width:600px) {
|
||||
.reader-header { padding:20px 18px 0; }.reader-brand span { font-size:26px; }.reader-brand img { width:36px; height:36px; }.reader-brand small { font-size:7px; letter-spacing:2px; }
|
||||
.reader-menu { left:8px; top:24px; }.reader-search { right:8px; top:24px; }
|
||||
.reader-tabs { gap:0; justify-content:space-between; margin-top:16px; }.reader-tabs button { font-size:17px; padding:10px 13px; }
|
||||
body.reader-page main.panel { padding:30px 22px 40px; }.reader-hero h1 { font-size:62px; }.reader-hero h1::after { font-size:40px; margin-left:3px; }
|
||||
.reader-hero .eyebrow { font-size:10px; letter-spacing:5px; }.reader-hero .reader-motto { font-size:11px; letter-spacing:1px; }
|
||||
body.reader-page .structure .doc-prose { font-size:17px; line-height:1.8; }body.reader-page .doc-fun-title { font-size:28px; }
|
||||
.reader-blossom-top { width:115px; opacity:.28; }.reader-blossom-bottom { width:120px; height:150px; opacity:.3; }
|
||||
.reader-dock { gap:12px; bottom:16px; padding:6px 13px; }.reader-dock .reader-play { width:50px; height:50px; }
|
||||
}
|
||||
@media(prefers-reduced-motion:reduce) { .reader-page *, .reader-page *::before { scroll-behavior:auto!important; transition:none!important; } }
|
||||
@media print {
|
||||
.reader-header,.reader-dock,.reader-ornament,.reader-footer,.reader-toast { display:none!important; }
|
||||
body.reader-page main.panel { max-width:none; padding:0; }.reader-page .annot-chip.is-margin-note { position:static; width:auto; }
|
||||
body.reader-page .doc-block.has-margin-notes > .annot-band { height:auto; }
|
||||
}
|
||||
/* Refine document rhythm without the old notebook cell dividers. */
|
||||
body.reader-page #document-section > h2 { display:none; }
|
||||
body.reader-page .doc-fun { border:0; margin:24px 0 12px; padding:0; }
|
||||
body.reader-page .document-surface { padding:0; }
|
||||
body.reader-page .reader-hero h1::after { content:""; width:85px; height:90px; vertical-align:middle; margin-left:12px; background-size:contain; background-position:center; background-repeat:no-repeat; }
|
||||
body.reader-page .mq-anchor.mq-decl,body.reader-page .mq-anchor.mq-code { border-bottom-color:var(--gold); }
|
||||
body.reader-page .mq-anchor.mq-return { border-bottom-color:var(--olive); }
|
||||
body.reader-page .doc-list-item.arm-taken { border-left-color:var(--olive); }
|
||||
body.reader-page .formula-head { color:var(--muted); }
|
||||
body.reader-page .formula-head .badge { display:none; }
|
||||
body.reader-page .formula-card .math-block { font-size:1.35rem; padding:8px 18px; }
|
||||
body.reader-page .reader-hero + h1.page { font-size:0; height:0; overflow:hidden; margin:0; }
|
||||
body.reader-page .reader-hero + h1.page .status-pill { display:none; }
|
||||
@media(max-width:600px) { body.reader-page .reader-hero h1::after { width:48px; height:60px; margin-left:4px; } }
|
||||
|
||||
body.reader-page.reader-welcome h1.page { display:none; }
|
||||
|
||||
body.reader-page .nav { visibility:hidden; }
|
||||
body.reader-page #nav-toggle:checked ~ .shell .nav { visibility:visible; }
|
||||
@@ -0,0 +1,236 @@
|
||||
/* No network dependencies: this module also runs from a file:// static export. */
|
||||
(function () {
|
||||
'use strict';
|
||||
var dialog, content, returnNodes = [], pending = false, toastTimer;
|
||||
function toast(message) {
|
||||
var el = document.querySelector('.reader-toast');
|
||||
el.textContent = message; el.hidden = false;
|
||||
clearTimeout(toastTimer); toastTimer = setTimeout(function () { el.hidden = true; }, 4200);
|
||||
}
|
||||
function restorePanels() {
|
||||
returnNodes.forEach(function (item) { if (item.marker.parentNode) item.marker.replaceWith(item.node); });
|
||||
returnNodes = [];
|
||||
document.querySelectorAll('.reader-tabs button').forEach(function (b) {
|
||||
var active = b.dataset.readerAction === 'document';
|
||||
b.classList.toggle('is-active', active);
|
||||
if (active) b.setAttribute('aria-current', 'page'); else b.removeAttribute('aria-current');
|
||||
});
|
||||
}
|
||||
function openDialog(title, action) {
|
||||
restorePanels(); content.replaceChildren();
|
||||
document.getElementById('reader-dialog-title').textContent = title;
|
||||
if (!dialog.open) dialog.showModal();
|
||||
document.querySelectorAll('.reader-tabs button').forEach(function (b) {
|
||||
var active = b.dataset.readerAction === action;
|
||||
b.classList.toggle('is-active', active);
|
||||
if (active) b.setAttribute('aria-current', 'page'); else b.removeAttribute('aria-current');
|
||||
});
|
||||
}
|
||||
function movePanel(node) {
|
||||
if (!node) { content.textContent = '当前文档暂无此类信息。'; return; }
|
||||
var marker = document.createComment('reader-panel'); node.before(marker);
|
||||
returnNodes.push({ node: node, marker: marker }); content.appendChild(node);
|
||||
}
|
||||
function option(label, callback) {
|
||||
var b = document.createElement('button'); b.type = 'button'; b.className = 'reader-option';
|
||||
b.textContent = label; b.addEventListener('click', callback); content.appendChild(b); return b;
|
||||
}
|
||||
function clickExisting(id) {
|
||||
var el = document.getElementById(id);
|
||||
if (el && !el.disabled) el.click(); else toast('当前文档没有可用的此项操作。');
|
||||
}
|
||||
function scrollTo(el) {
|
||||
if (!el) { toast('当前文档暂无此类信息。'); return; }
|
||||
if (dialog.open) dialog.close();
|
||||
el.scrollIntoView({ behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth', block: 'center' });
|
||||
}
|
||||
function showSearch() {
|
||||
openDialog('搜索文档', 'search');
|
||||
var input = document.createElement('input'); input.type = 'search'; input.placeholder = '搜索正文、函数或文件…'; input.setAttribute('aria-label', '搜索内容');
|
||||
var results = document.createElement('div'); results.setAttribute('aria-live', 'polite'); content.append(input, results);
|
||||
input.addEventListener('input', function () {
|
||||
results.replaceChildren(); var q = input.value.trim().toLocaleLowerCase(); if (!q) return;
|
||||
var nodes = Array.from(document.querySelectorAll('.document-surface .doc-prose, .doc-fun-title, .nav a.file'));
|
||||
var count = 0;
|
||||
nodes.forEach(function (node) {
|
||||
if (count >= 40 || node.textContent.toLocaleLowerCase().indexOf(q) < 0) return;
|
||||
count++;
|
||||
var b = document.createElement('button'); b.type = 'button'; b.className = 'reader-option';
|
||||
b.textContent = node.textContent.trim().slice(0, 150);
|
||||
b.addEventListener('click', function () { if (node.matches('a')) location.href = node.href; else scrollTo(node); }); results.appendChild(b);
|
||||
});
|
||||
if (!count) results.textContent = '没有找到匹配内容。';
|
||||
});
|
||||
input.focus();
|
||||
}
|
||||
function action(name) {
|
||||
if (name === 'files') {
|
||||
var toggle = document.getElementById('nav-toggle'); toggle.checked = !toggle.checked;
|
||||
document.querySelector('.reader-menu').setAttribute('aria-expanded', String(toggle.checked));
|
||||
if (toggle.checked) { var first = document.querySelector('.nav a'); if (first) first.focus(); } return;
|
||||
}
|
||||
if (name === 'close-dialog') { dialog.close(); return; }
|
||||
if (name === 'document') { if (dialog.open) dialog.close(); scrollTo(document.getElementById('document-section') || document.querySelector('main')); return; }
|
||||
if (name === 'search') { showSearch(); return; }
|
||||
if (name === 'functions' || name === 'variables') {
|
||||
var panel = document.getElementById(name === 'functions' ? 'fn-outline' : 'vars-panel');
|
||||
openDialog(name === 'functions' ? '函数目录' : '文档变量', name); movePanel(panel); return;
|
||||
}
|
||||
if (name === 'memory') {
|
||||
openDialog('执行内存与调用轨迹', name);
|
||||
var hint = document.createElement('p'); hint.textContent = window.MARQDO_VIEW_LIVE ? '当前文档已捕获的绑定与调用轨迹;会话状态可在高级工具中查看。' : '以下为导出时保存的执行快照。'; content.appendChild(hint);
|
||||
var pre = document.createElement('pre');
|
||||
try { pre.textContent = JSON.stringify(JSON.parse((document.getElementById('mq-view-trace') || {}).textContent || '{}'), null, 2); }
|
||||
catch (_) { pre.textContent = '当前没有可用执行快照。'; }
|
||||
content.appendChild(pre); return;
|
||||
}
|
||||
if (name === 'execution') { scrollTo(document.getElementById('exec-block')); return; }
|
||||
if (name === 'run') {
|
||||
if (!window.MARQDO_VIEW_LIVE) { toast('静态页面展示导出时的结果。请使用 marqdo view 启动实时运行。'); return; }
|
||||
clickExisting(document.getElementById('stream-run') ? 'stream-run' : 'nb-run-all'); toast('已请求运行文档。'); return;
|
||||
}
|
||||
if (name === 'reload') { location.reload(); return; }
|
||||
if (name === 'clear') {
|
||||
if (window.MARQDO_VIEW_LIVE) clickExisting('nb-clear');
|
||||
else { document.querySelectorAll('.code-out, #exec-main').forEach(function (el) { el.hidden = true; }); toast('已隐藏输出,重新加载可恢复导出快照。'); }
|
||||
return;
|
||||
}
|
||||
if (name === 'settings') {
|
||||
openDialog('阅读设置', name);
|
||||
option('切换浅色 / 深色', function () { clickExisting('nb-theme'); });
|
||||
option('切换标准 / 大号正文', function () { document.body.classList.toggle('reader-large'); refreshAnnotations(); });
|
||||
option('显示 / 隐藏执行标注', function () { document.body.classList.toggle('reader-hide-notes'); refreshAnnotations(); });
|
||||
return;
|
||||
}
|
||||
if (name === 'more') {
|
||||
openDialog('文档工具', name);
|
||||
option('文件目录', function () { dialog.close(); action('files'); });
|
||||
option('查看完整源码', function () { var source = document.querySelector('.source-block'); if (source) { source.open = true; scrollTo(source); } });
|
||||
option('高级运行工具', function () { document.body.classList.toggle('reader-tools'); dialog.close(); scrollTo(document.getElementById('notebook-bar')); });
|
||||
option('打印 / 保存为 PDF', function () { dialog.close(); window.print(); });
|
||||
}
|
||||
}
|
||||
function findAnchor(block, chip) {
|
||||
var id = chip.dataset.annotId;
|
||||
var anchors = block.querySelectorAll('.mq-anchor');
|
||||
for (var i = 0; i < anchors.length; i++) if (anchors[i].dataset.annotId === id) return anchors[i];
|
||||
var kind = chip.dataset.annotKind;
|
||||
return block.querySelector(kind === 'bind' ? '.mq-decl' : kind === 'return' ? '.mq-return' : '.mq-code') || block.querySelector('.doc-line, .doc-prose') || block;
|
||||
}
|
||||
function layoutAnnotations() {
|
||||
var bands = document.querySelectorAll('[data-annot-band]');
|
||||
// Reset geometry first; fallback is ordinary flow with all controls preserved.
|
||||
bands.forEach(function (band) {
|
||||
var block = band.closest('.doc-block'); if (!block) return;
|
||||
block.classList.remove('has-margin-notes', 'is-keyed'); band.classList.remove('is-keyed');
|
||||
block.querySelectorAll(':scope > .annot-leaders').forEach(function (el) { el.replaceChildren(); });
|
||||
band.querySelectorAll('.annot-chip').forEach(function (chip) { chip.classList.remove('is-margin-note'); chip.style.removeProperty('left'); chip.style.removeProperty('top'); });
|
||||
});
|
||||
var surface = document.querySelector('.document-surface');
|
||||
if (!surface || innerWidth <= 1000 || document.body.classList.contains('reader-hide-notes') || matchMedia('print').matches) return;
|
||||
var bounds = surface.getBoundingClientRect(), nextY = [bounds.top + scrollY, bounds.top + scrollY];
|
||||
if (bounds.left < 180 || innerWidth - bounds.right < 180) return;
|
||||
bands.forEach(function (band) {
|
||||
var block = band.closest('.doc-block'); if (!block || !block.getClientRects().length) return;
|
||||
var chips = Array.from(band.querySelectorAll('.annot-chip')).filter(function (c) { return !c.hidden && !c.classList.contains('is-frame-hidden') && (!c.classList.contains('annot-chip-overflow') || band.classList.contains('is-expanded')); });
|
||||
if (!chips.length || chips.length > 4 || !band.querySelector('[data-annot-more][hidden]') && band.querySelector('[data-annot-more]')) return;
|
||||
var rect = block.getBoundingClientRect(), savedY = nextY.slice(), placed = [];
|
||||
block.classList.add('has-margin-notes');
|
||||
chips.forEach(function (chip) {
|
||||
var anchor = findAnchor(block, chip), a = anchor.getBoundingClientRect();
|
||||
var side = nextY[0] <= nextY[1] ? 0 : 1;
|
||||
var y = Math.max(a.top + scrollY - 4, nextY[side]);
|
||||
var left = side === 0 ? bounds.left - rect.left - 180 : bounds.right - rect.left + 30;
|
||||
chip.classList.add('is-margin-note'); chip.style.left = left + 'px'; chip.style.top = (y - scrollY - rect.top) + 'px';
|
||||
nextY[side] = y + chip.offsetHeight + 20;
|
||||
placed.push({ chip:chip, anchor:a, side:side, y:y });
|
||||
});
|
||||
// If dense notes drift too far away from their statement, retain inline notes.
|
||||
if (placed.some(function (p) { return p.y - (p.anchor.top + scrollY) > 140; })) {
|
||||
nextY = savedY; block.classList.remove('has-margin-notes');
|
||||
chips.forEach(function (c) { c.classList.remove('is-margin-note'); c.style.removeProperty('left'); c.style.removeProperty('top'); }); return;
|
||||
}
|
||||
var leaders = block.querySelector(':scope > .annot-leaders');
|
||||
if (!leaders) { leaders = document.createElement('div'); leaders.className = 'annot-leaders'; leaders.setAttribute('aria-hidden','true'); block.prepend(leaders); }
|
||||
placed.forEach(function (p) {
|
||||
var c = p.chip.getBoundingClientRect(), a = p.anchor;
|
||||
var x0 = p.side === 0 ? c.right + 7 : bounds.right + 4, y0 = p.side === 0 ? c.top + 15 : a.top + a.height/2;
|
||||
var x1 = p.side === 0 ? bounds.left - 4 : c.left - 7, y1 = p.side === 0 ? a.top + a.height/2 : c.top + 15;
|
||||
var line = document.createElement('span'); line.className = 'reader-leader';
|
||||
line.style.left = (x0-rect.left)+'px'; line.style.top = (y0-rect.top)+'px';
|
||||
line.style.width = Math.hypot(x1-x0,y1-y0)+'px'; line.style.transform = 'rotate('+Math.atan2(y1-y0,x1-x0)+'rad)'; leaders.appendChild(line);
|
||||
});
|
||||
});
|
||||
}
|
||||
function refreshAnnotations() {
|
||||
if (pending) return; pending = true;
|
||||
requestAnimationFrame(function () { pending = false; layoutAnnotations(); });
|
||||
}
|
||||
function applyExecution(data) {
|
||||
if (!data.ok) return;
|
||||
var token = window.MARQDO_VIEW_PAGE_TOKEN || '';
|
||||
if (token && data.page_token && token !== data.page_token) { toast('文档已修改,请重新加载以查看新执行信息。'); return; }
|
||||
var trace = document.getElementById('mq-view-trace');
|
||||
if (trace && data.trace_json) trace.textContent = data.trace_json;
|
||||
var structure = document.getElementById('structure');
|
||||
var choices = [];
|
||||
if (structure && data.structure_html) {
|
||||
structure.querySelectorAll('.call-picker,.loop-picker').forEach(function (el, i) { choices.push({index:i,value:el.value}); });
|
||||
structure.innerHTML = data.structure_html;
|
||||
if (window.marqdoInitDocument) window.marqdoInitDocument();
|
||||
var pickers = structure.querySelectorAll('.call-picker,.loop-picker');
|
||||
choices.forEach(function (choice) {
|
||||
var el=pickers[choice.index]; if(el && Array.from(el.options).some(function(o){return o.value===choice.value;})) {el.value=choice.value;el.dispatchEvent(new Event('change',{bubbles:true}));}
|
||||
});
|
||||
if (window.renderMathInElement) window.renderMathInElement(structure, {delimiters:[{left:'$$',right:'$$',display:true},{left:'\\(',right:'\\)',display:false}]});
|
||||
}
|
||||
var vars = document.getElementById('vars-panel'); if (vars && typeof data.bindings_html === 'string') vars.innerHTML = data.bindings_html;
|
||||
refreshAnnotations();
|
||||
}
|
||||
window.MarqdoReader = { refreshAnnotations: refreshAnnotations, applyExecution: applyExecution };
|
||||
function init() {
|
||||
dialog = document.getElementById('reader-dialog'); content = document.getElementById('reader-dialog-content');
|
||||
dialog.addEventListener('close', function () { restorePanels(); refreshAnnotations(); });
|
||||
document.addEventListener('click', function (ev) {
|
||||
var button = ev.target.closest('[data-reader-action]'); if (button) action(button.dataset.readerAction);
|
||||
var chip = ev.target.closest('.annot-chip');
|
||||
if (chip) { openDialog(chip.querySelector('.annot-label').textContent, 'annotation'); var pre = document.createElement('pre'); pre.textContent = chip.title || chip.textContent; content.appendChild(pre); }
|
||||
if (ev.target.closest('.reader-brand')) { ev.preventDefault(); window.scrollTo({top:0,behavior:'auto'}); }
|
||||
if (dialog.open && ev.target.closest('.outline-panel a')) { dialog.close(); }
|
||||
});
|
||||
function focusNote(ev, focus) {
|
||||
var chip = ev.target.closest('.annot-chip'); if (!chip) return;
|
||||
var block = chip.closest('.doc-block'); if (!block) return;
|
||||
findAnchor(block,chip).classList.toggle('is-focus', focus); chip.classList.toggle('is-focus',focus);
|
||||
}
|
||||
document.addEventListener('pointerover',function(e){focusNote(e,true);});
|
||||
document.addEventListener('pointerout',function(e){focusNote(e,false);});
|
||||
document.addEventListener('focusin',function(e){focusNote(e,true);});
|
||||
document.addEventListener('focusout',function(e){focusNote(e,false);});
|
||||
document.addEventListener('keydown',function(e){
|
||||
if(e.key==='Escape'){ var inspector=document.getElementById('var-dialog'); if(inspector && inspector.open) return; if(dialog.open){e.preventDefault();dialog.close();} document.getElementById('nav-toggle').checked=false; document.querySelector('.reader-menu').setAttribute('aria-expanded','false'); }
|
||||
if((e.ctrlKey||e.metaKey)&&e.key==='k'){ e.preventDefault(); showSearch(); }
|
||||
});
|
||||
document.addEventListener('change',refreshAnnotations);
|
||||
var path = window.MARQDO_FILE_PATH || '';
|
||||
if (/(^|\/)(00[-_])?(welcome|欢迎)/i.test(path)) {
|
||||
document.body.classList.add('reader-welcome');
|
||||
var hero = document.createElement('section'); hero.className = 'reader-hero'; hero.setAttribute('aria-label','Welcome to Marqdo');
|
||||
hero.innerHTML = '<p class="eyebrow">WELCOME TO</p><h1>Marqdo</h1><p class="reader-motto">代码即文档 · 文档即知识库 · 知识即可执行</p>';
|
||||
document.querySelector('main.panel').prepend(hero);
|
||||
}
|
||||
// Observe replacement after live runs, not our own leader/position writes.
|
||||
var surface = document.getElementById('structure');
|
||||
if (surface) {
|
||||
new MutationObserver(function (changes) {
|
||||
if (changes.some(function(m){ return Array.from(m.addedNodes).concat(Array.from(m.removedNodes)).some(function(n){return n.nodeType===1 && !n.matches('.reader-leader,.annot-leaders');}); })) refreshAnnotations();
|
||||
}).observe(surface,{childList:true,subtree:true});
|
||||
if (typeof ResizeObserver !== 'undefined') new ResizeObserver(refreshAnnotations).observe(surface);
|
||||
}
|
||||
window.addEventListener('resize',refreshAnnotations);
|
||||
window.addEventListener('beforeprint',layoutAnnotations); window.addEventListener('afterprint',refreshAnnotations);
|
||||
if(document.fonts) document.fonts.ready.then(refreshAnnotations);
|
||||
refreshAnnotations();
|
||||
}
|
||||
if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',init); else init();
|
||||
})();
|
||||
@@ -0,0 +1,56 @@
|
||||
// Run against a `marqdo view output` page or a live view URL.
|
||||
// MARQDO_PLAYWRIGHT_MODULE may point to an existing playwright-core installation.
|
||||
const assert = require('node:assert/strict');
|
||||
const { chromium } = require(process.env.MARQDO_PLAYWRIGHT_MODULE || 'playwright');
|
||||
(async () => {
|
||||
const browser = await chromium.launch({headless:true, executablePath:process.env.MARQDO_CHROMIUM || undefined, args:['--no-sandbox']});
|
||||
const page = await browser.newPage({viewport:{width:1440,height:1000}});
|
||||
const errors = []; page.on('pageerror',e=>errors.push(e.message));
|
||||
// Offline assets must work even when every CDN is unavailable.
|
||||
await page.route('https://**/*',route=>route.abort());
|
||||
await page.goto(process.argv[2]); await page.waitForTimeout(400);
|
||||
assert.equal(await page.locator('#structure').count(),1,'unique content target');
|
||||
for (const width of [1440,1100,1024,1000,800,390]) {
|
||||
await page.setViewportSize({width,height:1000}); await page.waitForTimeout(100);
|
||||
assert(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+1),'horizontal overflow at '+width);
|
||||
const notes=await page.locator('.is-margin-note').count();
|
||||
if(width>1000) assert(notes>0,'wide view should have margin notes');
|
||||
else assert.equal(notes,0,'compact view should use inline notes');
|
||||
const rects=await page.locator('.is-margin-note').evaluateAll(nodes=>nodes.map(n=>{const r=n.getBoundingClientRect();return {left:r.left,right:r.right,top:r.top,bottom:r.bottom};}));
|
||||
rects.forEach(r=>assert(r.left>=0&&r.right<=width,'offscreen note'));
|
||||
for(let i=0;i<rects.length;i++) for(let j=i+1;j<rects.length;j++) {
|
||||
const a=rects[i],b=rects[j]; assert(!(a.left<b.right&&b.left<a.right&&a.top<b.bottom&&b.top<a.bottom),'overlapping notes');
|
||||
}
|
||||
}
|
||||
await page.setViewportSize({width:1440,height:1000});
|
||||
await page.locator('[data-reader-action="functions"]').click();
|
||||
assert(await page.locator('#reader-dialog #fn-outline').count());
|
||||
await page.keyboard.press('Escape'); await page.locator('#outline-rail #fn-outline').waitFor({state:'attached'}); assert(await page.locator('#outline-rail #fn-outline').count(),'restore real function panel');
|
||||
await page.locator('[data-reader-action="variables"]').click();
|
||||
assert(await page.locator('#reader-dialog #vars-panel').count());
|
||||
await page.keyboard.press('Escape'); await page.locator('#outline-rail #vars-panel').waitFor({state:'attached'}); assert(await page.locator('#outline-rail #vars-panel').count());
|
||||
await page.locator('[data-reader-action="search"]').click();
|
||||
await page.locator('#reader-dialog input').fill('main'); assert(await page.locator('#reader-dialog .reader-option').count());
|
||||
await page.keyboard.press('Escape');
|
||||
const visibleChip=page.locator('.annot-chip:visible').first(); await visibleChip.click(); assert(await page.locator('#reader-dialog pre').isVisible()); await page.keyboard.press('Escape');
|
||||
for (const picker of await page.locator('.call-picker,.loop-picker').all()) {
|
||||
const opts=await picker.locator('option').count(); if(opts>1) {await picker.selectOption({index:0});await picker.selectOption({index:opts-1});}
|
||||
}
|
||||
await page.locator('[data-reader-action="settings"]').click();
|
||||
await page.getByRole('button',{name:'切换标准 / 大号正文'}).click(); await page.keyboard.press('Escape');
|
||||
await page.locator('[data-reader-action="memory"]').click(); assert((await page.locator('#reader-dialog pre').textContent()).includes('events')); await page.keyboard.press('Escape');
|
||||
const live=await page.evaluate(()=>!!window.MARQDO_VIEW_LIVE);
|
||||
if(live){
|
||||
const response=page.waitForResponse(r=>r.url().endsWith('/api/session/run_document'));
|
||||
await page.locator('[data-reader-action="run"]').click(); const result=await (await response).json();
|
||||
assert(result.ok&&result.structure_html&&result.trace_json,'live run must return matching annotations');
|
||||
await page.waitForTimeout(200); assert(await page.locator('.is-margin-note').count()>0,'annotations survive rerun');
|
||||
} else {
|
||||
await page.locator('[data-reader-action="run"]').click(); assert((await page.locator('.reader-toast').textContent()).includes('静态页面'));
|
||||
}
|
||||
assert.deepEqual(errors,[],'browser JavaScript errors');
|
||||
const out=process.env.MARQDO_SCREENSHOT_DIR;
|
||||
if(out){await page.screenshot({path:out+'/desktop.png'});await page.setViewportSize({width:390,height:844});await page.waitForTimeout(100);await page.screenshot({path:out+'/mobile.png'});}
|
||||
console.log(JSON.stringify({ok:true,live,sizes:6,errors,formulaCount:await page.locator('.katex').count()}));
|
||||
await browser.close();
|
||||
})().catch(e=>{console.error(e);process.exit(1);});
|
||||
Reference in new issue
Block a user