// An id for a heading that aria-labelledby can always point at: lower-case // letters, digits, '-' and '_' only. Anything else, such as a space in a // story id from the content, becomes '-' (BR-SP-72). The caller adds // '-title' where the id belongs to a heading. export function headingId(prefix: string, id: string): string { return `${prefix}-${id}`.toLowerCase().replace(/[^a-z0-9\-_]/g, '-'); }