Finish SSH apps post
This commit is contained in:
parent
402698e9ca
commit
4043a2dad9
132 changed files with 168 additions and 134 deletions
|
|
@ -21,16 +21,19 @@ const nestedHeadings = headings.reduce((acc, heading) => {
|
|||
let nextParent: NestedHeading = acc[acc.length - 1];
|
||||
while (nextParent.depth < heading.depth) {
|
||||
parent = nextParent;
|
||||
if (!nextParent.children) {
|
||||
nextParent.children = [];
|
||||
if (!parent.children) {
|
||||
break;
|
||||
}
|
||||
nextParent = nextParent.children[nextParent.children.length - 1];
|
||||
nextParent = parent.children[parent.children.length - 1];
|
||||
}
|
||||
if (parent === null) {
|
||||
acc.push({ ...heading });
|
||||
} else {
|
||||
parent.children!.push({ ...heading });
|
||||
if (parent.children) {
|
||||
parent.children.push({ ...heading });
|
||||
} else {
|
||||
parent.children = [{ ...heading }];
|
||||
}
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const { slug, text, children } = Astro.props;
|
|||
<li>
|
||||
<a href={`#${slug}`}>{text}</a>
|
||||
{
|
||||
children ? (
|
||||
children?.length ? (
|
||||
<ul>
|
||||
{children.map((child) => (
|
||||
<Astro.self {...child} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue