Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions components/src/asciidoc/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
* Copyright Oxide Computer Company
*/
import { DirectionRightIcon } from '@/icons/react'
import type { DocumentSection } from '@oxide/react-asciidoc'
import { type DocumentSection, parse } from '@oxide/react-asciidoc'
import * as Accordion from '@radix-ui/react-accordion'
import cn from 'classnames'
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react'

import { stripAnchors } from './Section'

export function useIntersectionObserver(
elements: Element[],
callback: IntersectionObserverCallback,
Expand Down Expand Up @@ -283,7 +285,7 @@ export const DesktopOutline = ({
paddingLeft: `${0.5 + item.level * 0.5}rem`,
}}
>
<span dangerouslySetInnerHTML={{ __html: item.title }} />
{parse(stripAnchors(item.title))}
</a>
</li>
{item.sections && renderToc(item.sections)}
Expand Down Expand Up @@ -328,7 +330,7 @@ export const SmallScreenOutline = ({
paddingLeft: `${0.5 + item.level * 0.5}rem`,
}}
>
<span dangerouslySetInnerHTML={{ __html: item.title }} />
{parse(stripAnchors(item.title))}
</a>
</li>
{item.sections && renderToc(item.sections)}
Expand Down
3 changes: 2 additions & 1 deletion components/src/assets/asciidoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
@apply mb-2 mt-8 text-sans-lg text-raise;
}

.anchor {
.anchor,
.sectionanchor {
position: absolute;
margin-top: calc(var(--header-height) * -1 - 20px);
visibility: hidden;
Expand Down
Loading