Skip to content

Commit

Permalink
docs: fixed Algolia DocSearch crawler results
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed Nov 13, 2023
1 parent b29abc0 commit 988398c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions www/src/components/AutoToc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ function AutoToc({ className, tab = '', addAnchors = true }: IAutoToc) {
};

observer.current = new IntersectionObserver(handleObserver, { rootMargin: '-50px 0px -80% 0px', threshold: 0.5 });
const elements = document.querySelectorAll<HTMLHeadElement>('main h2, main h3, main h4, main h5, main h6');
const elements = document.querySelectorAll<HTMLHeadElement>('main h1, main h2, main h3, main h4, main h5, main h6');
if (addAnchors) {
elements.forEach(el => {
elements.forEach((el, index) => {
if (el.textContent) {
el.classList.add('pgn-doc__heading');
const slug = slugify(el.textContent, { lower: true });
el.id = slug;
const anchor = createAnchor(slug);
el.appendChild(anchor);
if (el.children[index]?.tagName !== 'A') {
const anchor = createAnchor(slug);
el.appendChild(anchor);
}
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/foundations/brand-icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import IconsTable from '../../components/IconsTable';
import PropsTable from '../../components/PropsTable';
import * as IconComponents from '~paragon-icons';

## Brand Icons
# Brand Icons

Displays a brand SVG icon from `@edx/paragon/icons`. See the <Link to="/components/icon">Icon Component</Link> for more information.

Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/foundations/icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IconsTable from '../../components/IconsTable';
import PropsTable from '../../components/PropsTable';
import * as IconComponents from '~paragon-icons';

## Icons
# Icons

Displays an svg icon from `@edx/paragon/icons`. See the <Link to="/components/icon">Icon Component</Link> for more information.

Expand Down

0 comments on commit 988398c

Please sign in to comment.