Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/scss/td/_content-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@
--term-color-7: #5d7189;
}

// Markmap declares its text token on both the wrapper and the generated SVG.
// Override both inside article content, with enough specificity to survive
// the vendor stylesheet injected after ours. The body token follows live
// mode/preset changes; keep the vendor's dark ink when printing on white.
@media screen {
.td-content .markmap {
--markmap-text-color: var(--bs-body-color);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Land the bilingual Markmap contract update

This introduces a public screen/print behavior change, but the commit explicitly says the docsite companion is only an unmerged patch, leaving the canonical EN/ZH Design contract out of sync. Land the corresponding English and Chinese changes under ../oink.pgsty.com/content/docs/design/ together with this implementation rather than leaving them as an external artifact.

AGENTS.md reference: AGENTS.md:L35-L37

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: the canonical EN/ZH Design contract update has been added in pgsty/oink.pgsty.com#11, documenting the Markmap screen text, print fallback, and consumer overrides per AGENTS.md. I am leaving this thread open until that companion PR is merged.

}
}

// Markmap highlights fenced code inside its nodes with highlight.js, whose
// vendored `default.min.css` is a light-only theme with no dark counterpart --
// unlike Swagger UI and DocSearch, which carry their own and only need the
Expand Down
9 changes: 6 additions & 3 deletions bin/check-namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@
}

# Custom properties a third-party runtime reads from its own stylesheet: the
# theme sets them to theme its player, so they cannot carry a --td- prefix.
# theme sets them to theme its integrations, so they cannot carry a --td- prefix.
# asciinema-player.css reads --term-* (palette, font, metrics); renaming them
# leaves the player on its built-in black-on-white defaults inside an OINK
# terminal surface, which is how the 0.5 sweep broke it.
# terminal surface, which is how the 0.5 sweep broke it. Markmap reads its
# --markmap-text-color token on the SVG; prefixing it leaves dark text on the
# dark article canvas.
THIRD_PARTY_PROPERTY = re.compile(
r"^--term-(color-(foreground|background|\d+)|font-family|line-height|cols|rows)$"
r"^--(?:term-(color-(foreground|background|\d+)|font-family|line-height|cols|rows)"
r"|markmap-text-color)$"
)
BEM_CLASS = re.compile(r"^[a-z][a-z0-9-]*(?:__|--)[a-z0-9_-]+$")
PLAYER_THEME_RE = re.compile(
Expand Down
23 changes: 23 additions & 0 deletions tests/js/markmap-theme-source.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

// Source contract only; rendered contrast and interactions belong to the
// sibling documentation site's Markmap browser suite.
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const test = require('node:test');

const source = fs.readFileSync(
path.join(__dirname, '../../assets/scss/td/_content-components.scss'), 'utf8',
).replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g, '');

test('Markmap maps the article token on screen with wrapper/SVG specificity', () => {
assert.match(source,
/@media\s+screen\s*\{\s*\.td-content\s+\.markmap\s*\{\s*--markmap-text-color:\s*var\(--bs-body-color\);\s*\}\s*\}/,
'keep the mapping screen-only and applicable to both wrapper and SVG');
});

test('Markmap has no competing text-token assignment or important override', () => {
const declarations = source.match(/--markmap-text-color\s*:[^;]+;/g) || [];
assert.deepEqual(declarations, ['--markmap-text-color: var(--bs-body-color);']);
});