← Back to Skills Marketplace
luhuiwang

Lakebook To Md

by Luhui WANG · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
116
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install lakebook-to-md
Description
将语雀导出的 .lakebook 文件转换为 Markdown + Excel 文件夹。支持 lake 富文本、laketable 数据库表格(同时输出 Excel)、lakesheet 电子表格、书签卡片、本地附件下载、代码块、加密内容占位等。自动生成详细的转换报告。
README (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,包含:

  1. 总体统计 - 文档数量、类型分布
  2. 成功转换的文档 - 列出所有成功转换的文件
  3. 转换失败的文档 - 列出失败原因
  4. 图片下载统计 - 成功/失败的图片
  5. 附件下载统计 - 成功/失败的附件
  6. 过期链接 - 无法下载的资源
  7. 加密内容 - 无法解密的内容
  8. 需要手动处理的内容 - 汇总需要人工介入的项目

使用方法

基本转换

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.joinos.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 格式
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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).
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lakebook-to-md
  3. After installation, invoke the skill by name or use /lakebook-to-md
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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 调用方式。
Metadata
Slug lakebook-to-md
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Lakebook To Md?

将语雀导出的 .lakebook 文件转换为 Markdown + Excel 文件夹。支持 lake 富文本、laketable 数据库表格(同时输出 Excel)、lakesheet 电子表格、书签卡片、本地附件下载、代码块、加密内容占位等。自动生成详细的转换报告。 It is an AI Agent Skill for Claude Code / OpenClaw, with 116 downloads so far.

How do I install Lakebook To Md?

Run "/install lakebook-to-md" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Lakebook To Md free?

Yes, Lakebook To Md is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Lakebook To Md support?

Lakebook To Md is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Lakebook To Md?

It is built and maintained by Luhui WANG (@luhuiwang); the current version is v1.1.0.

💬 Comments