Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PPsteven committed May 4, 2024
1 parent 1c23618 commit 6d5736b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
![](./screenshots/gpt.gif)

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

## Install

Expand Down Expand Up @@ -100,6 +100,20 @@ $ leetcode-tool new 1
$ leetcode-tool update
# 4. 提交代码
```
### 3. 同步至Notion
`.leetcode.json` 中填写好 `notion_key``database_id``page_id` 后,开启更新。

注意,当第一次使用尚未创建数据库时, database_id 为空,page_id 有值时,会在 page_id 对应的父页面下自动创建数据库。

将终端显示的 `database_id` 填入配置文件后,就更新对应数据库。
```bash
$ leetcode-tool sync --notion
2024/05/05 00:56:43 Create Database: e7086c88f6504623956d1271b70aa2b4, Please add the database_id in the config file
2024/05/05 00:56:43 Visited Link: https://www.notion.so/e7086c88f6504623956d1271b70aa2b4
sync leetcode record to notion, progress: 51/52%
```

![](./screenshots/notion-leetcode-summary.png)

## Support Language 支持语言

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

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

### 同步 notion
`leetcode-tool sync --notion`

### 重置项目

假如想要重新从零开始, 或者你的项目是基于别人项目 fork 的, 可以使用如下方式清理已有题解:
Expand Down
4 changes: 2 additions & 2 deletions internal/notion/notion.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ func (n *Notion) Init() error {
if n.DatabaseID == "" && n.PageID != "" {
db, err := n.CreateDB()
if err != nil {
return fmt.Errorf("create database failed: %v", err)
return fmt.Errorf("create db failed: %v", err)
}
n.DatabaseID = notionapi.DatabaseID(GetStandardID(db.ID))

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

Expand Down
Binary file added screenshots/notion-leetcode-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d5736b

Please sign in to comment.