← 返回 Skills 市场
Lakebook To Md
作者
Luhui WANG
· GitHub ↗
· v1.1.0
· MIT-0
116
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install lakebook-to-md
功能描述
将语雀导出的 .lakebook 文件转换为 Markdown + Excel 文件夹。支持 lake 富文本、laketable 数据库表格(同时输出 Excel)、lakesheet 电子表格、书签卡片、本地附件下载、代码块、加密内容占位等。自动生成详细的转换报告。
使用说明 (SKILL.md)
语雀 Lakebook 转 Markdown + Excel 工具
概述
将语雀导出的 .lakebook 文件转换为有组织的文件夹,保留原始文档目录树结构。
核心特性:
- 📝 富文本文档 → Markdown
- 📊 数据库表格 → 同时输出 Markdown 和 Excel (.xlsx)
- 📎 附件自动下载并记录状态
- 📋 自动生成详细的转换报告
本工具基于 PZh101/YuqueExportToMarkdown 项目,在其基础上扩展修复了多项问题,增加了更多格式支持。
依赖(自动安装):
beautifulsoup4— HTML/ASL 解析PyYAML— 元数据解析Requests— 图片/附件下载openpyxl— Excel 文件生成
支持的文档格式
| 语雀格式 | 类型 | 说明 | 输出 |
|---|---|---|---|
lake |
Doc | 富文本文档 | Markdown (.md) |
laketable |
Table | 数据库式表格 | Markdown + Excel (.xlsx) |
lakesheet |
Sheet | 电子表格(zlib 压缩) | Markdown 表格 |
支持的卡片类型
| 卡片 | 输出 | 备注 |
|---|---|---|
codeblock |
带语言标注的代码块 | |
image |
下载图片,![]() 语法 |
自动下载并记录状态 |
hr |
--- 分割线 |
|
label |
标签文本 | |
math |
LaTeX 公式 + 图片 | |
file |
文件附件链接 | |
bookmarkInline |
> **[标题](URL)** — 来源 |
|
bookmarklink |
[标题](URL) |
|
localdoc |
附件下载 + 链接 | 自动下载,记录成功/失败状态 |
lockedtext |
占位符:[加密内容 - ...] |
|
yuque |
跨文档链接 |
转换报告
每次转换会自动生成 转换报告.md,包含:
- 总体统计 - 文档数量、类型分布
- 成功转换的文档 - 列出所有成功转换的文件
- 转换失败的文档 - 列出失败原因
- 图片下载统计 - 成功/失败的图片
- 附件下载统计 - 成功/失败的附件
- 过期链接 - 无法下载的资源
- 加密内容 - 无法解密的内容
- 需要手动处理的内容 - 汇总需要人工介入的项目
使用方法
基本转换
cd scripts
python startup.py -l /path/to/your.lakebook -o /path/to/output_folder
可选参数
# 禁用图片下载(更快)
python startup.py -l your.lakebook -o output -d False
# 跳过已下载的资源
python startup.py -l your.lakebook -o output --skip-existing-resources
# 直接使用已解压的 meta.json(高级用法)
python startup.py -i /path/to/extracted/\$meta.json -o output
作为 Python 模块调用
import sys
sys.path.insert(0, "/path/to/lakebook-to-md/scripts")
from lake.lake_setup import start_convert
start_convert(
meta=None,
lake_book="/path/to/your.lakebook",
output="/path/to/output",
download_image_of_in=True,
skip_existing=False
)
输出结构
output_folder/
├── 转换报告.md # 转换统计报告
├── 笔记本名称/
│ ├── 文档1.md
│ ├── 文档1.xlsx # laketable 同时生成 Excel
│ ├── 文档1.assert/ # 图片/附件目录
│ │ ├── image1.png
│ │ └── attachment.pdf
│ └── 子目录/
│ └── 文档2.md
关键实现说明
路径处理
- 文档标题可能包含
/(如2022/11/21 会议记录),会被替换为_以避免路径嵌套问题 - Windows 路径分隔符通过
os.path.join和os.path.sep进行标准化
laketable 转 Excel
- 自动解析 select/multi_select 类型的选项值(ID → 显示文本)
- 数字类型列自动转换为数值格式
- 日期类型列提取可读文本
- 自动调整列宽
lakesheet 解码
lakesheet格式使用 zlib 压缩存储在body_draft字段中sheet字段编码为 latin-1 字符串,需要encode('latin-1')→zlib.decompress()→ JSON 解析
公式单元格
lakesheet中{'class': 'formula', 'value': ...}类型的单元格使用计算后的value渲染,而非原始 JSON
加密内容
lockedtext卡片使用 AES-256-GCM 客户端加密,密钥不在 lakebook 导出中- 这些内容会渲染为占位符。如需访问,请在语雀 App 中解锁后重新导出
附件下载
localdoc卡片包含 OSS 签名下载链接,可能过期- 自动下载附件到
.assert目录 - 下载状态记录在转换报告中
限制
- 加密的
lockedtext内容无法解密(密钥不在导出中) lakesheet合并表头在 Markdown 中会拆分显示(Markdown 不支持单元格合并)- OSS 附件下载链接有过期时间,建议尽快转换
- 不支持语雀内部跨知识库引用
- 幻灯片文档暂不支持转换为 PPT 格式
安全使用建议
This skill appears to do what it says (convert .lakebook → Markdown/Excel and download attachments), but take precautions before running: 1) Only run on .lakebook files from trusted sources — the code uses tarfile.extractall() without sanitizing archive paths, so a malicious archive could overwrite files outside the output folder. 2) Run the conversion in an isolated environment (container/VM) or with limited filesystem permissions to limit potential damage. 3) Be aware startup.py will automatically pip install dependencies (network fetch from PyPI) — if you prefer control, install dependencies yourself before running. 4) Downloaded attachments are fetched from URLs embedded in the archive; these external requests can reveal your IP and be logged by third parties. 5) If you care about the extraction vulnerability, inspect/modify lake_reader.unpack_lake_book_file to safely validate TarInfo names (or use a known-safe extraction helper) before running. If you want, I can point to a safe tar extraction snippet or help produce a patched version of unpack_lake_book_file that rejects absolute paths and path traversal entries.
功能分析
Type: OpenClaw Skill
Name: lakebook-to-md
Version: 1.1.0
The skill bundle contains high-risk execution patterns, specifically an automatic dependency installer in `scripts/startup.py` that invokes `pip install` via `subprocess`. Additionally, `scripts/lake/lake_reader.py` uses `tarfile.extractall()` without path validation, which is a known vulnerability for path traversal attacks. While these behaviors are consistent with the tool's stated purpose of converting Yuque exports and downloading associated resources via `requests`, they introduce significant security risks and potential for arbitrary file writes if provided with a malicious .lakebook file.
能力评估
Purpose & Capability
The name/description (convert .lakebook → Markdown + Excel, download attachments, produce report) match the files and runtime instructions. Declared dependencies and included code implement the stated features; no unexplained credentials or unrelated binaries are requested.
Instruction Scope
Runtime instructions tell the agent to run startup.py which will unpack the provided .lakebook, parse its JSON, download resources, and write files. The code downloads arbitrary URLs found in the archive using requests.get (expected for attachments) and writes to disk. Critically, unpack_lake_book_file uses tarfile.extractall() without path sanitization, allowing a crafted .lakebook to write files outside the intended output directory (path-traversal). startup.ensure_deps will also run pip install at runtime via subprocess, which is network I/O not obvious to non-technical users.
Install Mechanism
No formal install spec is provided, but scripts/startup.py auto-installs Python dependencies by calling pip (subprocess.check_call with requirements.txt). This fetches packages from PyPI at runtime; while packages are common and expected, automatic network installs increase risk and side-effects compared with explicit, user-run installation.
Credentials
The skill requests no environment variables or credentials (good). It does require filesystem write/read access to the provided .lakebook and output folder (expected). Be aware that downloaded resources will make outbound network requests to URLs embedded in the archive (IP exposure, logging by remote hosts).
Persistence & Privilege
The skill is not always-enabled and does not request elevated or persistent platform privileges. It does not attempt to modify other skills or global agent configuration. Its runtime behavior is limited to the process that the user invokes (or the agent invoking it).
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install lakebook-to-md - 安装完成后,直接呼叫该 Skill 的名称或使用
/lakebook-to-md触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
**重大更新:支持 laketable 同时导出为 Excel,并自动生成转换报告。**
- laketable(数据库表格)文档支持导出为 Markdown 和 Excel (.xlsx) 文件
- 自动生成详细的转换报告,统计转换成功/失败、图片和附件下载情况等
- 附件和图片自动下载,下载状态记录至报告
- 新增 openpyxl 依赖(用于生成 Excel 文件)
- 文档格式支持和使用说明文档显著更新
v1.0.0
lakebook-to-md 1.0.0 初始版本发布:
- 实现将语雀 .lakebook 文件完整转换为有组织的 Markdown 文件夹,支持富文本、数据库表格、电子表格等常用格式。
- 完整支持 lake 富文本、laketable 数据库表格和 lakesheet 电子表格内容解析及转换。
- 支持多种卡片类型:代码块、图片、本地附件、URL 书签卡片、公式、加密内容占位等多种特殊元素。
- 支持本地附件与图片自动下载,提供跳过已下载资源优化选项。
- 兼容 Windows 路径分隔符与特殊字符处理,防止路径嵌套问题。
- 详细文档与多样化用法示例,包括命令行和 Python API 调用方式。
元数据
常见问题
Lakebook To Md 是什么?
将语雀导出的 .lakebook 文件转换为 Markdown + Excel 文件夹。支持 lake 富文本、laketable 数据库表格(同时输出 Excel)、lakesheet 电子表格、书签卡片、本地附件下载、代码块、加密内容占位等。自动生成详细的转换报告。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 116 次。
如何安装 Lakebook To Md?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install lakebook-to-md」即可一键安装,无需额外配置。
Lakebook To Md 是免费的吗?
是的,Lakebook To Md 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Lakebook To Md 支持哪些平台?
Lakebook To Md 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Lakebook To Md?
由 Luhui WANG(@luhuiwang)开发并维护,当前版本 v1.1.0。
推荐 Skills