feat: table des matières auto-générée avec ancres et suivi de défilement

- Génération côté PHP depuis les h2/h3 du contenu rendu (slug, accents, déduplication)
- Injection d'id sur chaque titre pour les ancres
- Affichage dans la sidebar si >= 3 titres, H3 indenté
- Sidebar défilable (max-height 100vh) pour que la TOC reste visible
- IntersectionObserver JS : surlignage du chapitre courant au défilement
This commit is contained in:
Cedric Abonnel
2026-05-13 01:09:47 +02:00
parent a926e1825d
commit bfc8713172
3 changed files with 110 additions and 2 deletions
+38
View File
@@ -597,6 +597,10 @@ textarea.form-control {
.related-sidebar {
position: sticky;
top: 1.5rem;
max-height: calc(100vh - 3rem);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--vl-border) transparent;
}
/* ─── Post layout: colonnes sidebar fixe + article flexible ── */
@@ -617,6 +621,40 @@ textarea.form-control {
margin-bottom: 1rem;
}
.toc-list {
list-style: none;
padding: 0;
margin: 0 0 1.5rem;
display: flex;
flex-direction: column;
gap: .1rem;
}
.toc-list a {
display: block;
font-size: .8rem;
line-height: 1.45;
color: var(--vl-muted);
padding: .25rem .5rem;
border-left: 2px solid transparent;
transition: color .15s, border-color .15s;
}
.toc-list a:hover,
.toc-list a.toc-active {
color: var(--vl-accent);
border-left-color: var(--vl-accent);
}
.toc-list a.toc-active {
font-weight: 600;
}
.toc-h3 a {
padding-left: 1.25rem;
font-size: .775rem;
}
.related-card {
display: flex;
gap: 0.75rem;
File diff suppressed because one or more lines are too long