ARS-docs/scripts/parse-label.py
shenjack 67a75d6bdf 添加一波模块 (#7)
后面加一下每一个的信息
开一堆issue
@cree
我谢谢你啊

Co-authored-by: creepebucket <3327018890@qq.com>
Reviewed-on: #7
2023-12-14 10:09:40 +08:00

29 lines
585 B
Python

from pathlib import Path
from pprint import pprint
import mistune
ast_markdown = mistune.create_markdown(renderer='ast')
def read_files(module_path: Path):
with open(module_path, 'r', encoding='utf-8') as f:
file = f.read()
parsed = ast_markdown(file)
return parsed
if __name__ == '__main__':
module_path = Path('modules')
# walk through the modules
# for every markdown file
# parse the label
for md_file in module_path.rglob('*.md'):
print(md_file)
parsed = read_files(md_file)
pprint(parsed)