mirror of
https://github.com/andwati/andwati.com.git
synced 2026-11-26 18:38:47 +00:00
Render legacy callout shortcodes, add code syntax highlighting
Converts the note/tip/warning/danger `{% <tag> %}...{% </tag> %}` blocks
the posts→writings migration script left untranslated into styled
.callout markup (toml-content-loader.ts's renderCallouts(), styled in
global.css to match the new design system).
Also wires shiki into the same markdown pipeline for fenced code block
highlighting (github-light/github-dark, switched by the same
[data-theme]/prefers-color-scheme pattern tokens.css already uses).
Also records the Three.js centerpiece's perf budget check in TODO.md:
scene is trivially light (well under 10k triangles, 100+fps uncapped);
the ~130KB gzip payload is three.js core itself, not a tree-shaking gap
(verified named imports change nothing - sideEffects:false already lets
Rollup shake fully), and the script is a deferred module that doesn't
block first paint. No code changes needed there.
This commit is contained in:
@@ -93,6 +93,28 @@ pre {
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* Shiki syntax highlighting (toml-content-loader.ts renders code fences with
|
||||
defaultColor: false, so only per-token color vars are set — background,
|
||||
padding, etc. stay on our own `pre` rule above). Follows the same
|
||||
light/dark switching pattern as tokens.css: system preference by default,
|
||||
[data-theme] overrides it either way. */
|
||||
.shiki,
|
||||
.shiki span {
|
||||
color: var(--shiki-light) !important;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) .shiki,
|
||||
:root:not([data-theme="light"]) .shiki span {
|
||||
color: var(--shiki-dark) !important;
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] .shiki,
|
||||
:root[data-theme="dark"] .shiki span {
|
||||
color: var(--shiki-dark) !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 42rem;
|
||||
margin-inline: auto;
|
||||
@@ -169,6 +191,61 @@ pre {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.callout {
|
||||
margin: 0 0 var(--space-5);
|
||||
padding: var(--space-4) var(--space-5);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 3px solid var(--callout-color, var(--accent));
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.callout-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-2);
|
||||
color: var(--callout-color, var(--accent));
|
||||
}
|
||||
|
||||
.callout-icon {
|
||||
width: 1.1em;
|
||||
height: 1.1em;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.callout-title {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.callout-content {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.callout-content > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.callout-note {
|
||||
--callout-color: var(--accent);
|
||||
}
|
||||
|
||||
.callout-tip {
|
||||
--callout-color: #4a9c6d;
|
||||
}
|
||||
|
||||
.callout-warning {
|
||||
--callout-color: #d1a53d;
|
||||
}
|
||||
|
||||
.callout-danger {
|
||||
--callout-color: #d1502f;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
|
||||
Reference in New Issue
Block a user