lock: 'start'
                    });

                    // 更新活动状态
                    tocLinks.forEach(l => l.classList.remove('active'));
                    this.classList.add('active');
                }
            });
        });

        // 滚动时更新当前位置
        function updateActiveLink() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            const windowHeight = window.innerHeight;

            for (let i = headings.length -