diff --git a/CHANGELOG.md b/CHANGELOG.md index ff04c9d..e5e4e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ 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 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 + 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 ### 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/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 e2be129..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: 40rem; --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 { @@ -91,6 +94,15 @@ 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): 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; } .reaction-verb { font-weight: 600; margin-right: 0.25rem; } 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