2023-08-05 17:32:29 -04:00
|
|
|
export const layout = "./base.tsx";
|
|
|
|
|
2023-12-03 13:11:01 -05:00
|
|
|
export default function({ children, toc, footnotes }) {
|
2023-08-05 17:32:29 -04:00
|
|
|
return (
|
2023-12-03 10:57:42 -05:00
|
|
|
<>
|
|
|
|
{ toc.length > 0 &&
|
2023-12-03 11:18:36 -05:00
|
|
|
<nav className="toc">
|
2023-12-03 10:57:42 -05:00
|
|
|
<h2>Table of Contents</h2>
|
|
|
|
<ol>
|
2023-12-11 19:19:55 -05:00
|
|
|
{toc.map((item,index) => (
|
|
|
|
<li key={index}>
|
2023-12-03 10:57:42 -05:00
|
|
|
<a href={`#${item.slug}`}>{item.text}</a>
|
|
|
|
{item.children.length > 0 &&
|
|
|
|
<ul>
|
2023-12-11 19:19:55 -05:00
|
|
|
{item.children.map((child,i) => (
|
|
|
|
<li key={i}>
|
2023-12-03 10:57:42 -05:00
|
|
|
<a href={`#${child.slug}`}>{child.text}</a>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
}
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ol>
|
|
|
|
</nav>
|
|
|
|
}
|
|
|
|
<article>
|
|
|
|
{ children }
|
|
|
|
</article>
|
2023-12-03 13:11:01 -05:00
|
|
|
{ footnotes.length > 0 &&
|
|
|
|
<ol className="footnotes">
|
|
|
|
{footnotes.map(note => (
|
|
|
|
<li id={note.id}>
|
|
|
|
<span dangerouslySetInnerHTML={{ __html: note.content }} className="footnote-content"/>
|
|
|
|
<a href={`#${note.refId}`} className="footnote-backref">↩</a>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ol>
|
|
|
|
}
|
2023-12-03 10:57:42 -05:00
|
|
|
</>
|
2023-08-05 17:32:29 -04:00
|
|
|
);
|
|
|
|
}
|