Skip to content

MarkdownToNotebook: tableCell drops column dividers and width fitting for tables with a column count other than 2 or 3 on documentation templates #95

Description

@mbahram

Summary

tableCell (MarkdownToNotebook.wl, line 3743) keys the generic GridBox path entirely on $docTemplate === "Default":

GridBoxDividers -> {"Columns" -> {{$docTemplate === "Default"}}, "Rows" -> {{True}}},
GridBoxSpacings -> {"Columns" -> {{1.5}}, "Rows" -> {{0.8}}},
Sequence @@ If[$docTemplate === "Default",
    {GridBoxItemSize -> {"Columns" -> If[ncol >= 3, ...Scaled...], "Rows" -> {{Automatic}}}},
    {}]

A documentation-taxonomy template (any of $tableModTemplates: Symbol, Guide, TechNote, Overview, Chapter, BookChapter, ComputationalEssay, Essay, Format, ...) uses the *TableMod styles only for 2 and 3 column tables. A table with any other column count (4+, or 1) returns tableModStyleFor -> None and falls through to this generic path with $docTemplate != "Default". It therefore gets:

  • no column dividers (Columns -> {{False}}), and
  • no GridBoxItemSize at all (the Scaled column-width fit is Default-only).

tableItemSize[ncol] (line 3716) is still defined but no longer called.

HEAD behavior (486a861)

The non-resource branch gave these templates full column dividers AND tableItemSize[ncol] (Scaled widths so cells wrap and the table stays inside the page).

Effect

A wide (4+-column) table on a Symbol / Guide / TechNote / Chapter / Essay page loses its vertical rules and, more importantly, its width fitting: long-content columns are unconstrained and can overflow the page / deployed-cloud width. The width constraint was added precisely to prevent that overflow.

Repro

A Template: Symbol page with a 4-column table in ## Details:

Get[".../MarkdownToNotebook.wl"];
nb = MarkdownToNotebook["symbol-with-4col-details-table.md", "Evaluate" -> False];
Cases[nb, GridBox[rows_, opts___] /; ! FreeQ[rows, "Col3"] :> {opts}, Infinity]

Working tree:

GridBoxDividers -> {Columns -> {{False}}, Rows -> {{True}}}, GridBoxSpacings -> {...}
(* no GridBoxItemSize *)

HEAD (486a861):

GridBoxDividers -> {Columns -> {{True}}, Rows -> {{True}}},
GridBoxItemSize -> {Columns -> {Scaled[0.2], Scaled[0.233...], Scaled[0.233...], Scaled[0.233...]}}, GridBoxSpacings -> {...}

Which change introduced it

The uncommitted merge's tableCell resolution (the local Default / essay-table handling). The accompanying comment "other generic tables keep the historical row-only rule" is inaccurate: on HEAD these documentation templates got full frames plus Scaled widths, not row-only rules. The condition should distinguish resource templates (row-only, no widths) from Default AND the documentation templates (dividers plus width fit), rather than singling out Default.

Related but distinct

#92 (blank first row in Details tables) is a separate, row-level concern.

Severity

Low-medium: cosmetic loss of column dividers plus a functional loss of width fitting (possible horizontal overflow) for tables with a column count other than 2 or 3 on documentation templates. 2 and 3 column tables (the *TableMod path) are unaffected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions