@quarto/jupyterlab-quarto 0.1.42 → 0.1.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. package/package.json +1 -1
  2. package/lib/__tests__/index.spec.d.ts +0 -6
  3. package/lib/__tests__/index.spec.js +0 -61
  4. package/lib/__tests__/index.spec.js.map +0 -1
  5. package/lib/__tests__/myextension.spec.d.ts +0 -6
  6. package/lib/__tests__/myextension.spec.js +0 -11
  7. package/lib/__tests__/myextension.spec.js.map +0 -1
  8. package/lib/ast/ast.d.ts +0 -3
  9. package/lib/ast/ast.js +0 -39
  10. package/lib/ast/ast.js.map +0 -1
  11. package/lib/const.d.ts +0 -5
  12. package/lib/const.js +0 -12
  13. package/lib/const.js.map +0 -1
  14. package/lib/hooks/codemirror.d.ts +0 -4
  15. package/lib/hooks/codemirror.js +0 -52
  16. package/lib/hooks/codemirror.js.map +0 -1
  17. package/lib/index.d.ts +0 -6
  18. package/lib/index.js +0 -60
  19. package/lib/index.js.map +0 -1
  20. package/lib/manager.d.ts +0 -8
  21. package/lib/manager.js +0 -117
  22. package/lib/manager.js.map +0 -1
  23. package/lib/plugins/callouts.d.ts +0 -3
  24. package/lib/plugins/callouts.js +0 -209
  25. package/lib/plugins/callouts.js.map +0 -1
  26. package/lib/plugins/cites.d.ts +0 -3
  27. package/lib/plugins/cites.js +0 -148
  28. package/lib/plugins/cites.js.map +0 -1
  29. package/lib/plugins/decorator.d.ts +0 -3
  30. package/lib/plugins/decorator.js +0 -59
  31. package/lib/plugins/decorator.js.map +0 -1
  32. package/lib/plugins/divs.d.ts +0 -6
  33. package/lib/plugins/divs.js +0 -100
  34. package/lib/plugins/divs.js.map +0 -1
  35. package/lib/plugins/figure-divs.d.ts +0 -3
  36. package/lib/plugins/figure-divs.js +0 -53
  37. package/lib/plugins/figure-divs.js.map +0 -1
  38. package/lib/plugins/figures.d.ts +0 -17
  39. package/lib/plugins/figures.js +0 -99
  40. package/lib/plugins/figures.js.map +0 -1
  41. package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +0 -8
  42. package/lib/plugins/gridtables/common/gridtables/GetCells.js +0 -45
  43. package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +0 -1
  44. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +0 -8
  45. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +0 -27
  46. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +0 -1
  47. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +0 -8
  48. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +0 -13
  49. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +0 -1
  50. package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +0 -5
  51. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +0 -67
  52. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +0 -1
  53. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +0 -9
  54. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +0 -19
  55. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +0 -1
  56. package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +0 -3
  57. package/lib/plugins/gridtables/common/markdown-it/GetLine.js +0 -10
  58. package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +0 -1
  59. package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +0 -4
  60. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +0 -162
  61. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +0 -1
  62. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +0 -13
  63. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +0 -18
  64. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +0 -1
  65. package/lib/plugins/gridtables/index.d.ts +0 -2
  66. package/lib/plugins/gridtables/index.js +0 -11
  67. package/lib/plugins/gridtables/index.js.map +0 -1
  68. package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +0 -11
  69. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +0 -6
  70. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +0 -1
  71. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +0 -7
  72. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +0 -6
  73. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +0 -1
  74. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +0 -4
  75. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +0 -6
  76. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +0 -1
  77. package/lib/plugins/gridtables/rules/gridtable.d.ts +0 -4
  78. package/lib/plugins/gridtables/rules/gridtable.js +0 -26
  79. package/lib/plugins/gridtables/rules/gridtable.js.map +0 -1
  80. package/lib/plugins/math.d.ts +0 -5
  81. package/lib/plugins/math.js +0 -177
  82. package/lib/plugins/math.js.map +0 -1
  83. package/lib/plugins/mermaid/index.d.ts +0 -5
  84. package/lib/plugins/mermaid/index.js +0 -55
  85. package/lib/plugins/mermaid/index.js.map +0 -1
  86. package/lib/plugins/shortcodes.d.ts +0 -4
  87. package/lib/plugins/shortcodes.js +0 -33
  88. package/lib/plugins/shortcodes.js.map +0 -1
  89. package/lib/plugins/spans.d.ts +0 -3
  90. package/lib/plugins/spans.js +0 -39
  91. package/lib/plugins/spans.js.map +0 -1
  92. package/lib/plugins/table-captions.d.ts +0 -3
  93. package/lib/plugins/table-captions.js +0 -69
  94. package/lib/plugins/table-captions.js.map +0 -1
  95. package/lib/plugins/utils/html.d.ts +0 -12
  96. package/lib/plugins/utils/html.js +0 -46
  97. package/lib/plugins/utils/html.js.map +0 -1
  98. package/lib/plugins/utils/markdownit.d.ts +0 -16
  99. package/lib/plugins/utils/markdownit.js +0 -45
  100. package/lib/plugins/utils/markdownit.js.map +0 -1
  101. package/lib/plugins/utils/tok.d.ts +0 -8
  102. package/lib/plugins/utils/tok.js +0 -14
  103. package/lib/plugins/utils/tok.js.map +0 -1
  104. package/lib/plugins/yaml.d.ts +0 -3
  105. package/lib/plugins/yaml.js +0 -311
  106. package/lib/plugins/yaml.js.map +0 -1
  107. package/lib/providers/attrs.d.ts +0 -2
  108. package/lib/providers/attrs.js +0 -16
  109. package/lib/providers/attrs.js.map +0 -1
  110. package/lib/providers/callouts.d.ts +0 -2
  111. package/lib/providers/callouts.js +0 -16
  112. package/lib/providers/callouts.js.map +0 -1
  113. package/lib/providers/cites.d.ts +0 -2
  114. package/lib/providers/cites.js +0 -16
  115. package/lib/providers/cites.js.map +0 -1
  116. package/lib/providers/decorator.d.ts +0 -2
  117. package/lib/providers/decorator.js +0 -16
  118. package/lib/providers/decorator.js.map +0 -1
  119. package/lib/providers/deflist.d.ts +0 -2
  120. package/lib/providers/deflist.js +0 -16
  121. package/lib/providers/deflist.js.map +0 -1
  122. package/lib/providers/divs.d.ts +0 -2
  123. package/lib/providers/divs.js +0 -28
  124. package/lib/providers/divs.js.map +0 -1
  125. package/lib/providers/figure-divs.d.ts +0 -2
  126. package/lib/providers/figure-divs.js +0 -16
  127. package/lib/providers/figure-divs.js.map +0 -1
  128. package/lib/providers/figures.d.ts +0 -2
  129. package/lib/providers/figures.js +0 -16
  130. package/lib/providers/figures.js.map +0 -1
  131. package/lib/providers/footnotes.d.ts +0 -2
  132. package/lib/providers/footnotes.js +0 -16
  133. package/lib/providers/footnotes.js.map +0 -1
  134. package/lib/providers/gridtables.d.ts +0 -2
  135. package/lib/providers/gridtables.js +0 -16
  136. package/lib/providers/gridtables.js.map +0 -1
  137. package/lib/providers/math.d.ts +0 -2
  138. package/lib/providers/math.js +0 -105
  139. package/lib/providers/math.js.map +0 -1
  140. package/lib/providers/mermaid.d.ts +0 -2
  141. package/lib/providers/mermaid.js +0 -16
  142. package/lib/providers/mermaid.js.map +0 -1
  143. package/lib/providers/provider.d.ts +0 -4
  144. package/lib/providers/provider.js +0 -13
  145. package/lib/providers/provider.js.map +0 -1
  146. package/lib/providers/shortcodes.d.ts +0 -2
  147. package/lib/providers/shortcodes.js +0 -16
  148. package/lib/providers/shortcodes.js.map +0 -1
  149. package/lib/providers/spans.d.ts +0 -2
  150. package/lib/providers/spans.js +0 -16
  151. package/lib/providers/spans.js.map +0 -1
  152. package/lib/providers/sub.d.ts +0 -2
  153. package/lib/providers/sub.js +0 -16
  154. package/lib/providers/sub.js.map +0 -1
  155. package/lib/providers/sup.d.ts +0 -2
  156. package/lib/providers/sup.js +0 -16
  157. package/lib/providers/sup.js.map +0 -1
  158. package/lib/providers/table-captions.d.ts +0 -2
  159. package/lib/providers/table-captions.js +0 -16
  160. package/lib/providers/table-captions.js.map +0 -1
  161. package/lib/providers/tasklists.d.ts +0 -2
  162. package/lib/providers/tasklists.js +0 -16
  163. package/lib/providers/tasklists.js.map +0 -1
  164. package/lib/providers/yaml.d.ts +0 -2
  165. package/lib/providers/yaml.js +0 -16
  166. package/lib/providers/yaml.js.map +0 -1
  167. package/lib/types.d.ts +0 -44
  168. package/lib/types.js +0 -2
  169. package/lib/types.js.map +0 -1
  170. package/lib/utils/html.d.ts +0 -12
  171. package/lib/utils/html.js +0 -46
  172. package/lib/utils/html.js.map +0 -1
  173. package/lib/utils/markdownit.d.ts +0 -16
  174. package/lib/utils/markdownit.js +0 -45
  175. package/lib/utils/markdownit.js.map +0 -1
  176. package/lib/utils/tok.d.ts +0 -8
  177. package/lib/utils/tok.js +0 -14
  178. package/lib/utils/tok.js.map +0 -1
  179. package/lib/widgets.d.ts +0 -15
  180. package/lib/widgets.js +0 -58
  181. package/lib/widgets.js.map +0 -1
