feat(convert): publish tables with the align-start layout - #50
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every published table now carries
data-layout="align-start".A table with no
data-layoutattribute auto-sizes but sits unanchored, which renders poorly for the wide, many-column tables markdown tends to produce.align-startauto-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.storagethat the renderer never honors. For exampledata-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.gobecause it constrains future work: a<colgroup>on a table with no layout attribute makes Confluence default the layout tofull-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 emitsalign=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 vetpass.