From 41c373f46cf61292ba71d43507e0055aceb34757 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 12 Nov 2026 13:22:43 -0700 Subject: [PATCH 1/3] fix: readable tables in notes and articles; public pages 48rem wide (v2.18.2) Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 13 +++++++++++++ starpunk/__init__.py | 4 ++-- static/css/style.css | 9 ++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff04c9d..1ae41d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.18.2] - 2026-11-12 + +### Fixed +- Tables in notes and articles: words in cells were split mid-word (a narrow + first column read "Colo/r", "Blac/k") and cells had no padding or left + alignment. Tables now keep words whole and render as a framed card: rounded + border, shaded header row, sans-serif text, bold first column. They size to + their content and scroll sideways on narrow screens. + +### Changed +- Public pages are wider: 48rem instead of 40rem (about 85 characters per + line at the reading font). Admin pages stay at 60rem. + ## [2.18.1] - 2026-11-12 ### Changed diff --git a/starpunk/__init__.py b/starpunk/__init__.py index 07c24fe..ff2c9cb 100644 --- a/starpunk/__init__.py +++ b/starpunk/__init__.py @@ -468,5 +468,5 @@ def create_app(config=None): # Package version (Semantic Versioning 2.0.0) # See docs/standards/versioning-strategy.md for details -__version__ = "2.18.1" -__version_info__ = (2, 18, 1) +__version__ = "2.18.2" +__version_info__ = (2, 18, 2) diff --git a/static/css/style.css b/static/css/style.css index e2be129..0dc3097 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -8,7 +8,7 @@ --font-reading: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, 'Noto Serif', Georgia, serif; --font-mono: ui-monospace, 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace; --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 2rem; --spacing-xl: 4rem; - --max-width: 40rem; --border-radius: 6px; + --max-width: 48rem; --border-radius: 6px; } @media (prefers-color-scheme: dark) { @@ -91,6 +91,13 @@ main { flex: 1; margin-bottom: var(--spacing-xl); } .e-content blockquote { margin: 0 0 var(--spacing-md); padding-left: var(--spacing-md); border-left: 3px solid var(--color-border); color: var(--color-text-light); } .e-content ul, .e-content ol { margin: 0 0 var(--spacing-md) 1.25rem; } .e-content img { max-width: 100%; height: auto; } +/* Tables (v2.18.2): shrink to their content, scroll sideways when wider than + the column, and never split words (the overflow-wrap: anywhere above is for + long URLs in prose; in a cell it squeezed columns to a few letters). */ +.e-content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0; border: 1px solid var(--color-border); border-radius: var(--border-radius); margin: 0 0 var(--spacing-md); font-family: var(--font-body); font-size: 1rem; line-height: 1.55; } +.e-content th, .e-content td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; overflow-wrap: normal; } +.e-content th { font-weight: 600; white-space: nowrap; background: var(--color-bg-alt); } +.e-content td:first-child { font-weight: 600; } .e-content h1, .e-content h2, .e-content h3 { font-family: var(--font-body); } .reaction { margin-bottom: var(--spacing-sm); font-size: 0.9375rem; color: var(--color-text-light); overflow-wrap: anywhere; } .reaction-verb { font-weight: 600; margin-right: 0.25rem; } From bba2178496ec7bd2d26f039a8c16e15a6ad9c106 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 12 Nov 2026 13:24:37 -0700 Subject: [PATCH 2/3] fix: tables fill the column as a card, matching common Markdown viewers (v2.18.2) Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 8 +++++--- starpunk/models.py | 4 +++- static/css/style.css | 14 ++++++++------ tests/test_markdown_ext.py | 9 +++++++++ 4 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 tests/test_markdown_ext.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae41d6..368f7da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Tables in notes and articles: words in cells were split mid-word (a narrow first column read "Colo/r", "Blac/k") and cells had no padding or left - alignment. Tables now keep words whole and render as a framed card: rounded - border, shaded header row, sans-serif text, bold first column. They size to - their content and scroll sideways on narrow screens. + alignment. Tables now keep words whole and render as a card that fills the + column: raised background, rounded border, shaded header row, roomy cells, + sans-serif text at reading size, bold first column. Rendered tables are + wrapped in `
`, which scrolls sideways on narrow + screens. ### Changed - Public pages are wider: 48rem instead of 40rem (about 85 characters per diff --git a/starpunk/models.py b/starpunk/models.py index 7e30374..20df00d 100644 --- a/starpunk/models.py +++ b/starpunk/models.py @@ -62,7 +62,9 @@ ALLOWED_ATTRIBUTES = { def render_markdown(text: str) -> str: """Note Markdown (or HTML) to sanitized HTML""" html = markdown.markdown(text, extensions=MARKDOWN_EXTENSIONS) - return nh3.clean(html, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES) + html = nh3.clean(html, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTRIBUTES) + # A wrapper lets a table fill the column yet scroll sideways when too wide (v2.18.2) + return re.sub(r"", "
") # Likes, reposts and bookmarks (v2.5.0, v2.9.0) diff --git a/static/css/style.css b/static/css/style.css index 0dc3097..bec72d1 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -91,12 +91,14 @@ main { flex: 1; margin-bottom: var(--spacing-xl); } .e-content blockquote { margin: 0 0 var(--spacing-md); padding-left: var(--spacing-md); border-left: 3px solid var(--color-border); color: var(--color-text-light); } .e-content ul, .e-content ol { margin: 0 0 var(--spacing-md) 1.25rem; } .e-content img { max-width: 100%; height: auto; } -/* Tables (v2.18.2): shrink to their content, scroll sideways when wider than - the column, and never split words (the overflow-wrap: anywhere above is for - long URLs in prose; in a cell it squeezed columns to a few letters). */ -.e-content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: separate; border-spacing: 0; border: 1px solid var(--color-border); border-radius: var(--border-radius); margin: 0 0 var(--spacing-md); font-family: var(--font-body); font-size: 1rem; line-height: 1.55; } -.e-content th, .e-content td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; overflow-wrap: normal; } -.e-content th { font-weight: 600; white-space: nowrap; background: var(--color-bg-alt); } +/* Tables (v2.18.2): a card that fills the column, in the page's sans font at + the reading size; scrolls sideways when wider than the column. Words in + cells are never split (overflow-wrap: anywhere above is for long URLs in + prose; in a cell it squeezed columns to a few letters). */ +.e-content .table-wrap { overflow-x: auto; margin: 0 0 var(--spacing-md); background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--border-radius); } +.e-content table { width: 100%; border-collapse: collapse; font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6; } +.e-content th, .e-content td { padding: 0.9rem 1.25rem; text-align: left; vertical-align: top; overflow-wrap: normal; } +.e-content th { font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--color-text) 6%, var(--color-bg-alt)); } .e-content td:first-child { font-weight: 600; } .e-content h1, .e-content h2, .e-content h3 { font-family: var(--font-body); } .reaction { margin-bottom: var(--spacing-sm); font-size: 0.9375rem; color: var(--color-text-light); overflow-wrap: anywhere; } diff --git a/tests/test_markdown_ext.py b/tests/test_markdown_ext.py new file mode 100644 index 0000000..6838b84 --- /dev/null +++ b/tests/test_markdown_ext.py @@ -0,0 +1,9 @@ + + +def test_tables_get_a_scroll_wrapper(): + """v2.18.2: tables are wrapped so they can fill the column and scroll sideways""" + from starpunk.models import render_markdown + + html = render_markdown("| Color | Why |\n|---|---|\n| Black | Removal |\n\nAfter") + assert html.startswith('
') and "
" in html + assert "

After

" in html From 5fb521e89ee15edde3466ea52c502219a3b47570 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 12 Nov 2026 13:28:19 -0700 Subject: [PATCH 3/3] style: header and footer share one 60rem frame on public and admin pages (v2.18.2) Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ static/css/style.css | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 368f7da..e5e4e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Public pages are wider: 48rem instead of 40rem (about 85 characters per line at the reading font). Admin pages stay at 60rem. +- The site header (title, menu, search) and footer are 60rem wide on every + page, so they sit in the same place on public and admin pages; only the + content column differs. ## [2.18.1] - 2026-11-12 diff --git a/static/css/style.css b/static/css/style.css index bec72d1..3d0e572 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -8,7 +8,7 @@ --font-reading: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, 'Noto Serif', Georgia, serif; --font-mono: ui-monospace, 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace; --spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 2rem; --spacing-xl: 4rem; - --max-width: 48rem; --border-radius: 6px; + --max-width: 48rem; --frame-width: 60rem; --border-radius: 6px; } @media (prefers-color-scheme: dark) { @@ -40,6 +40,9 @@ pre code { padding: 0; background: none; } /* Page frame */ .site-header, main, .site-footer { width: 100%; max-width: var(--max-width); margin-left: auto; margin-right: auto; } +/* Header and footer share one width on every page, public and admin (v2.18.2); + only the content column (main) differs: 48rem to read, 60rem for admin tables. */ +.site-header, .site-footer { max-width: var(--frame-width); } main { flex: 1; margin-bottom: var(--spacing-xl); } .site-header {