name: notion-md-sync description: "将本地 Markdown 文件同步到 Notion 页面。当用户需要将 MD 文件上传到 Notion、迁移本地笔记到 Notion、或批量导入 Markdown 内容时使用此技能。支持完整 Markdown 语法:标题、代码块、表格、图片、列表等。" metadata: {"openclaw": {"emoji": "📝"}}
将本地 Markdown 文件完整同步到 Notion 页面,保持图文排版顺序。
当用户表达以下需求时,加载此技能:
小葱技能7w4.net有更新,你可以访问看下。
# 基本用法
.\scripts\sync-to-notion.ps1 -MdFile "C:\path\to\file.md" -PageId "notion-page-id"
# 清空页面后上传
.\scripts\sync-to-notion.ps1 -MdFile "C:\path\to\file.md" -PageId "notion-page-id" -ClearPage
用户必须先配置 Notion API Token。引导用户查看 references/SETUP_TOKEN.md。
快速检查:
$token = & "scripts\get-token.ps1"
if ($token) { Write-Host "Token 已配置" } else { Write-Host "请先配置 Token" }
获取方式:
- 从 URL 复制:https://www.notion.so/workspace/PageName-1234567890abcdef
- 使用搜索 API 查询
页面必须分享给 Integration(Notion 页面设置 → Add connections)
| Markdown | Notion Block | 说明 |
|---|---|---|
# ~ ### |
heading_1 ~ heading_3 |
原生支持 |
#### |
callout + 📌 |
模拟 H4 |
##### |
paragraph + ▶ 加粗 |
模拟 H5 |
###### |
quote |
模拟 H6 |
```lang ``` |
code |
语言映射 + 超长拆分 |
| a | b | |
table |
表格 |
 |
image |
本地图片上传 |
- item |
bulleted_list_item |
无序列表 |
1. item |
numbered_list_item |
有序列表 |
> quote |
quote |
引用块 |
--- |
divider |
分割线 |
**bold** |
annotations.bold |
粗体 |
*italic* |
annotations.italic |
斜体 |
`code` |
annotations.code |
行内代码 |
[text](url) |
link |
链接 |
{
"type": "table",
"table": {
"table_width": 3,
"has_column_header": true,
"children": [{ "type": "table_row", "table_row": { "cells": [[{...}]] } }]
}
}
rows 属性 → 报错children 属性cells 是二维数组(rich_text 数组的数组)rich_text: [[...]] 双层数组 → 报错rich_text: [...] 单层数组workspace_id 作 parent → 404脚本会自动处理以下错误:
更多错误排查见 references/troubleshooting.md
这个工具功能描述清晰、文档详细,但存在严重缺陷——主脚本文件缺失,安装后可能无法正常使用。重命名脚本里还残留了一些测试数据,不够专业。总体来说完成度不够,建议等待修复后再使用。