Skip to content

Commit 6d5736b

Browse files
committed
Update README.md
1 parent 1c23618 commit 6d5736b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
![](./screenshots/gpt.gif)
1616

1717
## What's Next
18-
- 接入notion api,使用notion管理做题进度
18+
- [x] 接入notion api,使用notion管理做题进度
1919

2020
## Install
2121

@@ -100,6 +100,20 @@ $ leetcode-tool new 1
100100
$ leetcode-tool update
101101
# 4. 提交代码
102102
```
103+
### 3. 同步至Notion
104+
`.leetcode.json` 中填写好 `notion_key``database_id``page_id` 后,开启更新。
105+
106+
注意,当第一次使用尚未创建数据库时, database_id 为空,page_id 有值时,会在 page_id 对应的父页面下自动创建数据库。
107+
108+
将终端显示的 `database_id` 填入配置文件后,就更新对应数据库。
109+
```bash
110+
$ leetcode-tool sync --notion
111+
2024/05/05 00:56:43 Create Database: e7086c88f6504623956d1271b70aa2b4, Please add the database_id in the config file
112+
2024/05/05 00:56:43 Visited Link: https://www.notion.so/e7086c88f6504623956d1271b70aa2b4
113+
sync leetcode record to notion, progress: 51/52%
114+
```
115+
116+
![](./screenshots/notion-leetcode-summary.png)
103117

104118
## Support Language 支持语言
105119

@@ -143,6 +157,9 @@ number 为网页上显示的题目序号, 例如: `leetcode-tool new 1` 创建
143157

144158
从 leetcode 网站拉取最新分类, 并创建 `toc` 对应文件, 一般不需要运行.
145159

160+
### 同步 notion
161+
`leetcode-tool sync --notion`
162+
146163
### 重置项目
147164

148165
假如想要重新从零开始, 或者你的项目是基于别人项目 fork 的, 可以使用如下方式清理已有题解:

internal/notion/notion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ func (n *Notion) Init() error {
172172
if n.DatabaseID == "" && n.PageID != "" {
173173
db, err := n.CreateDB()
174174
if err != nil {
175-
return fmt.Errorf("create database failed: %v", err)
175+
return fmt.Errorf("create db failed: %v", err)
176176
}
177177
n.DatabaseID = notionapi.DatabaseID(GetStandardID(db.ID))
178178

179-
log.Printf("Create Database: %d, Please add the database_id in the config file\n", n.DatabaseID)
179+
log.Printf("Create Database: %s, Please add the database_id in the config file\n", n.DatabaseID)
180180
log.Printf("Visited Link: %s", fmt.Sprintf("https://www.notion.so/%s", n.DatabaseID))
181181
}
182182

318 KB
Loading

0 commit comments

Comments
 (0)