1. How swift-docc-render consumes this
A necessary correction first. The task's swiftCaseSite points at
RenderSectionKind.row, declared in the "Symbol render sections" group at
RenderSection.swift#L20:
// Symbol render sections
case mentions, discussion, content, taskGroup, relationships, declarations, parameters, sampleDownload, row
Having read the rest of the pipeline, this enum case appears to be dead. The discriminator
switch that turns a decoded kind into a concrete RenderSection struct for
reference-page content —
CodableContentSection.swift#L41-L73
— has cases for .mentions, .discussion/.content,
.taskGroup, .relationships, .declarations, .parameters,
and several others, but no case for .row; it falls through to
default: fatalError(). No struct anywhere under
Sources/SwiftDocC/Model/Rendering/Symbol/ sets kind = .row, and a repo-wide
grep for RenderSectionKind.row at the pinned commit returns nothing. On the render side, the
component that dispatches a symbol page's primaryContentSections to Vue components —
PrimaryContent.vue's SectionKind map in
constants/PrimaryContentSection.js#L12-L27
— also has no row entry. So a "kind": "row" object inside
primaryContentSections is not a real, reachable shape in either the encoder or the renderer;
it's a vestigial case in an enum whose members were probably enumerated in one place ahead of the section
types actually being implemented.
The "row" wire value that does flow through the system end-to-end lives one tier
down, as a member of RenderBlockContent (block-level content, not a top-level render
section): case row(Row) at
RenderBlockContent.swift#L66,
with the payload struct at
RenderBlockContent.swift#L781-L813.
This is what the rest of this page documents, since it is the only "row" shape that is actually
observable in DocC's JSON output, and it is the shape the vendored schema and generated Swift types in
this repository (DocCArchive) describe as Row (see the data sheet below).
In swift-docc-render, block content is dispatched by the renderNode() function in
ContentNode.vue,
which switches on a BlockType constant map (row: 'row' at
ContentNode.vue#L50).
The BlockType.row case is handled at
ContentNode.vue#L395-L404:
case BlockType.row: {
const columns = node.numberOfColumns ? { large: node.numberOfColumns } : undefined;
return createElement(
Row, { props: { columns } }, node.columns.map(col => (
createElement(
Column, { props: { span: col.size } }, renderChildren(col.content),
)
)),
);
}
node.numberOfColumns becomes the columns.large breakpoint prop on a
Row.vue
component, and each entry in node.columns becomes a child
Column.vue
whose span prop is that column's size; each column's own
content array is recursively rendered through renderChildren, so a column can
hold arbitrary block content (paragraphs, images, code listings, even a nested @Row).
Row.vue's root template is:
<div class="row" :style="style" :class="{ 'with-columns': columns }">
<slot />
</div>
where style is a computed property exposing CSS custom properties
(--col-count-large, --col-count-medium, --col-count-small,
--col-gap) derived from the columns and gap props
(Row.vue#L38-L45).
Layout itself is pure CSS grid (see §4); no JavaScript recalculates column widths at runtime.
2. Example JSON and rendered mockup
No fixture containing a "kind": "row" block was found in either
Tests/DocCArchiveTests/Fixtures/ExampleDocs.doccarchive or
SampleLibrary.doccarchive in this repository, nor as a JSON/wire-literal fixture in
swift-docc's test suite (Tests/SwiftDocCTests/Semantics/Reference/RowTests.swift only
constructs RenderBlockContent.Row as in-memory Swift values, not JSON). The example below is
therefore hand-written to match the schema confirmed in §3.
{
"kind": "row",
"numberOfColumns": 3,
"columns": [
{
"size": 1,
"content": [
{
"type": "heading", "level": 3, "text": "Ice power",
"anchor": "ice-power"
}
]
},
{
"size": 1,
"content": [
{
"type": "heading", "level": 3, "text": "Fire power",
"anchor": "fire-power"
}
]
},
{
"size": 1,
"content": [
{
"type": "heading", "level": 3, "text": "Wind power",
"anchor": "wind-power"
}
]
}
]
}
This is the block that an author produces by writing (see §3 for the authoring-side directive):
@Row {
@Column {
### Ice power
}
@Column {
### Fire power
}
@Column {
### Wind power
}
}
Mockup: three equal-width columns in one row, as CSS Grid
would lay out numberOfColumns: 3 with three size: 1 columns. On narrow
viewports Row.vue's breakpoint(small) rule collapses this to one column per
row (grid-auto-flow: row).
3. Data sheet
Authoritative source: Sources/DocCArchive/Vendored/RenderNode.spec.json (schema object
Row, and its dependency Column), cross-checked against the generated
Components.Schemas.Row / Components.Schemas.Column structs in
Sources/DocCArchive/generated/Types.swift. Note that Row is one of the untagged
"any of" members of the generated RenderBlockContent enum
(case Row(Components.Schemas.Row), decoded by trial rather than by a kind
discriminator on the Swift/OpenAPI side — see Types.swift around the
RenderBlockContent initializer).
| Field | Type | Required? | Enum values / default | Note |
|---|---|---|---|---|
kind | string | yes | "row" (fixed) | Discriminator tag on the swift-docc encoding side; the generated Swift enum instead tries each RenderBlockContent case in turn. |
columns | array of Column | yes | — | One entry per authored @Column; order is rendering order, left to right / top to bottom. |
numberOfColumns | number (generated as Swift.Double; swift-docc's own model uses Int) | yes | — | Total column-slots in the row's grid; may exceed columns.count when the row isn't fully filled, or when a column spans more than one slot via size. |
Column.content | array of RenderBlockContent | yes | — | Arbitrary nested block content (headings, paragraphs, images, even nested rows). |
Column.size | number | yes | default 1 on the authoring side | How many of the row's column-slots this column spans. |
Column.alignment | string enum | swift-docc model: yes (default leading); DocCArchive vendored schema: absent | leading / center / trailing | Added to swift-docc's RenderBlockContent.Row.Column for DocC 6.4's @Column(alignment:) argument. The vendored RenderNode.spec.json and generated Components.Schemas.Column in this repository do not include this field — the vendored schema is stale relative to swift-docc's current model at the pinned commit. |
Also cross-checked: RenderSectionKind.row itself carries no fields of its own beyond the
shared kind discriminator on the RenderSection protocol, and (per §1) no
concrete struct implements it, so there is no payload shape to document for that case.
DocCArchive transform status: Not yet implemented. MyHTMLTransformer and
MyMarkdownTransformer in Sources/DocCArchive/DocCArchive.swift are still stub
placeholders (HTMLRaw("<!-- what? -->") and return "" respectively) that
do not branch on RenderBlockContent case at all, so a row block passed through
either transformer today produces no row-specific output.
4. HTML/CSS mapping in DocC-Render output
Root element: <div class="row">, rendered by
src/components/ContentNode/Row.vue, with a conditional with-columns class
applied when the columns prop (derived from numberOfColumns) is present. Each
child is a <div class="column"> from src/components/ContentNode/Column.vue.
SCSS (both scoped, both under src/components/ContentNode/):
.row {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr;
grid-gap: var(--col-gap, #{$article-stacked-margin-small});
@include breakpoint(small) {
grid-template-columns: 1fr;
grid-auto-flow: row;
}
&.with-columns {
--col-count: var(--col-count-large);
grid-template-columns: repeat(var(--col-count), 1fr);
grid-auto-flow: row;
@include breakpoint(medium) {
--col-count: var(--col-count-medium, var(--col-count-large));
}
@include breakpoint(small) {
--col-count: var(--col-count-small);
}
}
@include space-out-between-siblings(var(--spacing-stacked-margin-xlarge));
}
.column {
grid-column: span var(--col-span);
min-width: 0;
@include breakpoint(small) {
grid-column: span 1;
}
}
CSS custom properties consumed/produced: --col-count-large, --col-count-medium,
--col-count-small (all set inline by Row.vue's style computed
property from the columns prop, default --col-count-small: 1);
--col-gap (from the optional gap prop, currently not populated by the
BlockType.row dispatch in ContentNode.vue, so it falls back to the SCSS
variable $article-stacked-margin-small); --col-count (an internal alias set by
the .with-columns rule itself, swapped per breakpoint); --col-span (set inline
per Column.vue instance from its span prop, i.e. the column's size
value); and --spacing-stacked-margin-xlarge, consumed by the shared
space-out-between-siblings mixin (src/styles/core/_helpers.scss) to add vertical
spacing between sibling rows/blocks. Responsive behavior is entirely mixin-driven via
@include breakpoint(...) from src/styles/core/_breakpoints.scss; there is no
JavaScript resize listener — the breakpoints are plain CSS media queries.
5. Modern CSS-only alternative
Not applicable
Current behavior: Row.vue and Column.vue hold no interactive state at all.
The only "logic" is a one-time, non-reactive-after-mount computation — a computed
property maps static props (columns, gap, span) to inline CSS
custom properties, and CSS Grid plus @include breakpoint(...) media queries do 100% of the
actual layout work, including the responsive collapse to a single column on narrow viewports. There is no
click handler, no v-show/v-if toggle, no stored "current" selection, and nothing
a user interacts with to change the row's state after render.
Since there is no interactive behavior or hidden/revealed state to replace, none of the stateful modern-CSS
mechanisms (<details>, radio+:checked, :target, Popover API,
<dialog>) apply here — there is nothing for them to hold. The row/column layout
itself is already implemented with modern CSS (Grid custom properties and container-free breakpoint media
queries) rather than JavaScript-computed geometry, so there is no legacy JS-layout technique to migrate
away from either.