diff --git a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx index a06b392a..1c8f1b19 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx @@ -34,6 +34,7 @@ import { PublishedPollBlock } from "./Blocks/PublishedPollBlock"; import { PollData } from "./fetchPollData"; import { ButtonPrimary } from "components/Buttons"; import { blockTextSize } from "src/utils/blockTextSize"; +import { slugify } from "src/utils/slugify"; import { PostNotAvailable } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; export function PostContent({ @@ -391,68 +392,48 @@ export let Block = ({ ); case PubLeafletBlocksHeader.isMain(b.block): { + let slug = slugify(b.block.plaintext); + let headingProps = { + ...blockProps, + id: preview ? undefined : slug || blockProps.id, + }; + let textBlockProps = { + ...b.block, + index, + preview, + pageId, + footnoteIndexMap, + }; + let href = pageId ? `?page=${pageId}#${slug}` : `#${slug}`; + let link = (children: React.ReactNode) => + preview || !slug ? ( + children + ) : ( + + {children} + + ); if (b.block.level === 1) return ( -