Browse Source

Backport PR #12027: fix run cells breaking on non-header markdown cells (#12405)

Co-authored-by: Andrew Fulton <andrewfulton9@gmail.com>
MeeseeksMachine 3 years ago
parent
commit
161614cc12
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packages/toc-extension/src/index.ts

+ 5 - 1
packages/toc-extension/src/index.ts

@@ -109,7 +109,11 @@ async function activateTOC(
         let level = activeCell.headingInfo.level;
         for (let i = cells.indexOf(activeCell) + 1; i < cells.length; i++) {
           const cell = cells[i];
-          if (cell instanceof MarkdownCell && cell.headingInfo.level <= level) {
+          if (
+            cell instanceof MarkdownCell &&
+            cell.headingInfo.level <= level &&
+            cell.headingInfo.level > -1
+          ) {
             break;
           }
           if (cell instanceof CodeCell) {