Files
Elian DoranandClaude Opus 5.5 bff2bf6c23 feat(share): color code blocks with VS Code themes in light and dark
The share theme styled highlighted code with highlight.js's
`default.css`, a light-only theme, so highlighted code on a dark shared
page kept light-mode token colors.

highlight.js ships no VS Code theme, while code notes default to the
VS Code Light and Dark CodeMirror themes. `@triliumnext/highlightjs`
now carries both palettes, taken from
`@fsegurai/codemirror-theme-vscode-*`, and `buildVsCodeThemeCss()`,
which writes a highlight.js stylesheet from one: the token colors, the
block colors and the block layout every stock theme carries. A code
block and a code note color the same token alike; keywords are bold,
as in that CodeMirror theme.

- The app registers them as "VS Code (Light)" and "VS Code (Dark)", so
  they appear in the code block color scheme picker. The default stays
  Stack Overflow.
- The share theme's build writes both into `scripts.css`, scoped with
  `:where(html.theme-light)` and `:where(html.theme-dark)`, in place of
  `default.css`. `:where()` keeps the block rules as weak as a stock
  theme's, so the share theme's own `.ck-content code` colors still
  win inside text notes, and the page follows the visitor's mode with
  no script involved.

The share theme's build moves from esrun to tsx, which the other build
scripts already use: esrun left the workspace import for Node, which
cannot load a `.ts` file. esrun and the now unused `highlight.js` dev
dependency leave the package.

The Code blocks and Sharing pages describe the new schemes and the
shared colors.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-09 10:05:39 +03:00
..