fix(nx-dev): update markdoc component to exclude h1 headers
This commit is contained in:
parent
1d9d91110d
commit
d1ee41793f
@ -23,7 +23,7 @@ export function TableOfContents({
|
|||||||
if (!content) return;
|
if (!content) return;
|
||||||
|
|
||||||
// Get all headings h1-h6 within the content
|
// Get all headings h1-h6 within the content
|
||||||
const headingElements = content.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
const headingElements = content.querySelectorAll('h2, h3, h4, h5, h6');
|
||||||
|
|
||||||
const items: TocItem[] = Array.from(headingElements)
|
const items: TocItem[] = Array.from(headingElements)
|
||||||
.map((heading) => {
|
.map((heading) => {
|
||||||
@ -54,7 +54,7 @@ export function TableOfContents({
|
|||||||
{headings.map((heading) => (
|
{headings.map((heading) => (
|
||||||
<li
|
<li
|
||||||
key={heading.id}
|
key={heading.id}
|
||||||
style={{ paddingLeft: `${(heading.level - 1) * 1}rem` }}
|
style={{ paddingLeft: `${(heading.level - 2) * 1}rem` }}
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={`#${heading.id}`}
|
href={`#${heading.id}`}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user