Skip to content

architecture: unify theorem/figure/table under one titled referencable fenced-block system #506

@chaoxu

Description

@chaoxu

Summary

Use one underlying theorem-style fenced-div system for all titled, numbered, referencable block objects, including theorem environments, figures, and tables.

figure and table should not become separate bespoke architectures. They should be presets on top of the same underlying block model that already fits theorem-like environments: Pandoc-style fenced divs with editable title text and document-level numbering/reference semantics.

Authoring model

Keep the existing Pandoc-style fenced div syntax with title text.
That means the target shape is the same family as theorem environments, for example:

::: {.figure #fig:architecture} System architecture overview
![Architecture](img/arch.png)
:::

::: {.table #tbl:running-times} Running-time comparison of standard sorting algorithms
| Algorithm | Time          | Space       |
|-----------|---------------|-------------|
| Quicksort | $O(n \log n)$ | $O(\log n)$ |
| Mergesort | $O(n \log n)$ | $O(n)$      |
:::

The important point is that the title/caption text stays normal editable document content, exactly like the theorem title path.

Proposed architecture

Introduce one generic titled referencable fenced-block model with shared machinery for:

  • fenced-div parsing
  • editable title text
  • id / label
  • numbering
  • cross-reference target registration
  • rendered header/chrome
  • rich/read/source coherence

Then treat block kinds as configuration/presets over that shared system, for example:

  • theorem / lemma / proposition / definition
  • figure
  • table

Per-kind configuration can control things like:

  • display prefix (Theorem, Figure, Table)
  • numbering namespace / counter family
  • body renderer / affordances
  • default styling

Why this is cleaner

From the editor's point of view, these blocks share the same structural shape:

  • a fenced block type/class
  • optional title text on the opening line
  • body content parsed as markdown
  • an optional referencable id
  • numbered header rendering in rich/read mode

Theorem-like blocks, figures, and tables may differ in semantics and body affordances, but they should not require three different architectural stacks.

The right split is:

  • one shared titled referencable fenced-block substrate
  • thin per-kind presets/plugins on top of it

Product implication

#479 and #480 should be implemented through this architecture, not ahead of it as one-off block systems.

That means:

  • #506 is the canonical architecture issue
  • #479 is the figure preset/product slice
  • #480 is the table preset/product slice

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions