toc : add h4 support with nested structure and fix anchors in non-block mode
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4e5440a7ae
commit
b724ed1244
6 changed files with 40 additions and 14 deletions
|
|
@ -2,7 +2,16 @@
|
|||
<div class="light toc_label">table des matières</div>
|
||||
<ul>
|
||||
<?php foreach ($page->tocItems() as $item): ?>
|
||||
<li><a href="#<?= $item['slug'] ?>"><?= $item['title'] ?></a></li>
|
||||
<li>
|
||||
<a href="#<?= $item['slug'] ?>"><?= $item['title'] ?></a>
|
||||
<?php if (!empty($item['children'])): ?>
|
||||
<ul>
|
||||
<?php foreach ($item['children'] as $child): ?>
|
||||
<li><a href="#<?= $child['slug'] ?>"><?= $child['title'] ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</nav>
|
||||
Loading…
Add table
Add a link
Reference in a new issue