summaryrefslogtreecommitdiff
path: root/hugo-convert-yaml-frontmatter-to-toml/README.md
blob: d2655dfcfe7b31b476052987282cb7d27827c1b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
这个 Python 脚本使用 Kimi K2.5 Instant 生成,提示词如下:

```
我需要你帮我写个 Python 脚本,把我 Hugo 网站的 `content` 目录下所有的 markdown 文件的 frontmatter 改为 TOML 格式。其中有一些是 TOML,有一些是 YAML。以 `---` 开头文件就是 YAML 做 frontmatter 的,只处理这些文件;TOML frontmatter 是 `+++` 开头的
```

## 使用方法

1. 安装依赖 `pip install pyyaml tomli-w`
2. 先预览改动 `python script.py --dry-run` 或者 `uv run script.py --dry-run`
3. 确认后应用修改 `python script.py` 或者 `uv run script.py`