Skip to content

NotebookToMarkdown: a DefinitionBox wrapping a TableText option/property grid is not recovered as a markdown table (falls to the inline path, no gridTable rule) #89

Description

@mbahram

Summary

The property/option-table cell styles round-trip to a markdown pipe table through a dedicated blockFor[..., BoxData[GridBox[...]]] := gridTable[rows] rule:

blockFor["2ColumnTableMod" | "3ColumnTableMod" | "TableNotes", BoxData[GridBox[rows_List, ___]]] := gridTable[rows]

A DefinitionBox cell holding the same kind of TableText grid (an option / property table, as a Tech Note carries) has no such rule, so it falls to the catch-all

blockFor[_String, c_] := tidy @ inlineMd[c]

and its GridBox is emitted through the generic inline path instead of gridTable — so it does not come back as a markdown table.

Repro (deterministic, kernel-only)

Get[".../NotebookToMarkdown.wl"];

NotebookToMarkdown @ Notebook[{
    Cell[BoxData[GridBox[{{"Option", "Default"}, {"\"Method\"", "Automatic"}}]], "DefinitionBox"]
}]

Expected: a | Option | Default | markdown table (as a 2ColumnTableMod grid of the same content produces). Actual: no pipe table — the DefinitionBox GridBox is routed through inlineMd, not gridTable.

Root cause

NotebookToMarkdown.wl defines the BoxData[GridBox[...]]gridTable rule only for the 2ColumnTableMod / 3ColumnTableMod / TableNotes styles. DefinitionBox is not among them, so it reaches blockFor[_String, c_] := tidy @ inlineMd[c].

Fix

Add the mirror rule so a DefinitionBox property/option grid recovers as a markdown table like the other *TableMod grids:

blockFor["DefinitionBox", BoxData[GridBox[rows_List, ___]]] := gridTable[rows]

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