@jupyterlab/toc 5.4.1 → 6.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/lib/factory.d.ts +42 -0
  2. package/lib/factory.js +73 -0
  3. package/lib/factory.js.map +1 -0
  4. package/lib/index.d.ts +9 -4
  5. package/lib/index.js +10 -5
  6. package/lib/index.js.map +1 -1
  7. package/lib/model.d.ts +117 -0
  8. package/lib/model.js +218 -0
  9. package/lib/model.js.map +1 -0
  10. package/lib/panel.d.ts +26 -0
  11. package/lib/panel.js +89 -0
  12. package/lib/panel.js.map +1 -0
  13. package/lib/registry.d.ts +11 -119
  14. package/lib/registry.js +17 -32
  15. package/lib/registry.js.map +1 -1
  16. package/lib/tocitem.d.ts +34 -0
  17. package/lib/tocitem.js +34 -0
  18. package/lib/tocitem.js.map +1 -0
  19. package/lib/toctree.d.ts +40 -0
  20. package/lib/toctree.js +43 -0
  21. package/lib/toctree.js.map +1 -0
  22. package/lib/tokens.d.ts +228 -0
  23. package/lib/tokens.js +29 -0
  24. package/lib/tokens.js.map +1 -0
  25. package/lib/tracker.d.ts +26 -0
  26. package/lib/tracker.js +33 -0
  27. package/lib/tracker.js.map +1 -0
  28. package/lib/treeview.d.ts +20 -0
  29. package/lib/treeview.js +35 -0
  30. package/lib/treeview.js.map +1 -0
  31. package/lib/utils/common.d.ts +65 -0
  32. package/lib/utils/common.js +158 -0
  33. package/lib/utils/common.js.map +1 -0
  34. package/lib/utils/index.d.ts +2 -0
  35. package/lib/utils/{numbering_dictionary.js → index.js} +3 -2
  36. package/lib/utils/index.js.map +1 -0
  37. package/lib/utils/markdown.d.ts +46 -0
  38. package/lib/utils/markdown.js +200 -0
  39. package/lib/utils/markdown.js.map +1 -0
  40. package/package.json +17 -24
  41. package/style/base.css +45 -383
  42. package/style/index.css +0 -5
  43. package/style/index.js +0 -5
  44. package/lib/generators/index.d.ts +0 -4
  45. package/lib/generators/index.js +0 -8
  46. package/lib/generators/index.js.map +0 -1
  47. package/lib/generators/latex/index.d.ts +0 -15
  48. package/lib/generators/latex/index.js +0 -111
  49. package/lib/generators/latex/index.js.map +0 -1
  50. package/lib/generators/markdown/get_headings.d.ts +0 -25
  51. package/lib/generators/markdown/get_headings.js +0 -51
  52. package/lib/generators/markdown/get_headings.js.map +0 -1
  53. package/lib/generators/markdown/get_rendered_headings.d.ts +0 -19
  54. package/lib/generators/markdown/get_rendered_headings.js +0 -68
  55. package/lib/generators/markdown/get_rendered_headings.js.map +0 -1
  56. package/lib/generators/markdown/index.d.ts +0 -34
  57. package/lib/generators/markdown/index.js +0 -176
  58. package/lib/generators/markdown/index.js.map +0 -1
  59. package/lib/generators/markdown/options_manager.d.ts +0 -74
  60. package/lib/generators/markdown/options_manager.js +0 -65
  61. package/lib/generators/markdown/options_manager.js.map +0 -1
  62. package/lib/generators/markdown/render.d.ts +0 -16
  63. package/lib/generators/markdown/render.js +0 -34
  64. package/lib/generators/markdown/render.js.map +0 -1
  65. package/lib/generators/markdown/toolbar_generator.d.ts +0 -66
  66. package/lib/generators/markdown/toolbar_generator.js +0 -49
  67. package/lib/generators/markdown/toolbar_generator.js.map +0 -1
  68. package/lib/generators/notebook/append_collapsible_heading.d.ts +0 -19
  69. package/lib/generators/notebook/append_collapsible_heading.js +0 -63
  70. package/lib/generators/notebook/append_collapsible_heading.js.map +0 -1
  71. package/lib/generators/notebook/append_heading.d.ts +0 -13
  72. package/lib/generators/notebook/append_heading.js +0 -33
  73. package/lib/generators/notebook/append_heading.js.map +0 -1
  74. package/lib/generators/notebook/append_markdown_heading.d.ts +0 -20
  75. package/lib/generators/notebook/append_markdown_heading.js +0 -33
  76. package/lib/generators/notebook/append_markdown_heading.js.map +0 -1
  77. package/lib/generators/notebook/codemirror.d.ts +0 -57
  78. package/lib/generators/notebook/codemirror.js +0 -46
  79. package/lib/generators/notebook/codemirror.js.map +0 -1
  80. package/lib/generators/notebook/get_code_cell_heading.d.ts +0 -27
  81. package/lib/generators/notebook/get_code_cell_heading.js +0 -48
  82. package/lib/generators/notebook/get_code_cell_heading.js.map +0 -1
  83. package/lib/generators/notebook/get_last_heading_level.d.ts +0 -13
  84. package/lib/generators/notebook/get_last_heading_level.js +0 -26
  85. package/lib/generators/notebook/get_last_heading_level.js.map +0 -1
  86. package/lib/generators/notebook/get_markdown_heading.d.ts +0 -27
  87. package/lib/generators/notebook/get_markdown_heading.js +0 -60
  88. package/lib/generators/notebook/get_markdown_heading.js.map +0 -1
  89. package/lib/generators/notebook/get_rendered_html_heading.d.ts +0 -31
  90. package/lib/generators/notebook/get_rendered_html_heading.js +0 -83
  91. package/lib/generators/notebook/get_rendered_html_heading.js.map +0 -1
  92. package/lib/generators/notebook/index.d.ts +0 -17
  93. package/lib/generators/notebook/index.js +0 -225
  94. package/lib/generators/notebook/index.js.map +0 -1
  95. package/lib/generators/notebook/is_heading_filtered.d.ts +0 -14
  96. package/lib/generators/notebook/is_heading_filtered.js +0 -35
  97. package/lib/generators/notebook/is_heading_filtered.js.map +0 -1
  98. package/lib/generators/notebook/options_manager.d.ts +0 -163
  99. package/lib/generators/notebook/options_manager.js +0 -210
  100. package/lib/generators/notebook/options_manager.js.map +0 -1
  101. package/lib/generators/notebook/render.d.ts +0 -15
  102. package/lib/generators/notebook/render.js +0 -161
  103. package/lib/generators/notebook/render.js.map +0 -1
  104. package/lib/generators/notebook/tagstool/index.d.ts +0 -111
  105. package/lib/generators/notebook/tagstool/index.js +0 -189
  106. package/lib/generators/notebook/tagstool/index.js.map +0 -1
  107. package/lib/generators/notebook/tagstool/tag.d.ts +0 -47
  108. package/lib/generators/notebook/tagstool/tag.js +0 -34
  109. package/lib/generators/notebook/tagstool/tag.js.map +0 -1
  110. package/lib/generators/notebook/tagstool/tag_list.d.ts +0 -70
  111. package/lib/generators/notebook/tagstool/tag_list.js +0 -70
  112. package/lib/generators/notebook/tagstool/tag_list.js.map +0 -1
  113. package/lib/generators/notebook/toolbar_generator.d.ts +0 -112
  114. package/lib/generators/notebook/toolbar_generator.js +0 -151
  115. package/lib/generators/notebook/toolbar_generator.js.map +0 -1
  116. package/lib/generators/python/index.d.ts +0 -15
  117. package/lib/generators/python/index.js +0 -91
  118. package/lib/generators/python/index.js.map +0 -1
  119. package/lib/generators/python/render.d.ts +0 -14
  120. package/lib/generators/python/render.js +0 -25
  121. package/lib/generators/python/render.js.map +0 -1
  122. package/lib/toc.d.ts +0 -100
  123. package/lib/toc.js +0 -163
  124. package/lib/toc.js.map +0 -1
  125. package/lib/toc_item.d.ts +0 -55
  126. package/lib/toc_item.js +0 -41
  127. package/lib/toc_item.js.map +0 -1
  128. package/lib/toc_tree.d.ts +0 -61
  129. package/lib/toc_tree.js +0 -31
  130. package/lib/toc_tree.js.map +0 -1
  131. package/lib/utils/generate_numbering.d.ts +0 -14
  132. package/lib/utils/generate_numbering.js +0 -57
  133. package/lib/utils/generate_numbering.js.map +0 -1
  134. package/lib/utils/headings.d.ts +0 -93
  135. package/lib/utils/headings.js +0 -30
  136. package/lib/utils/headings.js.map +0 -1
  137. package/lib/utils/is_dom.d.ts +0 -20
  138. package/lib/utils/is_dom.js +0 -25
  139. package/lib/utils/is_dom.js.map +0 -1
  140. package/lib/utils/is_markdown.d.ts +0 -20
  141. package/lib/utils/is_markdown.js +0 -28
  142. package/lib/utils/is_markdown.js.map +0 -1
  143. package/lib/utils/numbering_dictionary.d.ts +0 -15
  144. package/lib/utils/numbering_dictionary.js.map +0 -1
  145. package/lib/utils/parse_heading.d.ts +0 -75
  146. package/lib/utils/parse_heading.js +0 -91
  147. package/lib/utils/parse_heading.js.map +0 -1
  148. package/lib/utils/sanitizer_options.d.ts +0 -23
  149. package/lib/utils/sanitizer_options.js +0 -45
  150. package/lib/utils/sanitizer_options.js.map +0 -1
