We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6739488 commit 41755dcCopy full SHA for 41755dc
packages/bytemd/src/toc.svelte
@@ -21,13 +21,13 @@
21
22
hast.children
23
.filter((v): v is Element => v.type === 'element')
24
- .forEach((child, index) => {
+ .forEach(({ tagName, children }, index) => {
25
for (let i = 6; i > 0; i--) {
26
- if (child.tagName === 'h' + i) {
+ if (tagName === 'h' + i && children[0]) {
27
minLevel = Math.min(minLevel, i);
28
items.push({
29
level: i,
30
- text: child.children[0].value as string, // TODO:
+ text: children[0].value as string, // TODO: complicated children
31
});
32
33
// console.log(currentBlockIndex, index);
0 commit comments