export function handleSmoothScrollToTitle(targetId: string): void { const targetElement = document.querySelector(`#${targetId}`); if (!targetElement) return; targetElement.scrollIntoView({ behavior: 'smooth' }); } export function injectIdToNativeTitles(): void { const titles = document.querySelectorAll('.content-area h2, .content-area h3'); titles.forEach((title) => { const titleText = title.textContent || ''; const slug = titleText .toLowerCase() .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') .replace(/\s+/g, '-') .replace(/[^\w-]+/g, ''); title.setAttribute('id', slug); }); }