@xiongtao.xt/tau-plugins 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/EDITOR.md +1 -1
- package/SERVICES.md +1 -14
- package/package.json +1 -1
- package/types/packages/plugins/src/services.d.ts +0 -7
package/CHANGELOG.md
ADDED
package/EDITOR.md
CHANGED
|
@@ -93,7 +93,7 @@ export default definePlugin({
|
|
|
93
93
|
|
|
94
94
|
## 块会在哪里显示
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
块显示在桌面编辑器和用户发布的博客中,两处直接使用 `elements.render` 中的同一个组件,不需要另写入口。移动端与浏览器扩展不加载插件,遇到插件节点保留原数据并显示通用占位。因此渲染代码要满足:
|
|
97
97
|
|
|
98
98
|
- 模块顶层和渲染组件能在浏览器中运行,不导入 Electron、Node 或 Tau 客户端内部路径。
|
|
99
99
|
- 不依赖 `activate` 中才赋值的变量,也不调用 `context` 的存储、页面、服务等桌面能力。
|
package/SERVICES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 编译与转换服务
|
|
2
2
|
|
|
3
|
-
需要在插件里编译 Tailwind、Typst
|
|
3
|
+
需要在插件里编译 Tailwind、Typst,转换 Markdown,或处理音视频时,可以使用这些服务。通过 `context.services` 调用,类型从 `@tau/plugins` 导入,需要 Tau 0.59.0 或更高版本。TikZ 编译属于独立绘图插件,不再提供宿主服务。
|
|
4
4
|
|
|
5
5
|
所有服务都是异步方法,只处理传入数据并返回结果,不读写笔记、不选择或保存文件、不自动注入样式。
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
| `markdown.deserialize(source, options?)` | Markdown 字符串 | `{ nodes: Descendant[], warnings }` |
|
|
14
14
|
| `markdown.serialize(nodes, options?)` | `Descendant[]` | `{ markdown, warnings }` |
|
|
15
15
|
| `markdown.render(source, options?)` | Markdown 字符串 | `{ html, css, warnings }` |
|
|
16
|
-
| `tikz.compile(input, options?)` | `{ source }`,包含 `tikzpicture` 环境 | `{ svg }` |
|
|
17
16
|
| `ffmpeg.probe(file, options?)` | `{ name, data: Blob }` | `{ format, streams }` |
|
|
18
17
|
| `ffmpeg.run(input, options?)` | `{ files, args, outputs }` | `{ files, log }` |
|
|
19
18
|
|
|
@@ -99,18 +98,6 @@ const result = await context.services.markdown.serialize(nodes, {
|
|
|
99
98
|
|
|
100
99
|
HTML 渲染不自动执行 TikZ、Typst、Mermaid 编译器;相关节点可能显示源码并返回 `DISPLAY_FALLBACK`,音视频可能显示链接。原始 HTML 和远程资源按客户端导出规则保留,输出不是经过净化的 HTML。`css` 是本次生成内容附带的样式,不包含完整 Tau 页面主题,也不打包图片附件。
|
|
101
100
|
|
|
102
|
-
## TikZ
|
|
103
|
-
|
|
104
|
-
```ts
|
|
105
|
-
const { svg } = await context.services.tikz.compile({
|
|
106
|
-
source: String.raw`\begin{tikzpicture}
|
|
107
|
-
\draw (0,0) -- (1,1);
|
|
108
|
-
\end{tikzpicture}`,
|
|
109
|
-
});
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
不要添加 `documentclass` 或 `document` 环境。服务负责包装,返回包含字体样式的 SVG 字符串。这不是完整 LaTeX 文档编译器,不提供任意宏包安装。语法或宏包不支持时明确报错;单次最长 120 秒,可通过 signal 提前取消。
|
|
113
|
-
|
|
114
101
|
## FFmpeg
|
|
115
102
|
|
|
116
103
|
`ServiceFile` 为 `{ name: string, data: Blob }`;文件名仅在任务内使用,不是客户端路径。输入输出名称不得重复,目录使用 `/`。文件整体经内存传输,适合可以放进内存的素材,不支持大文件流式处理。
|
package/package.json
CHANGED
|
@@ -74,13 +74,6 @@ export interface PluginServices {
|
|
|
74
74
|
warnings: ServiceWarning[];
|
|
75
75
|
}>;
|
|
76
76
|
};
|
|
77
|
-
tikz: {
|
|
78
|
-
compile(input: {
|
|
79
|
-
source: string;
|
|
80
|
-
}, options?: ServiceOptions): Promise<{
|
|
81
|
-
svg: string;
|
|
82
|
-
}>;
|
|
83
|
-
};
|
|
84
77
|
ffmpeg: {
|
|
85
78
|
probe(input: ServiceFile, options?: ServiceOptions): Promise<MediaInfo>;
|
|
86
79
|
/** args 中用任务文件名引用输入和输出;不接受 shell 命令。 */
|