浏览代码

Add TODO item

kgryte 5 年之前
父节点
当前提交
5dafe48a9b
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      packages/toc/src/generators/notebook/append_heading.ts

+ 2 - 0
packages/toc/src/generators/notebook/append_heading.ts

@@ -23,9 +23,11 @@ function appendHeading(
   tags: string[]
 ): [INotebookHeading[], INotebookHeading | null] {
   if (heading && !isHeadingFiltered(heading, tags) && heading.text) {
+    // Determine whether this heading is a child of a "header" notebook heading...
     if (prev && prev.type === 'header') {
       for (let j = headings.length - 1; j >= 0; j--) {
         if (headings[j] === prev) {
+          // TODO: can a heading be the child of multiple headings? If not, we can `break` here upon finding a parent heading, so we don't traverse the entire heading list...
           headings[j].hasChild = true;
         }
       }