Browse Source

Final edits and a numbering bug fix

Markelle Kelly 6 years ago
parent
commit
5b87b32150

+ 0 - 4
packages/toc/src/generators/notebookgenerator/index.ts

@@ -7,8 +7,6 @@ import { CodeCell, CodeCellModel, MarkdownCell, Cell } from '@jupyterlab/cells';
 
 import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook';
 
-//import { IOutputModel } from '@jupyterlab/rendermime';
-
 import { notebookItemRenderer } from './itemrenderer';
 
 import { notebookGeneratorToolbar } from './toolbargenerator';
@@ -89,7 +87,6 @@ export function createNotebookGenerator(
             let renderedHeading = Private.getCodeCells(
               text,
               onClickFactory,
-              numberingDict,
               executionCount,
               lastLevel,
               cell
@@ -368,7 +365,6 @@ namespace Private {
   export function getCodeCells(
     text: string,
     onClickFactory: (line: number) => (() => void),
-    numberingDict: { [level: number]: number },
     executionCount: string,
     lastLevel: number,
     cellRef: Cell

+ 6 - 2
packages/toc/src/generators/shared.ts

@@ -16,8 +16,12 @@ export interface INumberedHeading extends IHeading {
  * update the dictionary.
  */
 function incrementNumberingDict(dict: any, level: number) {
-  if (dict[level + 1] != undefined) {
-    dict[level + 1] = undefined;
+  let x = level + 1;
+  while (x <= 6) {
+    if (dict[x] != undefined) {
+      dict[x] = undefined;
+    }
+    x++;
   }
   if (dict[level] === undefined) {
     dict[level] = 1;