Skip to content

Commit

Permalink
Fix documentation permalinks (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
silviogutierrez authored Jun 18, 2023
1 parent db5f01c commit 6922107
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions website/client/templates/Documentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ const getAnchor = (children: any) => {
const heading: string = // eslint-disable-line
(children as any)?.[0]?.props?.children?.[0] ?? children?.[0] ?? ""; // eslint-disable-line

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const keepDots: boolean = children?.[0]?.type === "code";
// Brittle and doesn't always work.
// const keepDots: boolean = children?.[0]?.type === "code";
const keepDots: boolean = JSON.stringify(children).includes("code");
const regex = keepDots === true ? /[^.a-zA-Z0-9 ]/g : /[^a-zA-Z0-9 ]/g;
const anchor = heading.toLowerCase().replace(regex, "").replace(/\s+/g, "-");

Expand Down

0 comments on commit 6922107

Please sign in to comment.