Repository navigation
MarkdownAura v1.7.2
MarkdownAura 1.7.2
修正 1.7.1:宽 / 撑满 下的窄表格应贴文本栏的左沿**,而不是窗口的左沿。** 1.7.1 的规则把表格的
margin-inline 从 auto 改成 0,那把它对齐到了 .prose(窗格)的左沿——但文本栏本身是在窗格里居中
的(.prose > * 的 max-width: var(--measure); margin-inline: auto),所以段落都在居中的栏里,只有表格贴到了
窗口左边。方向反了。
正确的做法是让表格占据栏宽、内容留在起始处:表格本来 width: max-content(贴合自己的网格,所以
"框内靠左"无从谈起),改成 width: var(--measure) 就让这个块等于栏宽,网格仍在块的起始——再配上原有的
margin-inline: auto,这个块连同网格正好落在段落下方。max-width: 100% 兜住唯一一种 --measure 超出窗格的
情况(窗宽小于 140ch 时):此时块取窗格宽、与段落一致,而不是溢出。
- 两条规则、只对表格、只对
宽/撑满。窄与舒适照旧:栏贴着阅读宽度,小表格在栏里居中。 - 根因是列宽来自
--measure而不是"靠左"这个词。 表格没有独立的栏容器可对齐,直接推margin-inline只会
推到auto的起点之外——而"起点"是窗格,不是居中的栏。让块等于栏宽是把对齐交给同一套max-width + margin-inline: auto,与段落用同一条规则。 - 属性选择器不变:
--measure到那时是一个解析后的长度,选择器匹配不了,src/measure.ts把档位 id 写在
:root[data-measure]上(mockup 同步)。
设计文件同步:design/SPEC.md §3 那一条改写为"栏的左沿,不是窗格的左沿",并把这段错误留在注释里;
design/prose.css 的规则注释同样记录了它。
验证(实测,2600×1200 的 mockup —— 这次特意让栏明显窄于窗格,1.7.1 的测法在窄窗格下两沿重合,看不出错):
插一张 66px 宽的表格,量首个单元格与段落(即栏左沿)、窗格左沿的距离 ——
| 档位 | --measure |
窗格左沿 | 文本栏左沿 | 表格框左沿 | 首格左沿 | 结果 |
|---|---|---|---|---|---|---|
| 窄 | 485px | 258px | 1070px | 1279px | 1279px | 栏内居中 |
| 舒适 | 809px | 258px | 908px | 1279px | 1279px | 栏内居中 |
| 宽 | 1132px | 258px | 746px | 746px | 747px | 贴栏左沿 |
| 撑满 | 100% | 258px | 258px | 258px | 259px | 贴栏左沿 |
(首格 +1px 是 th 的半像素边框。)另测边界:窗格 2600px、宽 下表格框宽 1132px(= 栏宽);窗格缩到 700px
时 max-width: 100% 生效、框宽 632px(= 窗格),网格在框内横向滚动、不溢出窗格。node design/check-prose-css.mjs 与 npx tsc --noEmit 通过。
MarkdownAura 1.7.2
Fix to 1.7.1: at wide / full, a narrow table belongs at the text column's left edge, not the
window's. 1.7.1's rule turned the table's margin-inline from auto to 0, which aligned it to .prose
(the pane) — but the column itself is centred in the pane (.prose > * carries max-width: var(--measure); margin-inline: auto), so while paragraphs sit in the centred column the table jumped to the window's left.
The direction was wrong.
The fix is to make the table take the column's width and leave its content at the start: the table is
width: max-content (it hugs its grid, so "left within the box" is meaningless), and width: var(--measure)
gives that box the column's width while the grid stays at the box's start — with the existing margin-inline: auto the box, and the grid inside it, land under the paragraphs. max-width: 100% covers the one case the
measure exceeds the pane (a window narrower than 140ch): the box takes the pane, as a paragraph does, instead
of overflowing.
- Two declarations, tables only,
wide/fullonly.narrowandcomfortableare unchanged: the
column is close to the reading width there, and a small table sits centred inside it. - The root cause is that the column's width comes from
--measure, not from the word "left". A table has
no column container of its own to align against, so pushingmargin-inlinemerely pushes it pastauto's
start — and the start is the pane, not the centred column. Giving the box the column's width hands the
alignment to the samemax-width + margin-inline: autoa paragraph uses. - The attribute selector is unchanged:
--measureis a resolved length by then and no selector can match on
it, sosrc/measure.tswrites the preset id onto:root[data-measure](the mockup mirrors it).
The design files follow: the design/SPEC.md §3 bullet now says "the column's edge, not the pane's" and keeps
the mistake on the record, and the design/prose.css rule's comment does the same.
Verification (measured, mockup at 2600×1200 — deliberately a viewport where the column is clearly narrower
than the pane, since 1.7.1's test let the two edges coincide): a 66px-wide table was inserted and the first
cell's distance from the paragraph (the column's left edge) and from the pane's left edge was measured —
| Preset | --measure |
Pane left | Column left | Table box left | First cell | Result |
|---|---|---|---|---|---|---|
| narrow | 485px | 258px | 1070px | 1279px | 1279px | centred in the column |
| comfortable | 809px | 258px | 908px | 1279px | 1279px | centred in the column |
| wide | 1132px | 258px | 746px | 746px | 747px | at the column's left |
| full | 100% | 258px | 258px | 258px | 259px | at the column's left |
(the +1px on the cell is th's half-pixel border). Boundaries too: at 2600px the box is 1132px (the column)
under wide; at a 700px window max-width: 100% caps it to 632px (the pane) and the grid scrolls inside
rather than overflowing. node design/check-prose-css.mjs and npx tsc --noEmit pass.