Skip to content

Rich tables: header shading, long links, nested tables, cell colours - #220

Merged
markbac merged 1 commit into
mainfrom
claude/hopeful-galileo-qo0735
Nov 5, 2026
Merged

markbac merged 1 commit into
mainfrom
claude/hopeful-galileo-qo0735

Conversation

@markbac

@markbac markbac commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Follow-up to #219 (rich table cells, issue #218).

Fixes

  • Word header rows were white on white.
    • py-doc makes header text bold white but relied on the table style for the dark fill. Its own Table Grid style has none, so with the default or the example templates, header text was unreadable in Word, LibreOffice and Google Docs.
    • Header cells now get the style's header colour (tblStylePr firstRow), or navy, set on the cells themselves.
    • A colour the cell was given itself is kept.
  • Template tables are no longer restyled.
    • The Word finishing formatted every table, the template's too, so the title page's "Document number" table got the body table style and a white-on-white first row.
    • The Markdown's tables are now marked with a hidden bookmark before the merge, and only those, and tables inside them, are formatted.
  • The example templates had pandoc's sample table on their title page. sensor.docx, sensor_Draft.docx and datasheet.docx had pandoc's sample "Table / 1 / 2" table. It's removed, and make_templates.py now strips it.

New

  • Pictures in any table cell are made no wider than their column, nested tables included. Before, this applied only to [[LISTTABLE]].
  • Long links: in a [[LISTTABLE]], a link or picture too long for its column becomes a reference defined after the table, so the grid stays readable.
  • Blocks across includes: a [[BLOCK:]] may be defined in a file the table's file includes, or in the file that includes it. Lint follows includes to check the names.
  • Nested tables:
    • A block may hold a table, pipe or [[LISTTABLE]], and it's formatted like any other.
    • In PDF a table in a cell becomes a tabular, because LaTeX can't nest longtables.
  • Cell colour and vertical alignment: a cell may start with {bg=E8F5E9 valign=middle}.
    • HTML and sites get a style on the cell.
    • PDF gets \cellcolor (colortbl added to the LaTeX templates); vertical alignment isn't used there.
    • Word gets cell shading and vAlign, through a hidden bookmark that listtable.lua writes.
    • A style that isn't understood stays as text, with a warning.
  • Site test: rich tables on MkDocs and Starlight pages keep merges, colours, lists and a picture in a cell.

Docs

  • User guide: writing (rich table cells) and Word outputs (tables).
  • Architecture: pipeline.
  • Requirements: FR-029 updated, FR-050 new, with traceability.
  • Example guide: a coloured cell, a nested table and a long link in its rich table.

Testing

  • python -m pytest: 1994 passed, 14 skipped (pandoc 3.1.3, Graphviz and XeLaTeX on the host).
  • ruff check . and ruff format --check . are clean.
  • py-doc lint docs --strict and the examples lint with Vale 3.24.0: 0 warnings.
  • VS Code extension tests: 18 passed.
  • I viewed the example guide's Word output through LibreOffice and its PDF. Header rows, the coloured middle-aligned cell, the nested table and the shortened link all render correctly.

Still to check by hand in Word

  • Header-row colour, and cell colour and alignment, in Word itself.
  • Whether you want navy (1F3864) as the default header colour when the template's table style has none.

Generated by Claude Code

- Word header rows: py-doc made header text white but relied on the
  table style for the dark fill, which its own Table Grid lacks, so
  headers were white on white. The fill (the style's header colour, or
  navy) is now set on the header cells.
- Only the Markdown's tables are formatted: they are marked before the
  merge, so a template's own tables keep their look. The example
  templates lose pandoc's sample table from their title page.
- A picture in any table cell, nested tables included, is made no
  wider than its column.
- [[LISTTABLE]]: a link or picture too long for its column becomes a
  reference defined after the table; a block may come from an included
  file or the including one; a block may hold a table, which is
  formatted like any other (a tabular in PDF, as LaTeX cannot nest
  longtables); a cell may start with {bg=RRGGBB valign=middle}.
- Tests for these and for rich tables on MkDocs and Starlight sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHtcxeRPPmXcydfxoEHGJ4
@markbac
markbac merged commit a892d79 into main Nov 5, 2026
7 checks passed
@markbac
markbac deleted the claude/hopeful-galileo-qo0735 branch November 5, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants