From 54b4d88f41312f4897a82cbcb480803de84fd2e6 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Tue, 25 Feb 2025 10:34:24 +0000 Subject: [PATCH 1/3] Also include `sectionanchor` --- components/src/assets/asciidoc.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/src/assets/asciidoc.css b/components/src/assets/asciidoc.css index 4fe9c5c1..d2a42b30 100644 --- a/components/src/assets/asciidoc.css +++ b/components/src/assets/asciidoc.css @@ -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; From 713264f81c9f4f081eeaa2283bb75edb534221f3 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Tue, 25 Feb 2025 10:49:37 +0000 Subject: [PATCH 2/3] Try stripping links from code items in outline --- components/src/asciidoc/TableOfContents.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/src/asciidoc/TableOfContents.tsx b/components/src/asciidoc/TableOfContents.tsx index 30516c8e..de68e102 100644 --- a/components/src/asciidoc/TableOfContents.tsx +++ b/components/src/asciidoc/TableOfContents.tsx @@ -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, @@ -283,7 +285,7 @@ export const DesktopOutline = ({ paddingLeft: `${0.5 + item.level * 0.5}rem`, }} > - + {parse(stripAnchors(item.title))} {item.sections && renderToc(item.sections)} From 93b0949bf6cd654862f6781cb74b3f715b48b9e2 Mon Sep 17 00:00:00 2001 From: Benjamin Leonard Date: Tue, 25 Feb 2025 10:58:05 +0000 Subject: [PATCH 3/3] Also strip on small screen outline --- components/src/asciidoc/TableOfContents.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/src/asciidoc/TableOfContents.tsx b/components/src/asciidoc/TableOfContents.tsx index de68e102..d0b729a3 100644 --- a/components/src/asciidoc/TableOfContents.tsx +++ b/components/src/asciidoc/TableOfContents.tsx @@ -330,7 +330,7 @@ export const SmallScreenOutline = ({ paddingLeft: `${0.5 + item.level * 0.5}rem`, }} > - + {parse(stripAnchors(item.title))} {item.sections && renderToc(item.sections)}