fixes
This commit is contained in:
@@ -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')));
|
||||
|
||||
|
||||
+11
-2
@@ -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) => {
|
||||
hljs.highlightElement(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
|
||||
|
||||
Reference in New Issue
Block a user