@quarto/jupyterlab-quarto 0.1.44 → 0.1.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. package/lib/__tests__/index.spec.d.ts +6 -0
  2. package/lib/__tests__/index.spec.js +61 -0
  3. package/lib/__tests__/index.spec.js.map +1 -0
  4. package/lib/__tests__/myextension.spec.d.ts +6 -0
  5. package/lib/__tests__/myextension.spec.js +11 -0
  6. package/lib/__tests__/myextension.spec.js.map +1 -0
  7. package/lib/ast/ast.d.ts +3 -0
  8. package/lib/ast/ast.js +39 -0
  9. package/lib/ast/ast.js.map +1 -0
  10. package/lib/const.d.ts +5 -0
  11. package/lib/const.js +12 -0
  12. package/lib/const.js.map +1 -0
  13. package/lib/hooks/codemirror.d.ts +4 -0
  14. package/lib/hooks/codemirror.js +52 -0
  15. package/lib/hooks/codemirror.js.map +1 -0
  16. package/lib/index.d.ts +6 -0
  17. package/lib/index.js +60 -0
  18. package/lib/index.js.map +1 -0
  19. package/lib/manager.d.ts +8 -0
  20. package/lib/manager.js +117 -0
  21. package/lib/manager.js.map +1 -0
  22. package/lib/plugins/callouts.d.ts +3 -0
  23. package/lib/plugins/callouts.js +209 -0
  24. package/lib/plugins/callouts.js.map +1 -0
  25. package/lib/plugins/cites.d.ts +3 -0
  26. package/lib/plugins/cites.js +148 -0
  27. package/lib/plugins/cites.js.map +1 -0
  28. package/lib/plugins/decorator.d.ts +3 -0
  29. package/lib/plugins/decorator.js +59 -0
  30. package/lib/plugins/decorator.js.map +1 -0
  31. package/lib/plugins/divs.d.ts +6 -0
  32. package/lib/plugins/divs.js +100 -0
  33. package/lib/plugins/divs.js.map +1 -0
  34. package/lib/plugins/figure-divs.d.ts +3 -0
  35. package/lib/plugins/figure-divs.js +53 -0
  36. package/lib/plugins/figure-divs.js.map +1 -0
  37. package/lib/plugins/figures.d.ts +17 -0
  38. package/lib/plugins/figures.js +99 -0
  39. package/lib/plugins/figures.js.map +1 -0
  40. package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +8 -0
  41. package/lib/plugins/gridtables/common/gridtables/GetCells.js +45 -0
  42. package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +1 -0
  43. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +8 -0
  44. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +27 -0
  45. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +1 -0
  46. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +8 -0
  47. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +13 -0
  48. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +1 -0
  49. package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +5 -0
  50. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +67 -0
  51. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +1 -0
  52. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +9 -0
  53. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +19 -0
  54. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +1 -0
  55. package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +3 -0
  56. package/lib/plugins/gridtables/common/markdown-it/GetLine.js +10 -0
  57. package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +1 -0
  58. package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +4 -0
  59. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +162 -0
  60. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +1 -0
  61. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +13 -0
  62. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +18 -0
  63. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +1 -0
  64. package/lib/plugins/gridtables/index.d.ts +2 -0
  65. package/lib/plugins/gridtables/index.js +11 -0
  66. package/lib/plugins/gridtables/index.js.map +1 -0
  67. package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +11 -0
  68. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +6 -0
  69. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +1 -0
  70. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +7 -0
  71. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +6 -0
  72. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +1 -0
  73. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +4 -0
  74. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +6 -0
  75. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +1 -0
  76. package/lib/plugins/gridtables/rules/gridtable.d.ts +4 -0
  77. package/lib/plugins/gridtables/rules/gridtable.js +26 -0
  78. package/lib/plugins/gridtables/rules/gridtable.js.map +1 -0
  79. package/lib/plugins/math.d.ts +5 -0
  80. package/lib/plugins/math.js +177 -0
  81. package/lib/plugins/math.js.map +1 -0
  82. package/lib/plugins/mermaid/index.d.ts +5 -0
  83. package/lib/plugins/mermaid/index.js +55 -0
  84. package/lib/plugins/mermaid/index.js.map +1 -0
  85. package/lib/plugins/shortcodes.d.ts +4 -0
  86. package/lib/plugins/shortcodes.js +33 -0
  87. package/lib/plugins/shortcodes.js.map +1 -0
  88. package/lib/plugins/spans.d.ts +3 -0
  89. package/lib/plugins/spans.js +39 -0
  90. package/lib/plugins/spans.js.map +1 -0
  91. package/lib/plugins/table-captions.d.ts +3 -0
  92. package/lib/plugins/table-captions.js +69 -0
  93. package/lib/plugins/table-captions.js.map +1 -0
  94. package/lib/plugins/utils/html.d.ts +12 -0
  95. package/lib/plugins/utils/html.js +46 -0
  96. package/lib/plugins/utils/html.js.map +1 -0
  97. package/lib/plugins/utils/markdownit.d.ts +16 -0
  98. package/lib/plugins/utils/markdownit.js +45 -0
  99. package/lib/plugins/utils/markdownit.js.map +1 -0
  100. package/lib/plugins/utils/tok.d.ts +8 -0
  101. package/lib/plugins/utils/tok.js +14 -0
  102. package/lib/plugins/utils/tok.js.map +1 -0
  103. package/lib/plugins/yaml.d.ts +3 -0
  104. package/lib/plugins/yaml.js +320 -0
  105. package/lib/plugins/yaml.js.map +1 -0
  106. package/lib/providers/attrs.d.ts +2 -0
  107. package/lib/providers/attrs.js +16 -0
  108. package/lib/providers/attrs.js.map +1 -0
  109. package/lib/providers/callouts.d.ts +2 -0
  110. package/lib/providers/callouts.js +16 -0
  111. package/lib/providers/callouts.js.map +1 -0
  112. package/lib/providers/cites.d.ts +2 -0
  113. package/lib/providers/cites.js +16 -0
  114. package/lib/providers/cites.js.map +1 -0
  115. package/lib/providers/decorator.d.ts +2 -0
  116. package/lib/providers/decorator.js +16 -0
  117. package/lib/providers/decorator.js.map +1 -0
  118. package/lib/providers/deflist.d.ts +2 -0
  119. package/lib/providers/deflist.js +16 -0
  120. package/lib/providers/deflist.js.map +1 -0
  121. package/lib/providers/divs.d.ts +2 -0
  122. package/lib/providers/divs.js +28 -0
  123. package/lib/providers/divs.js.map +1 -0
  124. package/lib/providers/figure-divs.d.ts +2 -0
  125. package/lib/providers/figure-divs.js +16 -0
  126. package/lib/providers/figure-divs.js.map +1 -0
  127. package/lib/providers/figures.d.ts +2 -0
  128. package/lib/providers/figures.js +16 -0
  129. package/lib/providers/figures.js.map +1 -0
  130. package/lib/providers/footnotes.d.ts +2 -0
  131. package/lib/providers/footnotes.js +16 -0
  132. package/lib/providers/footnotes.js.map +1 -0
  133. package/lib/providers/gridtables.d.ts +2 -0
  134. package/lib/providers/gridtables.js +16 -0
  135. package/lib/providers/gridtables.js.map +1 -0
  136. package/lib/providers/math.d.ts +2 -0
  137. package/lib/providers/math.js +105 -0
  138. package/lib/providers/math.js.map +1 -0
  139. package/lib/providers/mermaid.d.ts +2 -0
  140. package/lib/providers/mermaid.js +16 -0
  141. package/lib/providers/mermaid.js.map +1 -0
  142. package/lib/providers/provider.d.ts +4 -0
  143. package/lib/providers/provider.js +13 -0
  144. package/lib/providers/provider.js.map +1 -0
  145. package/lib/providers/shortcodes.d.ts +2 -0
  146. package/lib/providers/shortcodes.js +16 -0
  147. package/lib/providers/shortcodes.js.map +1 -0
  148. package/lib/providers/spans.d.ts +2 -0
  149. package/lib/providers/spans.js +16 -0
  150. package/lib/providers/spans.js.map +1 -0
  151. package/lib/providers/sub.d.ts +2 -0
  152. package/lib/providers/sub.js +16 -0
  153. package/lib/providers/sub.js.map +1 -0
  154. package/lib/providers/sup.d.ts +2 -0
  155. package/lib/providers/sup.js +16 -0
  156. package/lib/providers/sup.js.map +1 -0
  157. package/lib/providers/table-captions.d.ts +2 -0
  158. package/lib/providers/table-captions.js +16 -0
  159. package/lib/providers/table-captions.js.map +1 -0
  160. package/lib/providers/tasklists.d.ts +2 -0
  161. package/lib/providers/tasklists.js +16 -0
  162. package/lib/providers/tasklists.js.map +1 -0
  163. package/lib/providers/yaml.d.ts +2 -0
  164. package/lib/providers/yaml.js +16 -0
  165. package/lib/providers/yaml.js.map +1 -0
  166. package/lib/types.d.ts +44 -0
  167. package/lib/types.js +2 -0
  168. package/lib/types.js.map +1 -0
  169. package/lib/widgets.d.ts +15 -0
  170. package/lib/widgets.js +58 -0
  171. package/lib/widgets.js.map +1 -0
  172. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callouts.js","sourceRoot":"","sources":["../../src/plugins/callouts.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGnD,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AACzD,MAAM,qBAAqB,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AAI,CAAC,SAAS,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QACxC,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAA;IAEF,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAErD,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC;QAC/F,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;QAEzE,OAAO;YACL,IAAI,EAAE,IAAI,IAAI,MAAM;YACpB,GAAG,EAAE,YAAY;YACjB,KAAK;YACL,UAAU;SACX,CAAA;KAEF;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AAEH,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,UAA8C,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,UAAU,IAAI,SAAS,CAAC;IACtC,OAAO,iBAAiB,KAAK,EAAE,CAAC;AAClC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type MarkdownIt from "markdown-it/lib";