package/lib/toc_item.js DELETED
@@ -1,41 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import * as React from 'react';
4
- /**
5
- * React component for a table of contents entry.
6
- *
7
- * @private
8
- */
9
- class TOCItem extends React.Component {
10
- /**
11
- * Renders a table of contents entry.
12
- *
13
- * @returns rendered entry
14
- */
15
- render() {
16
- const { heading, toc } = this.props;
17
- // Create an onClick handler for the TOC item
18
- // that scrolls the anchor into view.
19
- const onClick = (event) => {
20
- var _a;
21
- event.preventDefault();
22
- event.stopPropagation();
23
- (_a = this.props.entryClicked) === null || _a === void 0 ? void 0 : _a.emit(this);
24
- heading.onClick();
25
- };
26
- let content = this.props.itemRenderer(heading, toc);
27
- if (!content) {
28
- return null;
29
- }
30
- return (React.createElement("li", { className: "jp-tocItem", onClick: onClick, onContextMenu: (event) => {
31
- var _a;
32
- (_a = this.props.entryClicked) === null || _a === void 0 ? void 0 : _a.emit(this);
33
- heading.onClick();
34
- } }, content));
35
- }
36
- }
37
- /**
38
- * Exports.
39
- */
40
- export { TOCItem };
41
- //# sourceMappingURL=toc_item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toc_item.js","sourceRoot":"","sources":["../src/toc_item.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0C/B;;;;GAIG;AACH,MAAM,OAAQ,SAAQ,KAAK,CAAC,SAA8B;IACxD;;;;OAIG;IACH,MAAM;QACJ,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEpC,6CAA6C;QAC7C,qCAAqC;QACrC,MAAM,OAAO,GAAG,CAAC,KAA4C,EAAE,EAAE;;YAC/D,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,MAAA,IAAI,CAAC,KAAK,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,EAAE;YACpC,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,CAAC;QAEF,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,IAAI,CAAC;SACb;QACD,OAAO,CACL,4BACE,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,CAAC,KAA4C,EAAE,EAAE;;gBAC9D,MAAA,IAAI,CAAC,KAAK,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,EAAE;gBACpC,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,CAAC,IAEA,OAAO,CACL,CACN,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/lib/toc_tree.d.ts DELETED
@@ -1,61 +0,0 @@
1
- import * as React from 'react';
2
- import { Widget } from '@lumino/widgets';
3
- import { IHeading } from './utils/headings';
4
- import { TableOfContentsRegistry as Registry } from './registry';
5
- import { TOCItem } from './toc_item';
6
- import { Signal } from '@lumino/signaling';
7
- import { TableOfContents } from './toc';
8
- /**
9
- * Interface describing component properties.
10
- *
11
- * @private
12
- */
13
- interface IProperties extends React.Props<TOCTree> {
14
- /**
15
- * Display title.
16
- */
17
- title: string;
18
- /**
19
- * List of headings to render.
20
- */
21
- toc: IHeading[];
22
- /**
23
- * Toolbar.
24
- */
25
- toolbar: any;
26
- entryClicked?: Signal<TableOfContents, TOCItem>;
27
- /**
28
- * Table of contents generator.
29
- */
30
- generator: Registry.IGenerator<Widget> | null;
31
- /**
32
- * Renders a heading item.
33
- *
34
- * @param item - heading
35
- * @param toc - list of headings in toc to use for rendering current position
36
- * @returns rendered heading
37
- */
38
- itemRenderer: (item: IHeading, toc: IHeading[]) => JSX.Element | null;
39
- }
40
- /**
41
- * Interface describing component state.
42
- *
43
- * @private
44
- */
45
- interface IState {
46
- }
47
- /**
48
- * React component for a table of contents tree.
49
- *
50
- * @private
51
- */
52
- declare class TOCTree extends React.Component<IProperties, IState> {
53
- /**
54
- * Renders a table of contents tree.
55
- */
56
- render(): JSX.Element;
57
- }
58
- /**
59
- * Exports.
60
- */
61
- export { TOCTree };
package/lib/toc_tree.js DELETED
@@ -1,31 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import * as React from 'react';
4
- import { TOCItem } from './toc_item';
5
- /**
6
- * React component for a table of contents tree.
7
- *
8
- * @private
9
- */
10
- class TOCTree extends React.Component {
11
- /**
12
- * Renders a table of contents tree.
13
- */
14
- render() {
15
- const Toolbar = this.props.toolbar;
16
- // Map the heading objects onto a list of JSX elements...
17
- let i = 0;
18
- let list = this.props.toc.map(el => {
19
- return (React.createElement(TOCItem, { heading: el, toc: this.props.toc, entryClicked: this.props.entryClicked, itemRenderer: this.props.itemRenderer, key: `${el.text}-${el.level}-${i++}` }));
20
- });
21
- return (React.createElement("div", { className: "jp-TableOfContents" },
22
- React.createElement("div", { className: "jp-stack-panel-header" }, this.props.title),
23
- Toolbar && React.createElement(Toolbar, null),
24
- React.createElement("ul", { className: "jp-TableOfContents-content" }, list)));
25
- }
26
- }
27
- /**
28
- * Exports.
29
- */
30
- export { TOCTree };
31
- //# sourceMappingURL=toc_tree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toc_tree.js","sourceRoot":"","sources":["../src/toc_tree.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAiDrC;;;;GAIG;AACH,MAAM,OAAQ,SAAQ,KAAK,CAAC,SAA8B;IACxD;;OAEG;IACH,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAEnC,yDAAyD;QACzD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAI,IAAI,GAAkB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAChD,OAAO,CACL,oBAAC,OAAO,IACN,OAAO,EAAE,EAAE,EACX,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EACnB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,EAAE,EAAE,GACpC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,CACL,6BAAK,SAAS,EAAC,oBAAoB;YACjC,6BAAK,SAAS,EAAC,uBAAuB,IAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAO;YAC9D,OAAO,IAAI,oBAAC,OAAO,OAAG;YACvB,4BAAI,SAAS,EAAC,4BAA4B,IAAE,IAAI,CAAM,CAClD,CACP,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,14 +0,0 @@
1
- import { INumberingDictionary } from './numbering_dictionary';
2
- /**
3
- * Generate the current numbering based on a provided numbering dictionary and the current level.
4
- *
5
- * @private
6
- * @param dict - numbering dictionary
7
- * @param level - current level
8
- * @returns numbering
9
- */
10
- declare function generateNumbering(dict: INumberingDictionary, level: number): string | undefined;
11
- /**
12
- * Exports.
13
- */
14
- export { generateNumbering };
@@ -1,57 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- // Maximum heading level:
4
- const MAX_HEADING_LEVEL = 6;
5
- /**
6
- * Updates numbering dictionary levels.
7
- *
8
- * ## Notes
9
- *
10
- * - Mutates a provided dictionary.
11
- *
12
- * @private
13
- * @param dict - numbering dictionary
14
- * @param level - current level
15
- * @returns input dictionary
16
- */
17
- function update(dict, level) {
18
- for (let l = level + 1; l <= MAX_HEADING_LEVEL; l++) {
19
- if (dict[l] !== void 0) {
20
- dict[l] = void 0;
21
- }
22
- }
23
- if (dict[level] === void 0) {
24
- dict[level] = 1;
25
- }
26
- else {
27
- dict[level] += 1;
28
- }
29
- return dict;
30
- }
31
- /**
32
- * Generate the current numbering based on a provided numbering dictionary and the current level.
33
- *
34
- * @private
35
- * @param dict - numbering dictionary
36
- * @param level - current level
37
- * @returns numbering
38
- */
39
- function generateNumbering(dict, level) {
40
- if (dict === null) {
41
- return;
42
- }
43
- let numbering = '';
44
- dict = update(dict, level);
45
- if (level >= 1) {
46
- for (let j = 1; j <= level; j++) {
47
- numbering += (dict[j] === void 0 ? '0' : dict[j]) + '.';
48
- }
49
- numbering += ' ';
50
- }
51
- return numbering;
52
- }
53
- /**
54
- * Exports.
55
- */
56
- export { generateNumbering };
57
- //# sourceMappingURL=generate_numbering.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate_numbering.js","sourceRoot":"","sources":["../../src/utils/generate_numbering.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAI3D,yBAAyB;AACzB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;;;;;;;;;GAWG;AACH,SAAS,MAAM,CAAC,IAAS,EAAE,KAAa;IACtC,KAAK,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAiB,EAAE,CAAC,EAAE,EAAE;QACnD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;SAClB;KACF;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACjB;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CACxB,IAA0B,EAC1B,KAAa;IAEb,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO;KACR;IACD,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3B,IAAI,KAAK,IAAI,CAAC,EAAE;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE;YAC/B,SAAS,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;SACzD;QACD,SAAS,IAAI,GAAG,CAAC;KAClB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,93 +0,0 @@
1
- import { Cell } from '@jupyterlab/cells';
2
- /**
3
- * Interface describing a heading.
4
- */
5
- export interface IHeading {
6
- /**
7
- * Heading text.
8
- */
9
- text: string;
10
- /**
11
- * HTML heading level.
12
- */
13
- level: number;
14
- /**
15
- * Callback invoked upon clicking a ToC item.
16
- *
17
- * ## Notes
18
- *
19
- * - This will typically be used to scroll the parent widget to this item.
20
- */
21
- onClick: () => void;
22
- /**
23
- * Special HTML markup.
24
- *
25
- * ## Notes
26
- *
27
- * - The HTML string **should** be properly **sanitized**!
28
- * - The HTML string can be used to render Markdown headings which have already been rendered as HTML.
29
- */
30
- html?: string;
31
- }
32
- /**
33
- * Interface describing a numbered heading.
34
- */
35
- export interface INumberedHeading extends IHeading {
36
- /**
37
- * Heading numbering.
38
- */
39
- numbering?: string | null;
40
- }
41
- /**
42
- * Cell running status
43
- */
44
- export declare enum RunningStatus {
45
- /**
46
- * Cell is idle
47
- */
48
- Idle = -1,
49
- /**
50
- * Cell execution is scheduled
51
- */
52
- Scheduled = 0,
53
- /**
54
- * Cell is running
55
- */
56
- Running = 1
57
- }
58
- /**
59
- * Interface describing a notebook cell heading.
60
- */
61
- export interface INotebookHeading extends INumberedHeading {
62
- /**
63
- * Heading type.
64
- */
65
- type: 'header' | 'markdown' | 'code';
66
- /**
67
- * Reference to a notebook cell.
68
- */
69
- cellRef: Cell;
70
- /**
71
- * Heading prompt.
72
- */
73
- prompt?: string;
74
- /**
75
- * Boolean indicating whether a heading has a child node.
76
- */
77
- hasChild?: boolean;
78
- /**
79
- * index of reference cell in the notebook
80
- */
81
- index: number;
82
- /**
83
- * Running status of the cells in the heading
84
- */
85
- isRunning: RunningStatus;
86
- }
87
- /**
88
- * Tests whether a heading is a notebook heading.
89
- *
90
- * @param heading - heading to test
91
- * @returns boolean indicating whether a heading is a notebook heading
92
- */
93
- export declare function isNotebookHeading(heading: any): boolean;
@@ -1,30 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- /**
4
- * Cell running status
5
- */
6
- export var RunningStatus;
7
- (function (RunningStatus) {
8
- /**
9
- * Cell is idle
10
- */
11
- RunningStatus[RunningStatus["Idle"] = -1] = "Idle";
12
- /**
13
- * Cell execution is scheduled
14
- */
15
- RunningStatus[RunningStatus["Scheduled"] = 0] = "Scheduled";
16
- /**
17
- * Cell is running
18
- */
19
- RunningStatus[RunningStatus["Running"] = 1] = "Running";
20
- })(RunningStatus || (RunningStatus = {}));
21
- /**
22
- * Tests whether a heading is a notebook heading.
23
- *
24
- * @param heading - heading to test
25
- * @returns boolean indicating whether a heading is a notebook heading
26
- */
27
- export function isNotebookHeading(heading) {
28
- return heading.type !== undefined && heading.cellRef !== undefined;
29
- }
30
- //# sourceMappingURL=headings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"headings.js","sourceRoot":"","sources":["../../src/utils/headings.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAgD3D;;GAEG;AACH,MAAM,CAAN,IAAY,aAaX;AAbD,WAAY,aAAa;IACvB;;OAEG;IACH,kDAAS,CAAA;IACT;;OAEG;IACH,2DAAa,CAAA;IACb;;OAEG;IACH,uDAAW,CAAA;AACb,CAAC,EAbW,aAAa,KAAb,aAAa,QAaxB;AAqCD;;;;;GAKG;AAEH,MAAM,UAAU,iBAAiB,CAAC,OAAY;IAC5C,OAAO,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC;AACrE,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Returns whether a MIME type corresponds to either HTML or virtual DOM.
3
- *
4
- * @private
5
- * @param mime - MIME type string
6
- * @returns boolean indicating whether a provided MIME type corresponds to either HTML or virtual DOM
7
- *
8
- * @example
9
- * const bool = isDOM('text/html');
10
- * // returns true
11
- *
12
- * @example
13
- * const bool = isDOM('text/plain');
14
- * // returns false
15
- */
16
- declare function isDOM(mime: string): boolean;
17
- /**
18
- * Exports.
19
- */
20
- export { isDOM };
@@ -1,25 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- /**
4
- * Returns whether a MIME type corresponds to either HTML or virtual DOM.
5
- *
6
- * @private
7
- * @param mime - MIME type string
8
- * @returns boolean indicating whether a provided MIME type corresponds to either HTML or virtual DOM
9
- *
10
- * @example
11
- * const bool = isDOM('text/html');
12
- * // returns true
13
- *
14
- * @example
15
- * const bool = isDOM('text/plain');
16
- * // returns false
17
- */
18
- function isDOM(mime) {
19
- return mime === 'application/vdom.v1+json' || mime === 'text/html';
20
- }
21
- /**
22
- * Exports.
23
- */
24
- export { isDOM };
25
- //# sourceMappingURL=is_dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is_dom.js","sourceRoot":"","sources":["../../src/utils/is_dom.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D;;;;;;;;;;;;;;GAcG;AACH,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,KAAK,0BAA0B,IAAI,IAAI,KAAK,WAAW,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Returns whether a MIME type corresponds to a Markdown flavor.
3
- *
4
- * @private
5
- * @param mime - MIME type string
6
- * @returns boolean indicating whether a provided MIME type corresponds to a Markdown flavor
7
- *
8
- * @example
9
- * const bool = isMarkdown('text/markdown');
10
- * // returns true
11
- *
12
- * @example
13
- * const bool = isMarkdown('text/plain');
14
- * // returns false
15
- */
16
- declare function isMarkdown(mime: string): boolean;
17
- /**
18
- * Exports.
19
- */
20
- export { isMarkdown };
@@ -1,28 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- /**
4
- * Returns whether a MIME type corresponds to a Markdown flavor.
5
- *
6
- * @private
7
- * @param mime - MIME type string
8
- * @returns boolean indicating whether a provided MIME type corresponds to a Markdown flavor
9
- *
10
- * @example
11
- * const bool = isMarkdown('text/markdown');
12
- * // returns true
13
- *
14
- * @example
15
- * const bool = isMarkdown('text/plain');
16
- * // returns false
17
- */
18
- function isMarkdown(mime) {
19
- return (mime === 'text/x-ipythongfm' ||
20
- mime === 'text/x-markdown' ||
21
- mime === 'text/x-gfm' ||
22
- mime === 'text/markdown');
23
- }
24
- /**
25
- * Exports.
26
- */
27
- export { isMarkdown };
28
- //# sourceMappingURL=is_markdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is_markdown.js","sourceRoot":"","sources":["../../src/utils/is_markdown.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D;;;;;;;;;;;;;;GAcG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,CACL,IAAI,KAAK,mBAAmB;QAC5B,IAAI,KAAK,iBAAiB;QAC1B,IAAI,KAAK,YAAY;QACrB,IAAI,KAAK,eAAe,CACzB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Interface describing a numbering dictionary.
3
- *
4
- * @private
5
- */
6
- interface INumberingDictionary {
7
- /**
8
- * Level numbering.
9
- */
10
- [level: number]: number;
11
- }
12
- /**
13
- * Exports.
14
- */
15
- export { INumberingDictionary };
@@ -1 +0,0 @@
1
- {"version":3,"file":"numbering_dictionary.js","sourceRoot":"","sources":["../../src/utils/numbering_dictionary.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D"}
@@ -1,75 +0,0 @@
1
- /**
2
- * Interface describing a parsed heading result.
3
- *
4
- * @private
5
- */
6
- interface IHeading {
7
- /**
8
- * Heading text.
9
- */
10
- text: string;
11
- /**
12
- * Heading level.
13
- */
14
- level: number;
15
- /**
16
- * Heading type.
17
- */
18
- type: 'html' | 'markdown' | 'markdown-alt';
19
- }
20
- /**
21
- * Parses a heading, if one exists, from a provided string.
22
- *
23
- * ## Notes
24
- *
25
- * - Heading examples:
26
- *
27
- * - Markdown heading:
28
- *
29
- * ```
30
- * # Foo
31
- * ```
32
- *
33
- * - Markdown heading (alternative style):
34
- *
35
- * ```
36
- * Foo
37
- * ===
38
- * ```
39
- *
40
- * ```
41
- * Foo
42
- * ---
43
- * ```
44
- *
45
- * - HTML heading:
46
- *
47
- * ```
48
- * <h3>Foo</h3>
49
- * ```
50
- *
51
- * @private
52
- * @param str - input text
53
- * @returns heading info
54
- *
55
- * @example
56
- * const out = parseHeading('### Foo\n');
57
- * // returns {'text': 'Foo', 'level': 3, 'type': 'markdown'}
58
- *
59
- * @example
60
- * const out = parseHeading('Foo\n===\n');
61
- * // returns {'text': 'Foo', 'level': 1, 'type': 'markdown-alt'}
62
- *
63
- * @example
64
- * const out = parseHeading('<h4>Foo</h4>\n');
65
- * // returns {'text': 'Foo', 'level': 4, 'type': 'html'}
66
- *
67
- * @example
68
- * const out = parseHeading('Foo');
69
- * // returns null
70
- */
71
- declare function parseHeading(str: string): IHeading | null;
72
- /**
73
- * Exports.
74
- */
75
- export { parseHeading };
@@ -1,91 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- /**
4
- * Parses a heading, if one exists, from a provided string.
5
- *
6
- * ## Notes
7
- *
8
- * - Heading examples:
9
- *
10
- * - Markdown heading:
11
- *
12
- * ```
13
- * # Foo
14
- * ```
15
- *
16
- * - Markdown heading (alternative style):
17
- *
18
- * ```
19
- * Foo
20
- * ===
21
- * ```
22
- *
23
- * ```
24
- * Foo
25
- * ---
26
- * ```
27
- *
28
- * - HTML heading:
29
- *
30
- * ```
31
- * <h3>Foo</h3>
32
- * ```
33
- *
34
- * @private
35
- * @param str - input text
36
- * @returns heading info
37
- *
38
- * @example
39
- * const out = parseHeading('### Foo\n');
40
- * // returns {'text': 'Foo', 'level': 3, 'type': 'markdown'}
41
- *
42
- * @example
43
- * const out = parseHeading('Foo\n===\n');
44
- * // returns {'text': 'Foo', 'level': 1, 'type': 'markdown-alt'}
45
- *
46
- * @example
47
- * const out = parseHeading('<h4>Foo</h4>\n');
48
- * // returns {'text': 'Foo', 'level': 4, 'type': 'html'}
49
- *
50
- * @example
51
- * const out = parseHeading('Foo');
52
- * // returns null
53
- */
54
- function parseHeading(str) {
55
- const lines = str.split('\n');
56
- // Case: Markdown heading
57
- let match = lines[0].match(/^([#]{1,6}) (.*)/);
58
- if (match) {
59
- return {
60
- text: match[2].replace(/\[(.+)\]\(.+\)/g, '$1'),
61
- level: match[1].length,
62
- type: 'markdown'
63
- };
64
- }
65
- // Case: Markdown heading (alternative style)
66
- if (lines.length > 1) {
67
- match = lines[1].match(/^ {0,3}([=]{2,}|[-]{2,})\s*$/);
68
- if (match) {
69
- return {
70
- text: lines[0].replace(/\[(.+)\]\(.+\)/g, '$1'),
71
- level: match[1][0] === '=' ? 1 : 2,
72
- type: 'markdown-alt'
73
- };
74
- }
75
- }
76
- // Case: HTML heading (WARNING: this is not particularly robust, as HTML headings can span multiple lines)
77
- match = lines[0].match(/<h([1-6]).*>(.*)<\/h\1>/i);
78
- if (match) {
79
- return {
80
- text: match[2],
81
- level: parseInt(match[1], 10),
82
- type: 'html'
83
- };
84
- }
85
- return null;
86
- }
87
- /**
88
- * Exports.
89
- */
90
- export { parseHeading };
91
- //# sourceMappingURL=parse_heading.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse_heading.js","sourceRoot":"","sources":["../../src/utils/parse_heading.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAwB3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9B,yBAAyB;IACzB,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC/C,IAAI,KAAK,EAAE;QACT,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;YAC/C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM;YACtB,IAAI,EAAE,UAAU;SACjB,CAAC;KACH;IACD,6CAA6C;IAC7C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACvD,IAAI,KAAK,EAAE;YACT,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;gBAC/C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,IAAI,EAAE,cAAc;aACrB,CAAC;SACH;KACF;IACD,0GAA0G;IAC1G,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACnD,IAAI,KAAK,EAAE;QACT,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAC7B,IAAI,EAAE,MAAM;SACb,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Allowed HTML tags and associated attributes for ToC entries when sanitizing HTML headings.
3
- *
4
- * ## Notes
5
- *
6
- * - We specifically disallow anchor tags, since we are adding our own.
7
- *
8
- * @private
9
- */
10
- declare const sanitizerOptions: {
11
- allowedTags: string[];
12
- allowedAttributes: {
13
- code: string[];
14
- span: string[];
15
- div: string[];
16
- p: string[];
17
- pre: string[];
18
- };
19
- };
20
- /**
21
- * Exports.
22
- */
23
- export { sanitizerOptions };