Skip to content

MarkdownAura v1.7.1

Choose a tag to compare

@westsource westsource released this 18 Oct 08:17
· 3 commits to main since this release

MarkdownAura 1.7.1

修复:宽 / 撑满 下,比栏宽窄的表格现在靠左。 阅读栏是一条居中的栏(max-width: var(--measure); margin-inline: auto 落在 .prose 的每个直接子元素上),所以一个比栏窄的块会被居中。这在 窄 60ch、
舒适 100ch 下是对的——栏本身就贴着阅读宽度,小表格落在中间和周围的文字属于同一块;但在 宽 140ch 与
撑满 下,栏比绝大多数表格宽得多,居中的表格会从它所属的段落里"漂"出去——每个段落都从栏的左沿起排,
表格也该从那里起排。

  • 只对表格、只对 宽 / 撑满。 段落、标题、代码块、图表卡片照旧,窄 与 舒适 的表格也照旧居中:
    改动是一条针对 .prose > table 的规则,命中 :root[data-measure="wide"] / ="full" 时才把
    margin-inline 从 auto 改成 0。
  • 和栏一样宽的表格不受影响。 它本来就被 var(--measure) 夹到栏宽(更宽的还会在栏内横向滚动),
    margin-inline: 0 正是 auto 本来放它的位置——所以这一条只改变"更窄的表格落在哪"。
  • 档位名是 CSS 唯一推不出来的东西。 --measure 到那时已经是一个解析后的长度(像素或 100%),
    选择器无法按它匹配;src/measure.ts 因此把档位 id 写到 :root[data-measure] 上(每次
    applyMeasure 都写,属性与它旁边的长度不可能不一致),mockup 写同一个属性以免两边漂移。

设计文件同步:design/SPEC.md §3 新增一条,"一列到底"那一节现在写明了窄表格在两档下的对齐;
design/prose.css 的规则自带这段理由,并说明为什么用属性选择器而不是 --measure 本身。

验证(实测):design/mockup.html 加载的是发布用的同一份 prose.css,在 1600×1000 下把四档逐档
点过一遍,向一个 .prose 里插一张 66px 宽的表格并量它与段落左沿(即栏左沿)的距离 ——

档位 --measure 栏左沿 表格左沿 结果
窄 485px 570px 779px 居中(779 = 570 + (485−66)/2)
舒适 809px 408px 779px 居中(779 = 408 + (809−66)/2)
宽 1132px 258px 258px 靠左
撑满 100% 258px 258px 靠左

node design/check-prose-css.mjs 全通过,npx tsc --noEmit 通过。


MarkdownAura 1.7.1

Fix: at wide and full, a table narrower than the column now hugs its left edge. The reading column
is a centred one (max-width: var(--measure); margin-inline: auto on every direct child of .prose), so a
block narrower than the column is centred. That is right for narrow 60ch and comfortable 100ch — the
column there is close to the reading width, and a small table sitting in the middle reads as part of the text
around it. At wide 140ch and full the column is very much wider than most tables, and a centred one
floats away from the paragraphs it belongs to: every paragraph starts at the column's left edge, so the
table should too.

  • Tables only, and only wide / full. Paragraphs, headings, code fences and diagram cards are
    untouched, and so are tables at narrow and comfortable: the change is one rule on .prose > table
    that turns margin-inline: auto into 0 when :root[data-measure="wide"] / ="full" matches.
  • A table as wide as the column is unaffected. It is already clamped to the column by var(--measure)
    (and one wider still scrolls inside it), which is exactly where auto had put it — so the rule only
    changes where the narrower ones sit.
  • The preset name is the one thing CSS cannot derive. By the time the rule matters --measure is a
    resolved length (pixels or 100%) that no selector can match on, so src/measure.ts writes the preset id
    onto :root[data-measure] (every applyMeasure, so the attribute can never disagree with the length
    beside it) and the mockup writes the same attribute so the two do not drift.

The design files follow: a new bullet in design/SPEC.md §3, whose "one column for everything" section now
states the alignment at both ends, and the rule in design/prose.css carries the reasoning and why it is a
selector on an attribute rather than on --measure itself.

Verification (measured): design/mockup.html loads the shipped prose.css; at 1600×1000 every preset was
clicked through, a 66px-wide table was inserted into a .prose, and its distance from the paragraph left edge
(the column's left edge) was measured —

Preset --measure Column left Table left Result
narrow 485px 570px 779px centred (779 = 570 + (485−66)/2)
comfortable 809px 408px 779px centred (779 = 408 + (809−66)/2)
wide 1132px 258px 258px left
full 100% 258px 258px left

node design/check-prose-css.mjs and npx tsc --noEmit pass.