feat: coloration syntaxique locale via themes/default.css

Suppression de la dépendance CDN highlight.js.
Le CSS github-dark est maintenant dans themes/default.css,
lu au démarrage et injecté dans chaque page HTML générée.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:53:31 +02:00
parent 85f62bf842
commit bcf647976c
2 changed files with 127 additions and 1 deletions
+6 -1
View File
@@ -4,6 +4,11 @@ const { marked } = require('marked');
const { markedHighlight } = require('marked-highlight');
const hljs = require('highlight.js');
const SYNTAX_CSS = fs.readFileSync(
path.join(__dirname, '..', 'themes', 'default.css'),
'utf-8'
);
marked.use(markedHighlight({
langPrefix: 'hljs language-',
highlight(code, lang) {
@@ -444,7 +449,7 @@ function htmlShell({ title, sidebar, body, watchMode }) {
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Roboto+Mono&display=swap">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<style>${SYNTAX_CSS}</style>
<style>${STYLES}</style>${noSidebarStyle}
</head>
<body>