Skip to content

Commit bed22ff

Browse files
committed
feat: add edit url
1 parent d22f741 commit bed22ff

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def get_paths(dirs: str, m: int):
7979
for dir in dirs:
8080
target_dir, m = dirs_mapping[dir]
8181
for p in sorted(get_paths(dir, m)):
82-
print(p)
82+
# example:
83+
# p = 'solution/0000-0099/0003.Longest Substring Without Repeating Characters/README.md'
84+
edit_url = f'https://github.com/doocs/leetcode/edit/main/{p}'
8385
with open(p, "r", encoding="utf-8") as f:
8486
content = f.read()
8587

@@ -162,7 +164,7 @@ def get_paths(dirs: str, m: int):
162164
comments: true
163165
---
164166
"""
165-
content = f"---\ncomments: true\n{tag_headers}---\n\n" + content
167+
content = f"---\ncomments: true\nedit_url: {edit_url}\n{tag_headers}---\n\n" + content
166168
with open(new_path, "w", encoding="utf-8") as f:
167169
f.write(content)
168170

0 commit comments

Comments
 (0)