Compare commits

...
3 Commits
Author SHA1 Message Date
LeoVasanko fd1987c9b3 Slight color change for inline code text to make it stand out of paragraph text. Not applied to list items and headings. 2026-08-30 03:40:03 +00:00
LeoVasanko 85a306296f Never break inline code spans (nowrap)
word-break: keep-all does not suppress breaks at hard hyphens (an
explicit UAX #14 break opportunity), so `--arg` could split after the
dashes. Inline code is short — nowrap is the safe fix.
2026-08-30 02:20:54 +00:00
LeoVasanko 2b9c7635d3 Figure-wrap lone images even with trailing inline attrs
Space-separated brace attrs on a lone image's own line (e.g.
{style="max-width: 40em"}) are consumed onto the paragraph but leave
an empty text token in the inline children, which defeated the
lone-image check — the image stayed a bare inline <img> without the
figure wrapper (and without lightbox/zoom treatment). Strip empty text
tokens before the check.
2026-08-30 02:20:54 +00:00
2 changed files with 25 additions and 3 deletions
+18 -2
View File
@@ -18,6 +18,11 @@
/* Links stay quiet — mostly text color with a hint of the accent —
and light up to the full accent on hover. */
--link: color-mix(var(--text) 50%, var(--accent));
/* Inline code tint in body paragraphs: halfway between text and muted.
Both endpoints are theme constants, so the mix is a definite color
per theme — themes may also pin it outright. Outside paragraphs code
inherits the context's color (accent headings stay accent). */
--code-inline: color-mix(var(--text), var(--muted));
/* Selection fill for page text and the CodeMirror editors; themes
override when the accent tint clashes with accent-colored text. */
--selection-bg: color-mix(var(--accent) 30%, transparent);
@@ -1174,8 +1179,19 @@ code {
inherited value), shifting it 30% toward --muted. */
code:not(pre code) {
padding-inline: 0.2em;
word-break: keep-all;
color: color-mix(currentColor 70%, var(--muted));
/* Never break inside a code span. word-break: keep-all would not
suffice: a hard hyphen is an explicit break opportunity (UAX #14),
which keep-all does not suppress — `--arg` could still split after
the dashes. Inline code is short, so nowrap is safe here. */
white-space: nowrap;
}
/* In body paragraphs the text color is a known constant (--text), so
code can take a fixed tint (--code-inline) instead of an unreliable
mix off the inherited color. A paragraph never wraps pre, so no guard
is needed here. */
p code {
color: var(--code-inline);
}
code:not(pre code):first-child {
+7 -1
View File
@@ -180,7 +180,13 @@ def _unwrap_lone_figures(state) -> None:
for i, token in enumerate(tokens):
if token.type != "inline" or not token.children:
continue
[child] = token.children if len(token.children) == 1 else [None]
# Attrs consumed out of the text (e.g. {style=...} space-separated
# on the image's own line) leave empty text tokens behind — strip
# them so the lone-image check is not thrown off by user styling.
children = [c for c in token.children if c.type != "text" or c.content]
if children:
token.children = children
[child] = children if len(children) == 1 else [None]
if child and child.type == "image":
if (
tokens[i - 1].type == "paragraph_open"