Repository navigation
feat: markdown math, mermaid and long images, domain lookup, local AI writing assistant - #430
Merged
Merged
Conversation
scripts/release.sh ran the full cargo xtask check before tagging. Most of that time went to the online plugins in market/, which the app neither depends on nor bundles: they are built and published by plugins.yml and checked by PR CI. The commit being released has usually passed CI on every platform already when it was merged. - skip local checks when ci.yml passed on HEAD in the remote's repository (shown in the plan, so a dry run tells which path will be taken) - otherwise run the new cargo xtask check app: rules, rustfmt, clippy and tests for every crate outside market/, and the frontend checks without the online plugin UIs - keep the old behaviour behind --full-checks
device-mockup, festival-avatar, id-photo-maker, avro-inspector and native-deps-inspector read the picked file through the host but did not declare fs:user-selected, so the host refused every read and the tools only ever reported that the file could not be read. Saving was broken as well: the mockup, avatar and ID photo tools used an <a download> link, which the desktop WebView ignores. They now ask for a path with the save dialog; the ID photo PNG is written by a new UI-only save function because the host only writes text from the UI.
The host grants file and network access only from the manifest, so a backend that reads files or sends requests without declaring fs:user-selected or network fails on every call. Five plugins shipped that way unnoticed. cargo xtask check rules now scans each online plugin's backend sources (tests excluded) for the guest file and network APIs and reports the missing permission against its manifest.
A button next to the logo in the title bar, or Cmd/Ctrl+\, collapses the left sidebar to give tools the full window width and brings it back. The choice is saved with the other preferences. Cmd/Ctrl+B is left alone because editor plugins use it for bold. The sidebar narrows with a width transition while its content keeps a fixed width, so nothing reflows during the animation, and the hidden sidebar is inert so it cannot take keyboard focus.
Removing many online plugins meant opening each card's menu one by one. Tools installed from the online market now have a checkbox on the all tools tab; a sticky bar shows the selection, can select every removable tool in the current filter, and uninstalls the selection after a confirmation listing them. Built-in tools cannot be uninstalled and get no checkbox. Tools are removed one after another, a failure does not stop the rest, and a summary toast reports how many were removed. The interaction and wording match the bulk actions on the online tab.
Plugins use 18 accent values, but only six had a tile color, so 47 tools such as amber, red or teal ones all fell back to the same green tile. Add tile colors for every accent, and deepen orange, cyan and the new yellow so a white glyph keeps at least 3:1 contrast at the gradient midpoint. cargo xtask check rules now rejects an accent without a tile color, a test keeps the xtask list, accentTiles and tokens.css in step, and the plugin guide lists the allowed values.
74 plugin icons were 64x64 drawings with their own colored square, most of them the same placeholder circle. In the app they sat as a second tile inside the accent tile, and on the website, which uses icons as a mask, they rendered as a solid block. Redraw each one as a 24x24 currentColor line icon that depicts its tool, matching the rest of the catalog, and bump the published plugins whose icon changed. cargo xtask check rules now rejects icons that are not 24x24, do not stroke with currentColor or hard-code colors, and the plugin guide states the requirement.
$...$ and $$...$$ formulas showed up as plain text. The backend now enables math parsing and converts each formula to MathML with pulldown-latex, so the preview and exported HTML typeset it natively without scripts, fonts or a network connection. Invalid LaTeX is marked in red inside the formula instead of failing the render, and the status bar counts formulas. pulldown-latex writes formula text, error context and the source annotation unescaped, so <, > and " are swapped for private-use placeholders before conversion and written back as entities afterwards; output with any element outside the MathML set falls back to escaped code. Tests cover the injection cases found while probing the library. Refs devlive-community#132
Mermaid blocks were shown as code. The backend now renders them to SVG with mermaid-rs-renderer in Rust, so flowcharts, sequence, class, state, ER, pie and Gantt diagrams appear in the preview and in exported HTML without mermaid.js or a network connection. A diagram that fails to parse shows the error above its source instead of breaking the page. The SVG is embedded as a data URI image: an SVG image cannot run scripts or load external resources, so labels and style directives stay inert whether or not the renderer escapes them. Text is measured with character widths because the sandbox has no system fonts, diagrams over 64 KB are refused, and diagrams sit on a white card in dark mode. Refs devlive-community#158
Plugins could only put text on the clipboard. host.clipboard.writeImage takes PNG bytes and sends them to a new clipboard_write_png command as the raw request body, since a multi-megabyte image passed as a JSON number array spends seconds in serialization. The host decodes the PNG and writes it with the clipboard plugin; broken data reports a translatable error. The SDK is shared by the host at runtime, so on older apps the method is undefined and plugins check for it before offering image copy.
Sharing notes in chat apps meant stitching screenshots. Export long image in the More menu turns the document into one PNG whose height follows the content, with adjustable width, margin, 1x to 3x resolution and a light, dark or app-matching theme. It can be saved, or copied to the clipboard on apps that provide image copy. The standalone export is laid out off screen at the chosen width; once images and fonts are ready its height is measured and the same DOM is drawn through an SVG foreignObject. The SVG is loaded from a data URL because WebKit taints the canvas for foreignObject images from blob URLs, which was confirmed in WKWebView. The scale drops automatically when the canvas would exceed browser limits, and a document too tall even at 1x gets a clear message. The backend checks the PNG signature before writing the file. Refs devlive-community#102
An HTTP/1 response with neither Content-Length nor Transfer-Encoding ends when the server closes the connection. Some servers, such as Verisign's RDAP service for its 404 answers, close TLS without sending close_notify, so rustls reported UnexpectedEof and plugins saw a network error instead of the status. curl and browsers treat this as the end of the body; responses with a length or chunked encoding still fail when cut short.
Find the registry from the IANA bootstrap file, cached by ETag, and follow the registrar's RDAP link for contacts. Show the registrar, key dates, EPP statuses, name servers and DNSSEC, and mark redacted data from RFC 9537 declarations and placeholder text, saying whether the registry or the registrar redacted it. - a 404 means the registry has no such domain; expiry shows unknown or expired, never a negative countdown - TLDs without RDAP, such as .de and .cn, show the IANA record instead, since plugins cannot use WHOIS on port 43 - batches queue per RDAP host with one request in flight, wait for Retry-After or back off with jitter, stop on 403, cache results for six hours and export CSV - lookup is open to the CLI and agents; needs app 0.2.6 for Verisign's not-found answers Refs devlive-community#183
Run Qwen2.5 Instruct (0.5B or 1.5B, Q4_K_M GGUF) with candle on the CPU to polish, proofread, rewrite, shorten, expand, summarize, translate or follow a custom instruction. The models are plugin resources, so their cards are the model manager: download with resume and SHA-256 checks from Hugging Face or its mirrors, switch, and delete. - a byte-level BPE tokenizer built from the GGUF vocabulary and merges, so no tokenizer file or C regex library is needed; markers typed by users stay plain text - generate runs as a cancellable task: chunked prefill, low-temperature sampling, streamed partial text through throttled logs; the model unloads after five idle minutes - other tools can start the generate task; it picks the best downloaded model and answers ai.no_model when there is none Refs devlive-community#205
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明 / Summary
一批独立提交:Markdown 编辑器(公式、Mermaid、长图)、新的在线插件「域名信息查询」、内置插件「AI 写作助手」,以及侧栏、工具市场、插件图标和若干修复。每个提交只做一件事,可以逐个审阅。
A batch of independent commits: the Markdown editor gains math, Mermaid and long-image export; a new online Domain Lookup plugin; a new built-in AI Writing Assistant; plus sidebar, market, icon and fix work. One change per commit, so they can be reviewed one by one.
应用 / App
a5ff41b侧栏可以隐藏与展开(标题栏按钮,⌘/Ctrl+\)/ the sidebar can be hidden and shown againe443892工具市场「全部工具」可多选卸载,确认后依次卸载 / select several tools in All tools and uninstall them at oncea2b3a8b63b482e18 种 accent 都有自己的图标底色;74 个插件图标重绘为 24×24 线性图标,check rules新增plugin-accent与plugin-icon/ every accent gets a tile color; 74 plugin icons redrawn as line icons, with new rules to keep them that wayMarkdown 编辑器 / Markdown editor (0.2.5)
8cd4e29LaTeX 公式渲染为 MathML(行内与块级),输出经白名单过滤 / LaTeX math as MathML, with the output whitelisted22a550dmermaid 代码块渲染为图表(纯 Rust,嵌入为 SVG 图片),出错时显示原文 / mermaid blocks become diagrams rendered in Rust; errors show the sourcebe2e176导出长图:宽度、边距、倍率与主题可调,保存 PNG 或复制图片 / export the document as a long PNG, saved or copied6b92ab97e340beSDK 新增host.clipboard.writeImage(png)(应用 0.2.6 起,插件先判断是否存在),并登记为仅宿主侧改动 / new SDK method for copying PNG images, feature-detected by plugins, listed as host-only域名信息查询 / Domain Lookup (new online plugin) —
8b8b75dlookup开放给命令行与 Agent / TLDs without RDAP show the IANA record; batches queue per server, honor Retry-After and export CSV;lookupis exposed to the CLI and agents39b729a宿主网络修复:Verisign 对不存在域名的 404 不带长度、关闭 TLS 时不发 close_notify,之前被当作网络错误;按 curl 与浏览器的做法视为正常结束。插件因此需要 0.2.6 / host fix: close-delimited bodies ending without TLS close_notify are no longer network errors, so the plugin needs app 0.2.6AI 写作助手 / AI Writing Assistant (new built-in plugin) —
bb3c402generate,为 Markdown 编辑器接入做准备 / runs as a cancellable streaming task, unloads after 5 idle minutes, and other tools can startgenerate其他修复 / Other fixes
5b46fd783ebaa3设备样机、节日头像、证件照等插件补上文件访问权限(截图读取失败),并新增规则要求在线插件声明用到的宿主能力 / declare file access for plugins that read user files (the device mockup failed to read screenshots), and a rule that requires the permission6df7f42发布脚本复用 CI 结果,不再检查在线插件 / release script reuses CI results and leaves online plugins out关联 Issue / Related issues
Closes #132
Closes #158
Closes #102
Closes #183
Refs #205 — 本 PR 提供本地模型与写作助手;Markdown 编辑器的选区 AI 动作(diff 确认、未下载模型时引导)在后续 PR 中完成 / this PR adds the local models and writing assistant; selection actions in the Markdown editor follow in a later PR
改动类型 / Type of change
已测试的平台 / Tested on
macOS(Apple Silicon)
macOS(Intel)
Windows(x64)
Linux(x64)
长图导出在 WKWebView 中验证了深浅主题;公式与 Mermaid 在 WASM 沙箱中验证 / long image verified in WKWebView with both themes; math and Mermaid verified in the WASM sandbox
域名查询在 WASM 沙箱中对线上服务器验证:github.com(含注册商隐去声明)、未注册的 .com(404)、denic.de(IANA 信息)、例子.中国 / domain lookup verified against live RDAP servers
AI 写作助手用真实的 0.5B 模型跑通翻译与纠错(
TF_AI_MODEL=… cargo test -p tfp-ai-writer -- --ignored);测试机负载很高,速度数据不具参考性 / AI assistant verified with the real 0.5B model; the test machine was heavily loaded, so timings are not representative新增的 AI 写作助手与域名查询页面尚未在完整应用中手动点测 / the two new pages have not been clicked through in the full app yet
自查清单 / Checklist
cargo xtask check全部通过 / passes — ran rustfmt, clippy (stable and 1.99) and tests for the changed crates,check rules,plugin versions, web typecheck and eslint; the fullcargo xtask checkwas not run*_test.rs文件中 / Rust tests live in separate*_test.rsfileszh-CN与en-US的键一致;Rust 只返回错误码 / UI text goes through i18n with matching keys; Rust returns error codes only@toolforge/ui组件 / Styles use semantic tokens and@toolforge/uicomponents only截图 / Screenshots
N/A