{{/* 根据页面内容生成目录 */}}
{{ if and .TableOfContents (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") }}
<nav class="toc-nav">
    {{ .TableOfContents }}
</nav>

<script>
    // 为目录添加平滑滚动和当前位置高亮
    document.addEventListener('DOMContentLoaded', function () {
        const tocLinks = document.querySelectorAll('.toc-nav a');
        const headings = Array.from(tocLinks).map(link => {
            const id = link.getAttribute('href').replace('#', '');
   