This commit is contained in:
Raven Scott
2026-01-05 16:16:48 -05:00
parent 0503d2f470
commit 31494dfb45
2 changed files with 19 additions and 2 deletions
+8
View File
@@ -134,6 +134,14 @@ app.set('views', path.join(__dirname, 'views'));
// Middleware to parse URL-encoded bodies (form submissions)
app.use(express.urlencoded({ extended: false }));
// Route for site.webmanifest with CORS headers (needed for cross-origin requests from blog subdomain)
app.get('/site.webmanifest', (req, res) => {
const manifestPath = path.join(__dirname, 'public', 'site.webmanifest');
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Content-Type', 'application/manifest+json');
res.sendFile(manifestPath);
});
// Serve static files (CSS, Images)
app.use(express.static(path.join(__dirname, 'public')));
+10 -1
View File
@@ -83,9 +83,18 @@
// Initialize Highlight.js and render Mermaid after DOM is ready
document.addEventListener('DOMContentLoaded', (event) => {
// Initialize Highlight.js
// Initialize Highlight.js - only highlight blocks that haven't been highlighted yet
// Server-side marked already highlights code, so we skip blocks with the 'hljs' class
document.querySelectorAll('pre code').forEach((block) => {
// Skip if already highlighted (has hljs class) or if it's a mermaid diagram
if (!block.classList.contains('hljs') && !block.closest('.mermaid')) {
try {
hljs.highlightElement(block);
} catch (e) {
// Silently ignore highlighting errors
console.debug('Highlight.js error:', e);
}
}
});
// Manually run mermaid to render all diagrams