Save Markdown documents to the Feishu knowledge base, with support for viewing the directory structure, specifying the save location, and reading multi-dimensional table content.
Quick Start
View Directory Structure
python scripts/list_wiki.py
Example output:
📁 草稿箱 (YylJw806IinEJmkwOWVcv8HInph)
📄 文章标题 (R6wxwODL7iCoQyknQsdcJleanFh)
📁 分类文件夹 (ZXigwaUIViNr20k9KOKcEKgVnrg)
📄 子文档 (GdaewKgtEicJcak37QmcgFsMnJc)
Save Document
Save a Markdown file to the default location (Drafts):
python scripts/save_to_wiki.py --file /path/to/document.md
Save to a specified parent node:
python scripts/save_to_wiki.py --file /path/to/document.md --parent TOKEN
Specify the title and content directly:
python scripts/save_to_wiki.py --title "文档标题" --content "文档内容"
Workflow
When the user requests to save a document to Feishu:
-
First view the directory structure
- Run
list_wiki.pyto get the current knowledge base directory - Show the user the available save locations
- Run
-
Determine the save location
- If the user specified a location (e.g., "save under xxx"), use the corresponding token
- If not specified, save to Drafts by default
-
Execute the save
- Run
save_to_wiki.pyto save the document - Return the document link to the user
- Run
Supported Markdown Formats
| Format | Conversion Result |
|---|---|
# 标题 |
Heading 1 |
## 标题 |
Heading 2 |
### 标题 |
Heading 3 |
#### 标题 |
Heading 4 |
| Normal paragraph | Text block |
- 项目 |
Unordered list |
1. 项目 |
Ordered list |
Formats such as bold, italic, and links are converted to plain text.
Knowledge Base Configuration
Currently configured knowledge base:
- Root node: Drafts (
YylJw806IinEJmkwOWVcv8HInph) - Space ID:
7591325128043121630
To modify the configuration, edit the constants in the script.
Common Usage Examples
| User Says | Action |
|---|---|
| "Save to Feishu" | Save the current document to Drafts |
| "Save under the xxx directory in Feishu" | First look up the directory to get the token, then save to the specified location |
| "View the Feishu knowledge base directory" | Run list_wiki.py to display the directory structure |
| "Publish this article to Feishu" | Save the specified document to Feishu |