fix: 목차(TOC)를 h2가 3개 이상일 때만 표시
짧은 글에서 '목차' 텍스트만 덩그러니 나오는 문제 수정. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -322,7 +322,9 @@ def build_full_html(article: dict, body_html: str, toc_html: str) -> str:
|
||||
)
|
||||
|
||||
html_parts.append(json_ld)
|
||||
if toc_html:
|
||||
# 목차는 h2가 3개 이상일 때만 표시 (짧은 글에선 불필요)
|
||||
h2_count = body_html.lower().count('<h2')
|
||||
if toc_html and h2_count >= 3:
|
||||
html_parts.append(f'<div class="toc-wrapper">{toc_html}</div>')
|
||||
html_parts.append(body_html)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user