@@ -1,17 +0,0 @@
1
- import MarkdownIt from "markdown-it";
2
- import Token from "markdown-it/lib/token";
3
- export interface FigureOptions {
4
- dataType?: boolean;
5
- link?: boolean;
6
- figcaption?: boolean;
7
- copyAttrs?: boolean;
8
- tabindex?: boolean;
9
- lazyLoading?: boolean;
10
- }
11
- export declare const kTokFigureOpen = "figure_open";
12
- export declare const kTokFigureClose = "figure_close";
13
- export declare const kTokFigCaptionOpen = "figcaption_open";
14
- export declare const kTokFigCaptionClose = "figcaption_close";
15
- export declare const mutateToFigureTok: (token: Token, type: "open" | "close") => void;
16
- export declare function figuresPlugin(md: MarkdownIt, options: FigureOptions): void;
17
- //# sourceMappingURL=figures.d.ts.map
@@ -1,99 +0,0 @@
1
- /*
2
- * figures.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
7
- import { kTokParaClose, kTokParaOpen } from "./utils/tok";
8
- export const kTokFigureOpen = "figure_open";
9
- export const kTokFigureClose = "figure_close";
10
- export const kTokFigCaptionOpen = "figcaption_open";
11
- export const kTokFigCaptionClose = "figcaption_close";
12
- export const mutateToFigureTok = (token, type) => {
13
- token.type = type === "open" ? kTokFigureOpen : kTokFigureClose;
14
- token.tag = "figure";
15
- };
16
- export function figuresPlugin(md, options) {
17
- options = options || {};
18
- md.core.ruler.before("linkify", "implicit_figures", (state) => {
19
- // reset tabIndex on md.render()
20
- let tabIndex = 1;
21
- // do not process first and last token
22
- for (let i = 1, l = state.tokens.length; i < l - 1; ++i) {
23
- const token = state.tokens[i];
24
- if (token.type !== "inline") {
25
- continue;
26
- }
27
- // children: image alone, or link_open -> image -> link_close
28
- if (!token.children ||
29
- (token.children.length !== 1 && token.children.length !== 3)) {
30
- continue;
31
- }
32
- // one child, should be img
33
- if (token.children.length === 1 && token.children[0].type !== "image") {
34
- continue;
35
- }
36
- // three children, should be image enclosed in link
37
- if (token.children.length === 3 &&
38
- (token.children[0].type !== "link_open" ||
39
- token.children[1].type !== "image" ||
40
- token.children[2].type !== "link_close")) {
41
- continue;
42
- }
43
- // prev token is paragraph open
44
- if (i !== 0 && state.tokens[i - 1].type !== kTokParaOpen) {
45
- continue;
46
- }
47
- // next token is paragraph close
48
- if (i !== l - 1 && state.tokens[i + 1].type !== kTokParaClose) {
49
- continue;
50
- }
51
- // The image
52
- const image = token.children.length === 1 ? token.children[0] : token.children[1];
53
- // The image must have a caption to count as a figure
54
- if (!image.children || image.children.length === 0) {
55
- continue;
56
- }
57
- // We have inline token containing an image only.
58
- // Previous token is paragraph open.
59
- // Next token is paragraph close.
60
- // Lets replace the paragraph tokens with figure tokens.
61
- const figure = state.tokens[i - 1];
62
- mutateToFigureTok(figure, "open");
63
- mutateToFigureTok(state.tokens[i + 1], "close");
64
- if (options.dataType == true) {
65
- state.tokens[i - 1].attrPush(["data-type", "image"]);
66
- }
67
- if (options.link == true && token.children.length === 1) {
68
- token.children.unshift(new state.Token("link_open", "a", 1));
69
- const src = image.attrGet("src");
70
- if (src !== null) {
71
- token.children[0].attrPush(["href", src]);
72
- }
73
- token.children.push(new state.Token("link_close", "a", -1));
74
- }
75
- if (options.figcaption == true) {
76
- if (image.children && image.children.length) {
77
- token.children.push(new state.Token(kTokFigCaptionOpen, "figcaption", 1));
78
- token.children.splice(token.children.length, 0, ...image.children);
79
- token.children.push(new state.Token(kTokFigCaptionClose, "figcaption", -1));
80
- image.children.length = 0;
81
- }
82
- }
83
- if (options.copyAttrs && image.attrs) {
84
- const f = options.copyAttrs === true ? "" : options.copyAttrs;
85
- figure.attrs = image.attrs.filter(([k]) => k.match(f));
86
- }
87
- if (options.tabindex == true) {
88
- // add a tabindex property
89
- // you could use this with css-tricks.com/expanding-images-html5
90
- state.tokens[i - 1].attrPush(["tabindex", String(tabIndex)]);
91
- tabIndex++;
92
- }
93
- if (options.lazyLoading == true) {
94
- image.attrPush(["loading", "lazy"]);
95
- }
96
- }
97
- });
98
- }
99
- //# sourceMappingURL=figures.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"figures.js","sourceRoot":"","sources":["../../src/plugins/figures.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAW1D,MAAM,CAAC,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AI,CACjB,IAAI,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,CACvD,CAAC;oBACF,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;iBAC3B;aACF;YAED,IAAI,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,EAAE;gBACpC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;gBAC9D,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACxD;YAED,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE;gBAC5B,0BAA0B;gBAC1B,gEAAgE;gBAChE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC7D,QAAQ,EAAE,CAAC;aACZ;YAED,IAAI,OAAO,CAAC,WAAW,IAAI,IAAI,EAAE;gBAC/B,KAAK,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;aACrC;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * getCells parses the lines found for a certain row, and transforms these to
3
- * the separate cell lines.
4
- *
5
- * @param lines The lines for the row.
6
- */
7
- export default function getCells(lines: string[][]): string[][];
8
- //# sourceMappingURL=GetCells.d.ts.map
@@ -1,45 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- /**
6
- * getCells parses the lines found for a certain row, and transforms these to
7
- * the separate cell lines.
8
- *
9
- * @param lines The lines for the row.
10
- */
11
- export default function getCells(lines) {
12
- const cells = [];
13
- for (let i = 0; i < lines[0].length; i++) {
14
- let cell = [];
15
- for (let j = 0; j < lines.length; j++) {
16
- const s = trimEnd(lines[j][i]);
17
- if ((s.length === 0) &&
18
- (cell.length === 0)) {
19
- // skip leading empty lines
20
- continue;
21
- }
22
- cell.push(s);
23
- }
24
- // remove trailing empty lines
25
- let j = cell.length - 1;
26
- for (; j >= 0; j--) {
27
- if (cell[j].length > 0) {
28
- break;
29
- }
30
- }
31
- if (j < cell.length - 1) {
32
- cell = cell.slice(0, j + 1);
33
- }
34
- cells.push(cell);
35
- }
36
- return cells;
37
- }
38
- function trimEnd(s) {
39
- const trimmed = s.trim();
40
- if (trimmed.length === 0) {
41
- return '';
42
- }
43
- return s.slice(0, s.indexOf(trimmed) + trimmed.length);
44
- }
45
- //# sourceMappingURL=GetCells.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetCells.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/gridtables/GetCells.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;;;EAKE;AACF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC5B,KAAiB;IAGjB,MAAM,KAAK,GAAG,EAAE,CAAC;IAEjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EACxC;QACI,IAAI,IAAI,GAAG,EAAE,CAAC;QAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EACrC;YACI,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;gBAChB,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,EACvB;gBACI,2BAA2B;gBAC3B,SAAS;aACZ;YAED,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,8BAA8B;QAC9B,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAClB;YACI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EACtB;gBACI,MAAM;aACT;SACJ;QAED,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EACvB;YACI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/B;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CACZ,CAAS;IAGT,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAEzB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EACxB;QACI,OAAO,EAAE,CAAC;KACb;IAED,OAAO,CAAC,CAAC,KAAK,CACV,CAAC,EACD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * getColumnWidths parses the provided line and returns the associated column widths.
3
- *
4
- * @param line The separator line to parse for the column widths.
5
- * @returns The column widths for the provided line, or an empty array if the line is invalid.
6
- */
7
- export default function getColumnWidths(line: string): number[];
8
- //# sourceMappingURL=GetColumnWidths.d.ts.map
@@ -1,27 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- /**
6
- * getColumnWidths parses the provided line and returns the associated column widths.
7
- *
8
- * @param line The separator line to parse for the column widths.
9
- * @returns The column widths for the provided line, or an empty array if the line is invalid.
10
- */
11
- export default function getColumnWidths(line) {
12
- // try to parse as a row separator line
13
- let columnMatch = line
14
- .substr(1)
15
- .match(/[:-][-]+[:-]\+/g);
16
- if (columnMatch == null) {
17
- // try to parse as a header separator line
18
- columnMatch = line
19
- .substr(1)
20
- .match(/[:=][=]+[:=]\+/g);
21
- }
22
- if (columnMatch == null) {
23
- return [];
24
- }
25
- return columnMatch.map(s => s.length);
26
- }
27
- //# sourceMappingURL=GetColumnWidths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetColumnWidths.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/gridtables/GetColumnWidths.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;;;EAKE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CACnC,IAAY;IAGZ,uCAAuC;IACvC,IAAI,WAAW,GAAG,IAAI;SACjB,MAAM,CAAC,CAAC,CAAC;SACT,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE9B,IAAI,WAAW,IAAI,IAAI,EACvB;QACI,0CAA0C;QAC1C,WAAW,GAAG,IAAI;aACb,MAAM,CAAC,CAAC,CAAC;aACT,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACjC;IAED,IAAI,WAAW,IAAI,IAAI,EACvB;QACI,OAAO,EAAE,CAAC;KACb;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,8 +0,0 @@
1
- declare enum ColumnAlignments {
2
- None = "",
3
- Left = "left",
4
- Center = "center",
5
- Right = "right"
6
- }
7
- export default ColumnAlignments;
8
- //# sourceMappingURL=ColumnAlignments.d.ts.map
@@ -1,13 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- var ColumnAlignments;
6
- (function (ColumnAlignments) {
7
- ColumnAlignments["None"] = "";
8
- ColumnAlignments["Left"] = "left";
9
- ColumnAlignments["Center"] = "center";
10
- ColumnAlignments["Right"] = "right";
11
- })(ColumnAlignments || (ColumnAlignments = {}));
12
- export default ColumnAlignments;
13
- //# sourceMappingURL=ColumnAlignments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColumnAlignments.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ColumnAlignments.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,IAAK,gBAMJ;AAND,WAAK,gBAAgB;IAEjB,6BAAS,CAAA;IACT,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,mCAAe,CAAA;AACnB,CAAC,EANI,gBAAgB,KAAhB,gBAAgB,QAMpB;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,5 +0,0 @@
1
- import * as MarkdownIt from "markdown-it";
2
- import IState from "../../interfaces/markdown-it/IState";
3
- import ParseTableResult from "./ParseTableResult";
4
- export default function emitTable(md: MarkdownIt, state: IState, result: ParseTableResult): void;
5
- //# sourceMappingURL=EmitTable.d.ts.map
@@ -1,67 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- import getCells from "../gridtables/GetCells";
6
- import ColumnAlignments from "./ColumnAlignments";
7
- export default function emitTable(md, state, result) {
8
- let offsets = result.SeparatorLineOffsets;
9
- let token = state.push('table_open', 'table', 1);
10
- token.map = [offsets[0], offsets[offsets.length - 1]];
11
- if (result.HeaderLines.length > 0) {
12
- // emit table header
13
- const token = state.push('thead_open', 'thead', 1);
14
- token.map = [offsets[0], offsets[1]];
15
- const cells = getCells(result.HeaderLines);
16
- processRow(md, state, 'th', result.ColumnAlignments, offsets[0], offsets[1], cells);
17
- state.push('thead_close', 'thead', -1);
18
- offsets = offsets.slice(1);
19
- }
20
- // emit table body
21
- token = state.push('tbody_open', 'tbody', 1);
22
- token.map = [offsets[0], offsets[offsets.length - 1]];
23
- for (let i = 0; i < result.RowLines.length; i++) {
24
- let cells = getCells(result.RowLines[i]);
25
- processRow(md, state, 'td', result.ColumnAlignments, offsets[i], offsets[i + 1], cells);
26
- }
27
- state.push('tbody_close', 'tbody', -1);
28
- state.push('table_close', 'table', -1);
29
- }
30
- function processRow(md, state, tag, columnAlignments, lineBegin, lineEnd, cells) {
31
- let token = state.push('tr_open', 'tr', 1);
32
- token.map = [lineBegin, lineEnd];
33
- for (let i = 0; i < cells.length; i++) {
34
- let token = state.push(tag + '_open', tag, 1);
35
- token.map = [lineBegin + 1, lineEnd - 1];
36
- if (columnAlignments[i] !== ColumnAlignments.None) {
37
- token.attrSet("style", `text-align: ${columnAlignments[i]};`);
38
- }
39
- if (cells[i].length === 0) {
40
- // empty cell
41
- }
42
- else if (cells[i].length === 1) {
43
- // single line cell -> emit as inline markdown
44
- let token = state.push('inline', '', 0);
45
- token.content = cells[i][0].trim();
46
- token.children = [];
47
- }
48
- else {
49
- // multi line cell -> render and emit as html
50
- let cell = md
51
- .render(cells[i].join('\r\n'))
52
- .trim();
53
- // remove single p tag because we're in a table cell
54
- if ((cell.slice(0, 3) === '<p>') &&
55
- (cell.slice(-4) === '</p>') &&
56
- (cell.indexOf('<p>', 3) === -1)) {
57
- cell = cell.slice(3, cell.length - 4);
58
- }
59
- let token = state.push('html_block', '', 0);
60
- token.content = cell;
61
- token.children = [];
62
- }
63
- state.push(tag + '_close', tag, -1);
64
- }
65
- state.push('tr_close', 'tr', -1);
66
- }
67
- //# sourceMappingURL=EmitTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmitTable.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables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EAAE,CAAC;SACvB;QAED,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;KACvC;IAED,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
@@ -1,9 +0,0 @@
1
- import IState from "../../interfaces/markdown-it/IState";
2
- /**
3
- * Returns the char code of the character at the start of the current line,
4
- * or -1 if this is not available (e.g. on an empty line).
5
- *
6
- * @param state The Markdown It state.
7
- */
8
- export default function getCharCodeAtStartOfLine(state: IState, line: number): number;
9
- //# sourceMappingURL=GetCharCodeAtStartOfLine.d.ts.map
@@ -1,19 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- /**
6
- * Returns the char code of the character at the start of the current line,
7
- * or -1 if this is not available (e.g. on an empty line).
8
- *
9
- * @param state The Markdown It state.
10
- */
11
- export default function getCharCodeAtStartOfLine(state, line) {
12
- const pos = state.bMarks[line] +
13
- state.tShift[line];
14
- if (pos >= state.eMarks[line]) {
15
- return -1;
16
- }
17
- return state.src.charCodeAt(pos);
18
- }
19
- //# sourceMappingURL=GetCharCodeAtStartOfLine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetCharCodeAtStartOfLine.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC5C,KAAa,EACb,IAAY;IAGZ,MAAM,GAAG,GACL,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;QAClB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEvB,IAAI,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAC7B;QACI,OAAO,CAAC,CAAC,CAAC;KACb;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC"}
@@ -1,3 +0,0 @@
1
- import IState from "../../interfaces/markdown-it/IState";
2
- export default function getLine(state: IState, line: number): string;
3
- //# sourceMappingURL=GetLine.d.ts.map
@@ -1,10 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- export default function getLine(state, line) {
6
- const start = state.bMarks[line] + state.blkIndent;
7
- const end = state.eMarks[line];
8
- return state.src.substr(start, end - start);
9
- }
10
- //# sourceMappingURL=GetLine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetLine.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/GetLine.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,CAAC,OAAO,UAAU,OAAO,CAC3B,KAAa,EACb,IAAY;IAGZ,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAEnD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CACnB,KAAK,EACL,GAAG,GAAG,KAAK,CAAC,CAAC;AACrB,CAAC"}
@@ -1,4 +0,0 @@
1
- import IState from "../../interfaces/markdown-it/IState";
2
- import ParseTableResult from "./ParseTableResult";
3
- export default function parseTable(state: IState, startLine: number, endLine: number): ParseTableResult;
4
- //# sourceMappingURL=ParseTable.d.ts.map
@@ -1,162 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- import wcwidth from "wcwidth";
6
- import getColumnWidths from "../gridtables/GetColumnWidths";
7
- import ColumnAlignments from "./ColumnAlignments";
8
- import getLine from "./GetLine";
9
- import ParseTableResult from "./ParseTableResult";
10
- export default function parseTable(state, startLine, endLine) {
11
- const result = new ParseTableResult();
12
- let rowLine = getLine(state, startLine);
13
- if (rowLine.charAt(0) !== '+') {
14
- // line does not start with a '+'
15
- return result;
16
- }
17
- result.ColumnWidths = getColumnWidths(rowLine);
18
- if (result.ColumnWidths.length === 0) {
19
- // no columns found
20
- return result;
21
- }
22
- // initialize column alignments
23
- result.ColumnAlignments = result.ColumnWidths
24
- .map(_ => ColumnAlignments.None);
25
- if (rowLine.indexOf(':') >= 0) {
26
- // column alignment specifiers present in first row line
27
- result.HeaderLess = true;
28
- // set column alignments
29
- result.ColumnAlignments = getColumnAlignments(rowLine, result.ColumnWidths);
30
- // remove alignment specifiers for further matching
31
- rowLine = rowLine.replace(/[:]/g, '-');
32
- }
33
- // create header line matcher
34
- const headerLineMatcher = new RegExp('^\\+' +
35
- result.ColumnWidths
36
- .map(w => `[=:][=]{${w - 3}}[=:]\\+`)
37
- .join('') +
38
- '$');
39
- // build column offsets
40
- result.ColumnOffsets = [0];
41
- for (let i = 0; i < result.ColumnWidths.length - 1; i++) {
42
- result.ColumnOffsets.push(result.ColumnOffsets[i] +
43
- result.ColumnWidths[i]);
44
- }
45
- // create cell line matcher
46
- const cellLineMatcher = new RegExp('^\\|' +
47
- result.ColumnWidths
48
- .map(w => `([^|]{${Math.ceil((w - 1) / 2)},${w - 1}})\\|`)
49
- .join('') +
50
- '$');
51
- // save first separator line offset
52
- result.SeparatorLineOffsets.push(startLine);
53
- // continue to scan until a complete table is found, or an invalid line is encountered
54
- let currentRow = [];
55
- let currentLine = startLine + 1;
56
- for (; currentLine <= endLine; currentLine++) {
57
- const line = getLine(state, currentLine);
58
- if (line.charCodeAt(0) === 0x2B) // '+'
59
- {
60
- // separator line
61
- if (currentRow.length === 0) {
62
- // no row lines since last separator -> invalid table
63
- return result;
64
- }
65
- // save separator line offset
66
- result.SeparatorLineOffsets.push(currentLine);
67
- if (line === rowLine) {
68
- // new regular row
69
- result.RowLines.push(currentRow);
70
- if (result.HeaderLines.length === 0) {
71
- result.HeaderLess = true;
72
- }
73
- }
74
- else if (!result.HeaderLess &&
75
- line.match(headerLineMatcher)) {
76
- // found header line
77
- if (result.HeaderLines.length > 0 ||
78
- result.RowLines.length > 0) {
79
- // header already found, or not the first row -> invalid table
80
- return result;
81
- }
82
- // header row
83
- result.HeaderLines = currentRow;
84
- if (line.indexOf(':') >= 0) {
85
- // set column alignments
86
- result.ColumnAlignments = getColumnAlignments(line, result.ColumnWidths);
87
- }
88
- }
89
- else {
90
- // not a header or regular row -> invalid table
91
- return result;
92
- }
93
- // reset current row
94
- currentRow = [];
95
- }
96
- else if (line.charCodeAt(0) === 0x7C) // '|'
97
- {
98
- // cell line
99
- const matches = line.match(cellLineMatcher);
100
- if (matches === null) {
101
- // cell line does not match -> invalid table
102
- return result;
103
- }
104
- const cells = validateColumnWidths(matches, result.ColumnWidths);
105
- if (cells === null) {
106
- // cell line does not match -> invalid table
107
- return result;
108
- }
109
- // add the line to the current row
110
- currentRow.push(cells);
111
- }
112
- else {
113
- // not a separator or cell line, check if we have a complete table
114
- if (currentRow.length === 0 &&
115
- ((result.HeaderLines.length > 0) ||
116
- (result.RowLines.length > 0))) {
117
- // found a complete table
118
- break;
119
- }
120
- return result;
121
- }
122
- }
123
- result.CurrentLine = currentLine;
124
- result.Success = true;
125
- return result;
126
- }
127
- function getColumnAlignments(line, columnWidths) {
128
- let alignments = [];
129
- let left = 1;
130
- let right = -1;
131
- for (let i = 0; i < columnWidths.length; i++) {
132
- right += columnWidths[i];
133
- let alignment = ColumnAlignments.None;
134
- if (line.charAt(right) === ':') {
135
- if (line.charAt(left) === ':') {
136
- alignment = ColumnAlignments.Center;
137
- }
138
- else {
139
- alignment = ColumnAlignments.Right;
140
- }
141
- }
142
- else if (line.charAt(left) === ':') {
143
- alignment = ColumnAlignments.Left;
144
- }
145
- alignments.push(alignment);
146
- left += columnWidths[i];
147
- }
148
- return alignments;
149
- }
150
- function validateColumnWidths(matches, columnWidths) {
151
- const cells = [];
152
- for (var i = 0; i < columnWidths.length; i++) {
153
- const cell = matches[i + 1];
154
- const columnWidth = wcwidth(cell) + 1; // add 1 for separator
155
- if (columnWidth !== columnWidths[i]) {
156
- return null;
157
- }
158
- cells.push(cell);
159
- }
160
- return cells;
161
- }
162
- //# sourceMappingURL=ParseTable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParseTable.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ParseTable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,UAAU,CAC9B,KAAa,EACb,SAAiB,EACjB,OAAe;IAGf,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAEtC,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAExC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAC7B;QACI,iCAAiC;QACjC,OAAO,MAAM,CAAC;KACjB;IAED,MAAM,CAAC,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EACpC;QACI,mBAAmB;QACnB,OAAO,MAAM,CAAC;KACjB;IAED,+BAA+B;IAC/B,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,YAAY;SACxC,GAAG,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boolean;
4
- ColumnWidths: number[];
5
- ColumnOffsets: number[];
6
- ColumnAlignments: ColumnAlignments[];
7
- HeaderLess: boolean;
8
- HeaderLines: string[][];
9
- RowLines: string[][][];
10
- SeparatorLineOffsets: number[];
11
- CurrentLine: number;
12
- }
13
- //# sourceMappingURL=ParseTableResult.d.ts.map
@@ -1,18 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- export default class ParseTableResult {
6
- constructor() {
7
- this.Success = false;
8
- this.ColumnWidths = [];
9
- this.ColumnOffsets = [];
10
- this.ColumnAlignments = [];
11
- this.HeaderLess = false;
12
- this.HeaderLines = [];
13
- this.RowLines = [];
14
- this.SeparatorLineOffsets = [];
15
- this.CurrentLine = 0;
16
- }
17
- }
18
- //# sourceMappingURL=ParseTableResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ParseTableResult.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ParseTableResult.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAArC;QAEI,YAAO,GAAY,KAAK,CAAC;QAEzB,iBAAY,GAAa,EAAE,CAAC;QAE5B,kBAAa,GAAa,EAAE,CAAC;QAE7B,qBAAgB,GAAuB,EAAE,CAAC;QAE1C,eAAU,GAAY,KAAK,CAAC;QAE5B,gBAAW,GAAe,EAAE,CAAC;QAE7B,aAAQ,GAAiB,EAAE,CAAC;QAE5B,yBAAoB,GAAa,EAAE,CAAC;QAEpC,gBAAW,GAAW,CAAC,CAAC;IAC5B,CAAC;CAAA"}
@@ -1,2 +0,0 @@
1
- export default function gridTableRulePlugin(md: any): void;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,11 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bas Verweij. All rights reserved.
3
- * Licensed under the MIT License. See LICENSE in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- import gridTableRule from "./rules/gridtable";
6
- export default function gridTableRulePlugin(
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- md) {
9
- md.block.ruler.before("table", "gridtable", gridTableRule(md));
10
- }
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/gridtables/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,mBAAmB;AACvC,8DAA8D;AAC9D,EAAO;IAEP,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CACjB,OAAO,EACP,WAAW,EACX,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,CAAC"}