fix(nx-dev): toc should only include headings from the article body
This commit is contained in:
parent
178e6ef3c7
commit
4dbc3c7156
@ -100,7 +100,7 @@ export function BlogDetails({ post, allPosts }: BlogDetailsProps) {
|
||||
</div>
|
||||
|
||||
{/* Main grid layout */}
|
||||
<div className="mx-auto max-w-7xl px-4 lg:px-8">
|
||||
<div className="mx-auto max-w-7xl px-4 lg:px-8" data-content-area>
|
||||
<div className="relative isolate grid grid-cols-1 gap-8 xl:grid-cols-[200px_minmax(0,1fr)_200px]">
|
||||
<div className="hidden min-h-full xl:block">
|
||||
{post.metrics && (
|
||||
|
||||
@ -18,8 +18,8 @@ export function TableOfContents({
|
||||
const [headings, setHeadings] = useState<TocItem[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
// Find the main content wrapper where markdown content is rendered
|
||||
const content = document.querySelector('[data-document="main"]');
|
||||
// Find the content area where markdown content is rendered
|
||||
const content = document.querySelector('[data-content-area]');
|
||||
if (!content) return;
|
||||
|
||||
// Get all headings h1-h6 within the content
|
||||
@ -42,7 +42,7 @@ export function TableOfContents({
|
||||
}, [maxDepth]);
|
||||
|
||||
if (headings.length === 0) {
|
||||
return null;
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user