#!/usr/bin/env python3
"""
在 Markdown 的 H2 标题前插入分隔线，第一个除外
"""

MD_PATH = "/root/openclaw-workspace/projects/yu-zhi-ran/content/published/2026-04-14-上海阳台种菜一年/final-article.md"

with open(MD_PATH, "r", encoding="utf-8") as f:
    lines = f.readlines()

new_lines = []
first_h2_seen = False
for line in lines:
    if line.startswith("## "):
        if first_h2_seen:
            new_lines.append("---\n\n")
        else:
            first_h2_seen = True
    new_lines.append(line)

with open(MD_PATH, "w", encoding="utf-8") as f:
    f.writelines(new_lines)

print(f"✅ 已处理 {MD_PATH}")
