mobile ; heading scroll broken

This commit is contained in:
2025-06-21 20:39:22 +02:00
parent 7b556b2d09
commit 1cc864e4f0
12 changed files with 1117 additions and 325 deletions

View File

@@ -28,7 +28,22 @@ function getFileCreationDate(filePath: string): Date {
return stats.birthtime;
}
// Function to generate ID from text (matches frontend logic)
function generateId(text: string): string {
return text
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '');
}
const renderer = new marked.Renderer();
// Custom heading renderer to add IDs
renderer.heading = (text, level) => {
const id = generateId(text);
return `<h${level} id="${id}">${text}</h${level}>`;
};
renderer.code = (code, infostring, escaped) => {
const lang = (infostring || '').match(/\S*/)?.[0];
const highlighted = lang && hljs.getLanguage(lang)