2
+ export declare const citationPlugin: (md: MarkdownIt) => void;
3
+ //# sourceMappingURL=cites.d.ts.map
@@ -0,0 +1,148 @@
1
+ /*
2
+ * citation.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ const kTokCite = "quarto_cite";
8
+ export const citationPlugin = (md) => {
9
+ // Very simple plugin example that surrounds @text with `code`
10
+ md.core.ruler.push('quarto-citation', function replaceAtSymbol(state) {
11
+ const tokens = state.tokens;
12
+ for (const token of tokens) {
13
+ if (token.type === 'inline' && token.children) {
14
+ // Rebuild the child list
15
+ const children = [];
16
+ for (let i = 0; i < token.children.length; i++) {
17
+ const child = token.children[i];
18
+ if (child.type === 'text') {
19
+ const content = child.content;
20
+ const textToken = (text) => {
21
+ const newToken = new state.Token('text', '', 0);
22
+ newToken.content = text.join("");
23
+ return newToken;
24
+ };
25
+ let text = [];
26
+ const flushText = () => {
27
+ if (text.length) {
28
+ children.push(textToken(text));
29
+ text = [];
30
+ }
31
+ };
32
+ let cite = [];
33
+ const flushCite = () => {
34
+ var _a;
35
+ if (cite.length) {
36
+ // Determine the cite style
37
+ let style = cite[0] === "-" ? "suppress-author" : "in-text";
38
+ if (bracketCount > 0) {
39
+ style = "normal";
40
+ }
41
+ // The classes
42
+ const clz = ["cite", style];
43
+ // If the cite ends in punctuation, trim that off and make that text
44
+ const puncText = [];
45
+ // Trim off ending punctuation
46
+ if ([":", ".", "#", "$", "%", "&", "-", "+", "?", "<", ">", "~", "/", "!"].includes(cite[cite.length - 1])) {
47
+ puncText.push(cite[cite.length - 1]);
48
+ cite = cite.slice(0, -1);
49
+ }
50
+ // Make a cite token
51
+ const newToken = new state.Token(kTokCite, '', 0);
52
+ newToken.content = cite.join("");
53
+ newToken.attrs = newToken.attrs || [];
54
+ (_a = newToken.attrs) === null || _a === void 0 ? void 0 : _a.push(["class", clz.join(" ")]);
55
+ children.push(newToken);
56
+ cite = [];
57
+ if (puncText.length > 0) {
58
+ children.push(textToken(puncText));
59
+ }
60
+ }
61
+ };
62
+ let capture = "text";
63
+ let bracketCount = 0;
64
+ for (let j = 0; j < content.length; j++) {
65
+ const char = content.charAt(j);
66
+ if (char === "@") {
67
+ if ((text.length === 1 && text[0] === '-') ||
68
+ text.length > 1 && text[text.length - 1] === "-" && text[text.length - 2] === "[") {
69
+ cite.push('-');
70
+ cite.push(char);
71
+ text.pop();
72
+ flushText();
73
+ capture = 'cite';
74
+ }
75
+ else if (text[text.length - 1] === ' ') {
76
+ flushText();
77
+ cite.push(char);
78
+ capture = 'cite';
79
+ }
80
+ else if (text[text.length - 1] === '-' && text[text.length - 2] === ' ') {
81
+ text = text.slice(0, -1);
82
+ flushText();
83
+ cite.push('-');
84
+ cite.push(char);
85
+ capture = 'cite';
86
+ }
87
+ else if (text[text.length - 1] === '[' && text[text.length - 2] === ' ') {
88
+ flushText();
89
+ cite.push(char);
90
+ capture = 'cite';
91
+ }
92
+ else if (text.length === 0) {
93
+ cite.push(char);
94
+ capture = 'cite';
95
+ }
96
+ else {
97
+ if (capture === 'cite') {
98
+ cite.push(char);
99
+ }
100
+ else {
101
+ text.push(char);
102
+ }
103
+ }
104
+ }
105
+ else if (char === " ") {
106
+ capture = 'text';
107
+ flushCite();
108
+ text.push(char);
109
+ }
110
+ else if (char === "[") {
111
+ bracketCount++;
112
+ text.push(char);
113
+ }
114
+ else if (char === "]") {
115
+ bracketCount--;
116
+ capture = 'text';
117
+ flushCite();
118
+ text.push(char);
119
+ }
120
+ else {
121
+ if (capture === 'cite') {
122
+ cite.push(char);
123
+ }
124
+ else {
125
+ text.push(char);
126
+ }
127
+ }
128
+ }
129
+ flushCite();
130
+ flushText();
131
+ }
132
+ else {
133
+ children.push(child);
134
+ }
135
+ }
136
+ token.children = children.length > 0 ? children : null;
137
+ }
138
+ }
139
+ });
140
+ md.renderer.rules[kTokCite] = renderCite;
141
+ };
142
+ // Render pandoc-style divs
143
+ function renderCite(tokens, idx, _options, _env, self) {
144
+ const token = tokens[idx];
145
+ const citeContent = `<code ${self.renderAttrs(token)}>${token.content}</code>`;
146
+ return citeContent;
147
+ }
148
+ //# sourceMappingURL=cites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cites.js","sourceRoot":"","sources":["../../src/plugins/cites.ts"],"names":[],"mappings":"AAAA;;;;;EAKE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IAAI,IAAI,KAAK,GAAG,EAAE;gCACvB,YAAY,EAAE,CAAC;gCACf,OAAO,GAAG,MAAM,CAAC;gCACjB,SAAS,EAAE,CAAC;gCACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;6BACjB;iCACI;gCACH,IAAI,OAAO,KAAK,MAAM,EAAE;oCACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iCACjB;qCAAM;oCACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iCACjB;6BACF;yBACF;wBACD,SAAS,EAAE,CAAC;wBACZ,SAAS,EAAE,CAAC;qBACb;yBAAM;wBACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACtB;iBACF;gBACD,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;aACxD;SACF;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAA;AAC1C,CAAC,CAAA;AAGD,2BAA2B;AAC3B,SAAS,UAAU,CAAC,MAAe,EAAE,GAAW,EAAE,QAA4B,EAAE,IAAa,EAAE,IAAc;IAC3G,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,SAAS,CAAC;IAChF,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type MarkdownIt from "markdown-it/lib";
2
+ export declare const decoratorPlugin: (md: MarkdownIt) => void;
3
+ //# sourceMappingURL=decorator.d.ts.map
@@ -0,0 +1,59 @@
1
+ import Token from "markdown-it/lib/token";
2
+ import { attributeDecorator, decorator } from "./utils/html";
3
+ import { kTokDivOpen } from "./divs";
4
+ import { kTokFigureOpen } from "./figures";
5
+ import { kTokHeadingOpen, kTokTableOpen } from "./utils/tok";
6
+ import { kTokMathBlock } from "./math";
7
+ const kTokDecorator = "quarto_decorator";
8
+ const kQuartoDecoratorOptions = "quarto-decorator-options";
9
+ export const decoratorPlugin = (md) => {
10
+ md.core.ruler.push('quarto-decorator', function replaceAtSymbol(state) {
11
+ const outTokens = [];
12
+ for (const token of state.tokens) {
13
+ if (token.type === "fence" && !token.attrs && token.info) {
14
+ outTokens.push(decoratorTokForToken(token));
15
+ }
16
+ else if (token.type === kTokHeadingOpen && token.attrs) {
17
+ outTokens.push(decoratorTokForToken(token));
18
+ }
19
+ else if (token.type === kTokDivOpen && token.attrs) {
20
+ outTokens.push(decoratorTokForToken(token));
21
+ }
22
+ else if (token.type === kTokFigureOpen && token.attrs) {
23
+ outTokens.push(decoratorTokForToken(token, { hide: { attributes: true } }));
24
+ }
25
+ else if (token.type === kTokTableOpen && token.attrs) {
26
+ outTokens.push(decoratorTokForToken(token));
27
+ }
28
+ else if (token.type === kTokMathBlock && token.attrs) {
29
+ outTokens.push(decoratorTokForToken(token));
30
+ }
31
+ outTokens.push(token);
32
+ }
33
+ state.tokens = outTokens;
34
+ });
35
+ md.renderer.rules[kTokDecorator] = renderDecorator;
36
+ };
37
+ function decoratorTokForToken(token, options) {
38
+ const decoratorTok = new Token(kTokDecorator, "div", 1);
39
+ decoratorTok.attrs = token.attrs;
40
+ decoratorTok.info = token.info;
41
+ if (options) {
42
+ decoratorTok.meta = decoratorTok.meta || {};
43
+ decoratorTok.meta[kQuartoDecoratorOptions] = options;
44
+ }
45
+ return decoratorTok;
46
+ }
47
+ // Render pandoc-style divs
48
+ function renderDecorator(tokens, idx) {
49
+ var _a;
50
+ const token = tokens[idx];
51
+ const decoratorOptions = (_a = token.meta) === null || _a === void 0 ? void 0 : _a[kQuartoDecoratorOptions];
52
+ if (token.info) {
53
+ return decorator([token.info]);
54
+ }
55
+ else {
56
+ return attributeDecorator(token, decoratorOpt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W;;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAA,KAAK,CAAC,IAAI,0CAAG,uBAAuB,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,OAAO,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAE;KACjC;SAAM;QACL,OAAO,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;KACpD;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type MarkdownIt from "markdown-it/lib";
2
+ export declare const kDivRuleName = "pandocDiv";
3
+ export declare const kTokDivOpen = "pandoc_div_open";
4
+ export declare const kTokDivClose = "pandoc_div_close";
5
+ export declare const divPlugin: (md: MarkdownIt) => void;
6
+ //# sourceMappingURL=divs.d.ts.map
@@ -0,0 +1,100 @@
1
+ import { addClass } from "./utils/markdownit";
2
+ export const kDivRuleName = "pandocDiv";
3
+ export const kTokDivOpen = 'pandoc_div_open';
4
+ export const kTokDivClose = 'pandoc_div_close';
5
+ export const divPlugin = (md) => {
6
+ // Render pandoc-style divs
7
+ function renderStartDiv(tokens, idx, _options, _env, self) {
8
+ // Add a class to designate that this is a quarto dev
9
+ const token = tokens[idx];
10
+ token.attrs = addClass("quarto-div", token.attrs);
11
+ return `<div ${self.renderAttrs(token)}>`;
12
+ }
13
+ // Render pandoc-style divs
14
+ function renderEndDiv() {
15
+ return `</div>`;
16
+ }
17
+ // TODO Implement a better test during validation run
18
+ // Handle pandoc-style divs
19
+ md.block.ruler.before("fence", kDivRuleName, (state, start, _end, silent) => {
20
+ // This is a validation run, can ignore
21
+ if (silent) {
22
+ return true;
23
+ }
24
+ // Get the line for parsing
25
+ const lineStart = state.bMarks[start] + state.tShift[start];
26
+ const lineEnd = state.eMarks[start];
27
+ const line = state.src.slice(lineStart, lineEnd);
28
+ // The current state of the divs (e.g. is there an open)
29
+ // div. Data structure holds key that is the number of colons
30
+ const divState = state.env.quartoOpenDivs || {};
31
+ const incrementDivCount = (fence) => {
32
+ state.env.quartoOpenDivs = state.env.quartoOpenDivs || {};
33
+ const current = state.env.quartoOpenDivs[fence] || 0;
34
+ state.env.quartoOpenDivs[fence] = Math.max(0, current + 1);
35
+ };
36
+ const decrementDivCount = (fence) => {
37
+ state.env.quartoOpenDivs = state.env.quartoOpenDivs || {};
38
+ const current = state.env.quartoOpenDivs[fence] || 0;
39
+ state.env.quartoOpenDivs[fence] = Math.max(0, current - 1);
40
+ };
41
+ // Three or more colons followed by a an optional brace with attributes
42
+ const divBraceRegex = /^(:::+)\s*(?:(\{[\s\S]+?\}))?$/;
43
+ // Three or more colons followed by a string with no braces
44
+ const divNoBraceRegex = /^(:::+)\s*(?:([^{}\s]+?))?$/;
45
+ const matchers = [divBraceRegex, divNoBraceRegex];
46
+ let match;
47
+ for (const matcher of matchers) {
48
+ match = matcher.exec(line);
49
+ if (match) {
50
+ break;
51
+ }
52
+ }
53
+ if (match) {
54
+ // There is a div here, is one already open?
55
+ const divFence = match[1];
56
+ const attr = match[2];
57
+ // Is this open?
58
+ let isOpenDiv = false;
59
+ const openCount = divState[divFence];
60
+ if (!openCount || openCount === 0) {
61
+ // There isn't an existing open div at this level (number of colons)
62
+ isOpenDiv = true;
63
+ }
64
+ else if (attr) {
65
+ // If it has attributes it is always open
66
+ isOpenDiv = true;
67
+ }
68
+ if (isOpenDiv) {
69
+ // Add to the open count (or set it to 1)
70
+ incrementDivCount(divFence);
71
+ // Make an open token
72
+ const token = state.push(kTokDivOpen, "div", 1);
73
+ token.markup = line;
74
+ // Allow this to be parsed for attributes by markdown-it-attr
75
+ if (attr && attr.startsWith("{")) {
76
+ token.info = attr;
77
+ }
78
+ else if (attr) {
79
+ token.info = `{.${attr}}`;
80
+ }
81
+ token.block = true;
82
+ }
83
+ else {
84
+ // Subtract from the open count (min zero)
85
+ decrementDivCount(divFence);
86
+ // Make a close token
87
+ const token = state.push(kTokDivClose, "div", -1);
88
+ token.markup = line;
89
+ }
90
+ state.line = start + 1;
91
+ return true;
92
+ }
93
+ else {
94
+ return false;
95
+ }
96
+ }, { alt: [] });
97
+ md.renderer.rules[kTokDivOpen] = renderStartDiv;
98
+ md.renderer.rules[kTokDivClose] = renderEndDiv;
99
+ };
100
+ //# sourceMappingURL=divs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"divs.js","sourceRoot":"","sources":["../../src/plugins/divs.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAc,EAAE,EAAE;IAE1C,2BAA2B;IAC3B,SAAS,cAAc,CAAC,MAAe,EAAE,GAAW,EAAE,QAA4B,EAAE,IAAa,EAAE,IAAc;QAE/G,qDAAqD;QACrD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;QAEjD,OAAO,QAAQ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;IAC5C,CAAC;IAED,2BAA2B;IAC3B,SAAS,YAAY;QACnB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,qDAAqD;IACrD,2BAA2B;IAC3B,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CACnB,OAAO,EACP,YAAY,EACZ,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAE7B,uCAAuC;QACvC,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,CAAC;SACb;QAED,2BAA2B;QAC3B,MAAM,SAAS,GAAG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,qBAAqB;gBACrB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;gBACjD,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;aACrB;YAED,KAAK,CAAC,IAAI,GAAG,KAAK,GAAG,CAAC,CAAA;YACtB,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,EACD,EAAE,GAAG,EAAE,EAAE,EAAE,CACZ,CAAA;IAED,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;IAC/C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;AAChD,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import MarkdownIt from "markdown-it";
2
+ export declare const figureDivsPlugin: (md: MarkdownIt) => void;
3
+ //# sourceMappingURL=figure-divs.d.ts.map
@@ -0,0 +1,53 @@
1
+ /*
2
+ * figure-divs.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { readAttrValue } from "./utils/markdownit";
8
+ import { kTokInline, kTokParaClose, kTokParaOpen } from "./utils/tok";
9
+ import { kTokDivClose, kTokDivOpen } from "./divs";
10
+ import { kTokFigCaptionClose, kTokFigCaptionOpen, mutateToFigureTok } from "./figures";
11
+ const kFigureDivRuleName = "quarto-figure-divs";
12
+ const kFigurePrefix = "fig-";
13
+ export const figureDivsPlugin = (md) => {
14
+ // Handle pandoc-style divs
15
+ md.core.ruler.push(kFigureDivRuleName, (state) => {
16
+ let isFigureDiv = [];
17
+ for (let i = 0; i < state.tokens.length; i++) {
18
+ const token = state.tokens[i];
19
+ if (token.type === kTokDivOpen) {
20
+ const id = readAttrValue("id", token.attrs);
21
+ if (id === null || id === void 0 ? void 0 : id.startsWith(kFigurePrefix)) {
22
+ isFigureDiv.push(true);
23
+ mutateToFigureTok(token, "open");
24
+ }
25
+ else {
26
+ // Note the div, but not a figure div
27
+ isFigureDiv.push(false);
28
+ }
29
+ }
30
+ else if (token.type === kTokDivClose) {
31
+ const isFigDiv = isFigureDiv.pop();
32
+ if (isFigDiv) {
33
+ // If the preview token is paragraph, use that as the caption
34
+ if (i - 3 >= 0) {
35
+ const maybeParaStart = state.tokens[i - 3];
36
+ const maybeInline = state.tokens[i - 2];
37
+ const maybeParaEnd = state.tokens[i - 1];
38
+ if (maybeParaStart.type === kTokParaOpen && maybeParaEnd.type === kTokParaClose && maybeInline.type === kTokInline) {
39
+ mutateToFigCaption(state.tokens[i - 3], "open");
40
+ mutateToFigCaption(state.tokens[i - 1], "close");
41
+ }
42
+ }
43
+ mutateToFigureTok(token, "close");
44
+ }
45
+ }
46
+ }
47
+ });
48
+ };
49
+ const mutateToFigCaption = (token, type) => {
50
+ token.tag = "figcaption";
51
+ token.type = type === "open" ? kTokFigCaptionClose : kTokFigCaptionOpen;
52
+ };
53
+ //# sourceMappingURL=figure-divs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-divs.js","sourceRoot":"","sources":["../../src/plugins/figure-divs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGvF,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAChD,MAAM,aAAa,GAAG,MAAM,CAAC;AAG7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAc,EAAE,EAAE;IAEjD,2BAA2B;IAC3B,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CA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AAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;4BAC9C,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;yBAChD;qBACF;oBACD,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBACnC;aACF;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAE,IAAsB,EAAE,EAAE;IAClE,KAAK,CAAC,GAAG,GAAG,YAAY,CAAC;IACzB,KAAK,CAAC,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAC1E,CAAC,CAAA"}
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,99 @@
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
@@ -0,0 +1 @@
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,MAAM,cAAc,GAAG,aAAa,CAAC;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAY,EAAE,IAAsB,EAAE,EAAE;IACxE,KAAK,CAAC,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;IAChE,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC;AACvB,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AAC,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"}
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,45 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,8 @@
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