fix(ses): preserve h1 elements — do not strip first heading

Songs always carries a # Song title line so stripping makes sense there,
but SES body structure is freeform and may use h1 deliberately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 00:00:08 +09:00
parent dfe1f9c631
commit 230a3badc3
3 changed files with 6 additions and 9 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import frontmatter
import mwclient
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent))
from lib.wiki import AUTO_BANNER_PREFIX, connect_wiki, markdown_to_wikitext, strip_first_h1
from lib.wiki import AUTO_BANNER_PREFIX, connect_wiki, markdown_to_wikitext
def validate(fm: dict, path: Path) -> None:
@@ -58,7 +58,7 @@ def publish_one(abs_path: Path, source_dir: Path, post, site: mwclient.Site, sou
title = get_page_title(fm)
page_type = get_page_type(fm, abs_path, source_dir)
body_wikitext = markdown_to_wikitext(strip_first_h1(post.content))
body_wikitext = markdown_to_wikitext(post.content)
source_url = f"{gitea_repo_url}/src/commit/{source_ref}/{rel}"
page_content = build_wikitext(fm, body_wikitext, source_url, source_ref, page_type)