feat(file-viewer): syntax highlighting for code files and chat code blocks
Nightly Build / build (push) Successful in 8s

Vendor highlight.js (core + python, javascript, typescript, json, yaml,
bash) and highlight the file viewer's text kind (computed once per load)
plus fenced blocks in renderMarkdown. Colors come from new --syn-* CSS
variables aliased to the existing palette, so dark mode follows.
This commit is contained in:
Daniele
2026-08-11 10:41:50 +01:00
parent 4d1b1e63be
commit 402c9ffe50
16 changed files with 240 additions and 3 deletions
+73
View File
@@ -0,0 +1,73 @@
/* ── Syntax highlighting (highlight.js) ─────────────────────────────────────
Token colors for code rendered through web/lib/highlight.js: the file
viewer's code kind and fenced blocks in chat markdown. All colors come from
the --syn-* variables (variables.css), which track the light/dark palette.
No background here: the container (.fv-code, chat <pre>) already owns it. */
.hljs {
color: inherit;
background: transparent;
}
.hljs-comment,
.hljs-quote {
color: var(--syn-comment);
font-style: italic;
}
.hljs-keyword,
.hljs-literal,
.hljs-selector-tag {
color: var(--syn-keyword);
}
.hljs-string,
.hljs-regexp,
.hljs-template-string,
.hljs-addition {
color: var(--syn-string);
}
.hljs-number,
.hljs-symbol,
.hljs-bullet {
color: var(--syn-number);
}
.hljs-title,
.hljs-section {
color: var(--syn-title);
}
.hljs-built_in,
.hljs-type,
.hljs-title.class_ {
color: var(--syn-builtin);
}
.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable,
.hljs-name {
color: var(--syn-attr);
}
.hljs-meta,
.hljs-meta .hljs-keyword,
.hljs-selector-class,
.hljs-selector-id {
color: var(--syn-meta);
}
/* Punctuation, operators and params stay on the base text color. */
.hljs-subst,
.hljs-params,
.hljs-punctuation,
.hljs-operator {
color: inherit;
}
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: bold; }
.hljs-link { text-decoration: underline; }
+11
View File
@@ -32,6 +32,17 @@
--radius-md: 12px;
--radius-lg: 16px;
/* Syntax highlighting (consumed by hljs-theme.css). Aliases of the palette
above, so the dark block needs no copies — var() resolves at use time. */
--syn-comment: var(--tool-shell);
--syn-keyword: var(--accent-hover);
--syn-string: var(--tool-outline);
--syn-number: var(--tool-config);
--syn-title: var(--tool-edit);
--syn-builtin: var(--tool-list);
--syn-attr: var(--tool-read);
--syn-meta: var(--tool-search);
/* Sidebar — warm cream */
--sidebar-bg: #f6f0e6;
--sidebar-hover: rgba(63, 52, 40, 0.06);