From 3ee37bfa49f3dfdeffb54f10b26942d643aad857 Mon Sep 17 00:00:00 2001 From: jsahn Date: Tue, 1 Sep 2026 14:20:41 +0900 Subject: [PATCH] Give Blogger tables inline borders Blogger themes ship no table styling, so the quote tables rendered as borderless text. Inline styles survive every theme and the mobile view. Co-Authored-By: Claude Fable 5 --- tests/test_blogger.py | 5 ++++- us2kr/deliver/blogger.py | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/test_blogger.py b/tests/test_blogger.py index e6f1cd7..89e52f7 100644 --- a/tests/test_blogger.py +++ b/tests/test_blogger.py @@ -91,7 +91,10 @@ def test_briefing_html_drops_h1_and_renders_tables(): assert "미국 마감 브리핑 — 2026-09-01" not in html # H1 is the post title, not body assert "

총평

" in html assert "하락 마감" in html - assert "" in html and "" in html + # tables carry inline borders - Blogger themes style nothing themselves + assert '
7,686.42
7,686.42" in html and 'border:1px solid #ccc' in html + assert "
" not in html and "
" not in html # every cell got the inline style def test_post_title_with_and_without_headline(): diff --git a/us2kr/deliver/blogger.py b/us2kr/deliver/blogger.py index d1c8272..dfb8934 100644 --- a/us2kr/deliver/blogger.py +++ b/us2kr/deliver/blogger.py @@ -28,6 +28,17 @@ TOKEN_SAFETY_MARGIN_SECONDS = 60.0 _MD = md.Markdown(extensions=["tables"], output_format="html") +# Blogger themes ship no styling, so the numbers render as a borderless jumble. +# Inline styles are the only thing every theme (and the mobile view) reliably honors. +_TABLE_STYLES: tuple[tuple[str, str], ...] = ( + ("
", '
'), + ( + "
", + '', + ), + ("", ''), +) + def briefing_html(markdown_text: str) -> str: """Briefing markdown -> HTML body. The leading H1 is dropped (the post title carries it).""" @@ -35,7 +46,10 @@ def briefing_html(markdown_text: str) -> str: if lines and lines[0].startswith("# "): lines = lines[1:] _MD.reset() # the converter keeps per-document state (e.g. reference links) - return _MD.convert("\n".join(lines).strip()) + html = _MD.convert("\n".join(lines).strip()) + for plain, styled in _TABLE_STYLES: + html = html.replace(plain, styled) + return html def post_title_prefix(result: BriefingResult) -> str: