From 69d6fe44b3861d541628af6c6eb37d742e24986e Mon Sep 17 00:00:00 2001 From: lekt8 Date: Wed, 3 Jun 2026 02:42:01 +0800 Subject: [PATCH] Wrap the README banner in a code fence so it renders as typed (#1403) The decorative banner under the title wasn't in a fenced code block, so GitHub's markdown collapsed its leading whitespace and joined the box-drawing rules, rendering the ASCII art misaligned instead of monospace-as-typed (issue #1390). Fence it; the H1 title stays a real heading. Co-authored-by: Claude Opus 4.8 (1M context) --- README.md | 3 +++ tests/test_readme_ascii_fenced.py | 34 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/test_readme_ascii_fenced.py diff --git a/README.md b/README.md index 2fe4446..135c19d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # Odysseus + +``` ─────────────────────────────────────────────── ⊹ ࣪ ˖ ૮( ˶ᵔ ᵕ ᵔ˶ )っ Odysseus vers. 1.0 ─────────────────────────────────────────────── +``` ![Odysseus](docs/odysseus.jpg) diff --git a/tests/test_readme_ascii_fenced.py b/tests/test_readme_ascii_fenced.py new file mode 100644 index 0000000..d202b6e --- /dev/null +++ b/tests/test_readme_ascii_fenced.py @@ -0,0 +1,34 @@ +"""Regression guard for issue #1390 — the README banner / ASCII art was not in a +fenced code block, so GitHub's markdown collapsed its leading whitespace and the +box-drawing rules, rendering it misaligned instead of monospace-as-typed. + +This pins that the decorative banner stays inside a ``` code fence. +""" +from pathlib import Path + +README = Path(__file__).resolve().parent.parent / "README.md" + +# Distinctive bits of the banner (box-drawing rule + the kaomoji version line). +_RULE = "─" * 10 +_BANNER_LINE = "Odysseus vers. 1.0" + + +def _fenced_segments(text: str): + """Return the segments of *text* that sit INSIDE ``` fences.""" + parts = text.split("```") + # parts[0] is before the first fence, parts[1] is inside the first fence, ... + return parts[1::2] + + +def test_readme_banner_is_inside_a_code_fence(): + text = README.read_text(encoding="utf-8") + assert _BANNER_LINE in text, "banner line missing from README" + inside = "\n".join(_fenced_segments(text)) + assert _BANNER_LINE in inside, "banner version line must be inside a ``` code fence" + assert _RULE in inside, "banner rule line must be inside a ``` code fence" + + +def test_readme_title_stays_a_heading(): + # The H1 must remain a real heading, not get swallowed into the fence. + first = README.read_text(encoding="utf-8").splitlines()[0] + assert first.strip() == "# Odysseus"