Skip to content

feat(convert): publish tables with the align-start layout - #50

Merged
willkg merged 1 commit into
mainfrom
tables-align-start
Jul 26, 2026
Merged

feat(convert): publish tables with the align-start layout#50
willkg merged 1 commit into
mainfrom
tables-align-start

Conversation

@willkg

@willkg willkg commented Jul 26, 2026

Copy link
Copy Markdown
Member

Every published table now carries data-layout="align-start".

A table with no data-layout attribute auto-sizes but sits unanchored, which renders poorly for the wide, many-column tables markdown tends to produce. align-start auto-sizes the table to its content and left-aligns it on the page.

Verified by republishing 29 real tables from an existing page with nothing but this attribute added — a clear improvement over the current output, and enough to make per-table width/layout configuration unnecessary.

Implements part of issue #7 by making it so that we don't really need to implement table and column widths.

Scope

Only the <table> tag is overridden. goldmark's GFM renderer still emits the thead/tbody, rows, and cells, so the diff on every existing published page is exactly one attribute. Two regression goldens were regenerated; both changed by that attribute alone.

On the storage format

Confluence does not document its table storage format — the official docs cover only basic structure plus rowspan/colspan, and the ADF docs cover table-level attributes incompletely. The layout vocabulary (center, align-start, wide, full-width) was established empirically by pushing storage and reading the page back as ADF (?body-format=atlas_doc_format).

Reading storage back is not sufficient to validate this kind of change: Confluence persists an attribute in body.storage that the renderer never honors. For example data-number-column="true" is stripped outright, while an invented value on a whitelisted attribute survives storage without taking effect.

One finding is recorded in tables.go because it constrains future work: a <colgroup> on a table with no layout attribute makes Confluence default the layout to full-width. So this attribute has to stay if column widths are ever emitted.

Known gap (not addressed here)

GFM alignment (| :---: |) is still silently dropped — goldmark emits align= attributes on cells, which Confluence discards. Tracked in #48; the fix requires wrapping every cell's content in a <p>, a much larger output change.

make test && make lint && make vet pass.

A table with no data-layout attribute auto-sizes but sits unanchored, which
renders poorly for the wide, many-column tables markdown tends to produce.
"align-start" auto-sizes the table to its content and left-aligns it on the
page, which is what a markdown table should look like.

Only the <table> tag is overridden; goldmark's GFM renderer still emits the
thead/tbody, rows, and cells, so the change to every existing page is exactly
one attribute.

Confluence does not document its table storage format. The layout vocabulary
(center, align-start, wide, full-width) was established empirically by pushing
storage and reading the page back as ADF, since an attribute can survive in
body.storage while never reaching the renderer. Noted in tables.go: a colgroup
on a table with no layout attribute makes Confluence default the layout to
full-width, so this attribute must stay if column widths are ever emitted.
@willkg
willkg merged commit ed26cbc into main Jul 26, 2026
1 check passed
@willkg
willkg deleted the tables-align-start branch July 26, 2026 02:57
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.

1 participant