@quarto/jupyterlab-quarto 0.1.45 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +48 -15
  3. package/lib/__tests__/jupyterlab_quarto.spec.d.ts +3 -0
  4. package/lib/__tests__/jupyterlab_quarto.spec.js +9 -0
  5. package/lib/ast/ast.d.ts +1 -2
  6. package/lib/ast/ast.js +4 -3
  7. package/lib/const.d.ts +1 -2
  8. package/lib/const.js +5 -6
  9. package/lib/hooks/codemirror.d.ts +5 -4
  10. package/lib/hooks/codemirror.js +37 -12
  11. package/lib/index.d.ts +2 -3
  12. package/lib/index.js +6 -5
  13. package/lib/manager.d.ts +2 -2
  14. package/lib/manager.js +14 -16
  15. package/lib/plugins/callouts.d.ts +1 -2
  16. package/lib/plugins/callouts.js +59 -58
  17. package/lib/plugins/cites.d.ts +1 -2
  18. package/lib/plugins/cites.js +41 -23
  19. package/lib/plugins/decorator.d.ts +1 -2
  20. package/lib/plugins/decorator.js +11 -12
  21. package/lib/plugins/divs.d.ts +1 -2
  22. package/lib/plugins/divs.js +20 -9
  23. package/lib/plugins/figure-divs.d.ts +1 -2
  24. package/lib/plugins/figure-divs.js +18 -17
  25. package/lib/plugins/figures.d.ts +3 -4
  26. package/lib/plugins/figures.js +30 -31
  27. package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +5 -6
  28. package/lib/plugins/gridtables/common/gridtables/GetCells.js +6 -8
  29. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +5 -6
  30. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +9 -14
  31. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +0 -1
  32. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +0 -1
  33. package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +3 -4
  34. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +12 -15
  35. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +1 -2
  36. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +1 -3
  37. package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +1 -2
  38. package/lib/plugins/gridtables/common/markdown-it/GetLine.js +0 -1
  39. package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +2 -3
  40. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +18 -28
  41. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +1 -2
  42. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +0 -1
  43. package/lib/plugins/gridtables/index.d.ts +0 -1
  44. package/lib/plugins/gridtables/index.js +2 -3
  45. package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +1 -2
  46. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +0 -1
  47. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +0 -1
  48. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +0 -1
  49. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +1 -2
  50. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +0 -1
  51. package/lib/plugins/gridtables/rules/gridtable.d.ts +2 -3
  52. package/lib/plugins/gridtables/rules/gridtable.js +5 -6
  53. package/lib/plugins/index.d.ts +15 -0
  54. package/lib/plugins/index.js +21 -0
  55. package/lib/plugins/math.d.ts +4 -3
  56. package/lib/plugins/math.js +33 -31
  57. package/lib/plugins/mermaid/index.d.ts +1 -2
  58. package/lib/plugins/mermaid/index.js +19 -14
  59. package/lib/plugins/shortcodes.d.ts +1 -2
  60. package/lib/plugins/shortcodes.js +6 -7
  61. package/lib/plugins/spans.d.ts +1 -2
  62. package/lib/plugins/spans.js +2 -4
  63. package/lib/plugins/table-captions.d.ts +1 -2
  64. package/lib/plugins/table-captions.js +19 -16
  65. package/lib/plugins/utils/html.d.ts +1 -2
  66. package/lib/plugins/utils/html.js +19 -15
  67. package/lib/plugins/utils/markdownit.d.ts +0 -1
  68. package/lib/plugins/utils/markdownit.js +14 -13
  69. package/lib/plugins/utils/tok.d.ts +0 -1
  70. package/lib/plugins/utils/tok.js +12 -13
  71. package/lib/plugins/yaml.d.ts +1 -2
  72. package/lib/plugins/yaml.js +59 -49
  73. package/lib/providers/attrs.d.ts +1 -2
  74. package/lib/providers/attrs.js +5 -6
  75. package/lib/providers/callouts.d.ts +1 -2
  76. package/lib/providers/callouts.js +7 -8
  77. package/lib/providers/cites.d.ts +1 -2
  78. package/lib/providers/cites.js +7 -8
  79. package/lib/providers/decorator.d.ts +1 -2
  80. package/lib/providers/decorator.js +7 -8
  81. package/lib/providers/deflist.d.ts +1 -2
  82. package/lib/providers/deflist.js +5 -6
  83. package/lib/providers/divs.d.ts +1 -2
  84. package/lib/providers/divs.js +9 -10
  85. package/lib/providers/figure-divs.d.ts +1 -2
  86. package/lib/providers/figure-divs.js +5 -6
  87. package/lib/providers/figures.d.ts +1 -2
  88. package/lib/providers/figures.js +5 -6
  89. package/lib/providers/footnotes.d.ts +1 -2
  90. package/lib/providers/footnotes.js +5 -6
  91. package/lib/providers/gridtables.d.ts +1 -2
  92. package/lib/providers/gridtables.js +5 -6
  93. package/lib/providers/math.d.ts +1 -2
  94. package/lib/providers/math.js +12 -13
  95. package/lib/providers/mermaid.d.ts +1 -2
  96. package/lib/providers/mermaid.js +10 -9
  97. package/lib/providers/provider.d.ts +1 -2
  98. package/lib/providers/provider.js +0 -1
  99. package/lib/providers/shortcodes.d.ts +1 -2
  100. package/lib/providers/shortcodes.js +5 -6
  101. package/lib/providers/spans.d.ts +1 -2
  102. package/lib/providers/spans.js +8 -9
  103. package/lib/providers/sub.d.ts +1 -2
  104. package/lib/providers/sub.js +5 -6
  105. package/lib/providers/sup.d.ts +1 -2
  106. package/lib/providers/sup.js +5 -6
  107. package/lib/providers/table-captions.d.ts +1 -2
  108. package/lib/providers/table-captions.js +5 -6
  109. package/lib/providers/tasklists.d.ts +1 -2
  110. package/lib/providers/tasklists.js +5 -6
  111. package/lib/providers/yaml.d.ts +1 -2
  112. package/lib/providers/yaml.js +7 -8
  113. package/lib/types.d.ts +0 -1
  114. package/lib/types.js +0 -1
  115. package/lib/widgets.d.ts +0 -1
  116. package/lib/widgets.js +5 -6
  117. package/package.json +105 -39
  118. package/style/base.css +34 -33
  119. package/style/index.css +1 -1
  120. package/lib/__tests__/index.spec.d.ts +0 -6
  121. package/lib/__tests__/index.spec.js +0 -61
  122. package/lib/__tests__/index.spec.js.map +0 -1
  123. package/lib/__tests__/myextension.spec.d.ts +0 -6
  124. package/lib/__tests__/myextension.spec.js +0 -11
  125. package/lib/__tests__/myextension.spec.js.map +0 -1
  126. package/lib/ast/ast.js.map +0 -1
  127. package/lib/const.js.map +0 -1
  128. package/lib/hooks/codemirror.js.map +0 -1
  129. package/lib/index.js.map +0 -1
  130. package/lib/manager.js.map +0 -1
  131. package/lib/plugins/callouts.js.map +0 -1
  132. package/lib/plugins/cites.js.map +0 -1
  133. package/lib/plugins/decorator.js.map +0 -1
  134. package/lib/plugins/divs.js.map +0 -1
  135. package/lib/plugins/figure-divs.js.map +0 -1
  136. package/lib/plugins/figures.js.map +0 -1
  137. package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +0 -1
  138. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +0 -1
  139. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +0 -1
  140. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +0 -1
  141. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +0 -1
  142. package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +0 -1
  143. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +0 -1
  144. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +0 -1
  145. package/lib/plugins/gridtables/index.js.map +0 -1
  146. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +0 -1
  147. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +0 -1
  148. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +0 -1
  149. package/lib/plugins/gridtables/rules/gridtable.js.map +0 -1
  150. package/lib/plugins/math.js.map +0 -1
  151. package/lib/plugins/mermaid/index.js.map +0 -1
  152. package/lib/plugins/shortcodes.js.map +0 -1
  153. package/lib/plugins/spans.js.map +0 -1
  154. package/lib/plugins/table-captions.js.map +0 -1
  155. package/lib/plugins/utils/html.js.map +0 -1
  156. package/lib/plugins/utils/markdownit.js.map +0 -1
  157. package/lib/plugins/utils/tok.js.map +0 -1
  158. package/lib/plugins/yaml.js.map +0 -1
  159. package/lib/providers/attrs.js.map +0 -1
  160. package/lib/providers/callouts.js.map +0 -1
  161. package/lib/providers/cites.js.map +0 -1
  162. package/lib/providers/decorator.js.map +0 -1
  163. package/lib/providers/deflist.js.map +0 -1
  164. package/lib/providers/divs.js.map +0 -1
  165. package/lib/providers/figure-divs.js.map +0 -1
  166. package/lib/providers/figures.js.map +0 -1
  167. package/lib/providers/footnotes.js.map +0 -1
  168. package/lib/providers/gridtables.js.map +0 -1
  169. package/lib/providers/math.js.map +0 -1
  170. package/lib/providers/mermaid.js.map +0 -1
  171. package/lib/providers/provider.js.map +0 -1
  172. package/lib/providers/shortcodes.js.map +0 -1
  173. package/lib/providers/spans.js.map +0 -1
  174. package/lib/providers/sub.js.map +0 -1
  175. package/lib/providers/sup.js.map +0 -1
  176. package/lib/providers/table-captions.js.map +0 -1
  177. package/lib/providers/tasklists.js.map +0 -1
  178. package/lib/providers/yaml.js.map +0 -1
  179. package/lib/types.js.map +0 -1
  180. package/lib/widgets.js.map +0 -1
  181. package/schema/plugin.json +0 -8
  182. package/src/@types/markdown-it-deflist.d.ts +0 -10
  183. package/src/@types/markdown-it-footnote.d.ts +0 -10
  184. package/src/@types/markdown-it-gridtables.d.ts +0 -10
  185. package/src/@types/markdown-it-implicit-figures.d.ts +0 -10
  186. package/src/@types/markdown-it-sub.d.ts +0 -10
  187. package/src/@types/markdown-it-sup.d.ts +0 -10
  188. package/src/@types/markdown-it-task-lists.d.ts +0 -10
@@ -1,4 +1,3 @@
1
- import type MarkdownIt from "markdown-it/lib";
1
+ import type MarkdownIt from 'markdown-it/lib';
2
2
  export declare const kShortcode = "shortcode";
3
3
  export declare const shortcodePlugin: (md: MarkdownIt) => void;
4
- //# sourceMappingURL=shortcodes.d.ts.map
@@ -1,9 +1,9 @@
1
- import { escapeHtml } from "markdown-it/lib/common/utils";
2
- export const kShortcode = "shortcode";
1
+ import { escapeHtml } from 'markdown-it/lib/common/utils';
2
+ export const kShortcode = 'shortcode';
3
3
  export const shortcodePlugin = (md) => {
4
4
  const shortcode = (state, silent) => {
5
5
  // {{< shortcode >}}
6
- if (state.src.slice(state.pos, state.pos + 3) !== "{{<") {
6
+ if (state.src.slice(state.pos, state.pos + 3) !== '{{<') {
7
7
  return false;
8
8
  }
9
9
  const shortcodeEndRegex = />}}/g;
@@ -14,14 +14,14 @@ export const shortcodePlugin = (md) => {
14
14
  }
15
15
  const shortcodeContent = state.src.slice(state.pos + 3, state.pos + end);
16
16
  if (!silent) {
17
- const token = state.push("shortcode", "shortcode", 0);
18
- token.markup = "";
17
+ const token = state.push('shortcode', 'shortcode', 0);
18
+ token.markup = '';
19
19
  token.content = shortcodeContent;
20
20
  }
21
21
  state.pos += end + 3;
22
22
  return true;
23
23
  };
24
- md.inline.ruler.after("escape", kShortcode, shortcode);
24
+ md.inline.ruler.after('escape', kShortcode, shortcode);
25
25
  const renderShortcode = (tokens, idx) => {
26
26
  const token = tokens[idx];
27
27
  const content = token.content;
@@ -30,4 +30,3 @@ export const shortcodePlugin = (md) => {
30
30
  };
31
31
  md.renderer.rules[kShortcode] = renderShortcode;
32
32
  };
33
- //# sourceMappingURL=shortcodes.js.map
@@ -1,3 +1,2 @@
1
- import MarkdownIt from "markdown-it";
1
+ import MarkdownIt from 'markdown-it';
2
2
  export declare function spansPlugin(md: MarkdownIt): void;
3
- //# sourceMappingURL=spans.d.ts.map
@@ -7,7 +7,7 @@
7
7
  export function spansPlugin(md) {
8
8
  function span(state) {
9
9
  const max = state.posMax;
10
- if (state.src.charCodeAt(state.pos) !== 0x5B) {
10
+ if (state.src.charCodeAt(state.pos) !== 0x5b) {
11
11
  // opening [
12
12
  return false;
13
13
  }
@@ -18,7 +18,7 @@ export function spansPlugin(md) {
18
18
  return false;
19
19
  }
20
20
  const pos = labelEnd + 1;
21
- if (pos < max && state.src.charCodeAt(pos) === 0x7B /* { */) {
21
+ if (pos < max && state.src.charCodeAt(pos) === 0x7b /* { */) {
22
22
  // probably found span
23
23
  state.pos = labelStart;
24
24
  state.posMax = labelEnd;
@@ -33,7 +33,5 @@ export function spansPlugin(md) {
33
33
  return false;
34
34
  }
35
35
  }
36
- ;
37
36
  md.inline.ruler.push('quarto-spans', span);
38
37
  }
39
- //# sourceMappingURL=spans.js.map
@@ -1,3 +1,2 @@
1
- import MarkdownIt from "markdown-it";
1
+ import MarkdownIt from 'markdown-it';
2
2
  export declare const tableCaptionPlugin: (md: MarkdownIt) => void;
3
- //# sourceMappingURL=table-captions.d.ts.map
@@ -4,10 +4,10 @@
4
4
  * Copyright (C) 2020-2023 Posit Software, PBC
5
5
  *
6
6
  */
7
- import { kTokInline, kTokParaClose, kTokParaOpen, kTokTableClose, kTokTableOpen, kTokText } from "./utils/tok";
8
- const kTableCaptionRule = "quarto-table-captions";
7
+ import { kTokInline, kTokParaClose, kTokParaOpen, kTokTableClose, kTokTableOpen, kTokText } from './utils/tok';
8
+ const kTableCaptionRule = 'quarto-table-captions';
9
9
  export const tableCaptionPlugin = (md) => {
10
- md.core.ruler.push(kTableCaptionRule, (state) => {
10
+ md.core.ruler.push(kTableCaptionRule, state => {
11
11
  const tableIdxs = [];
12
12
  const tablePoss = [];
13
13
  // Identify tables that we'd like to process
@@ -29,8 +29,8 @@ export const tableCaptionPlugin = (md) => {
29
29
  }
30
30
  }
31
31
  }
32
- // Look just past the tables and if there is a paragraph that is
33
- // a table caption, extract that and place it in the table
32
+ // Look just past the tables and if there is a paragraph that is
33
+ // a table caption, extract that and place it in the table
34
34
  for (const tablePos of tablePoss) {
35
35
  resolveTableCaption(state.tokens, tablePos.start, tablePos.end);
36
36
  }
@@ -39,31 +39,34 @@ export const tableCaptionPlugin = (md) => {
39
39
  function resolveTableCaption(tokens, tblStartPos, tblEndPos) {
40
40
  // Must have at least three tokens past the table end
41
41
  if (tokens.length > tblEndPos + 3) {
42
- if (tokens[tblEndPos + 1].type === kTokParaOpen
43
- && tokens[tblEndPos + 2].type === kTokInline
44
- && tokens[tblEndPos + 3].type === kTokParaClose) {
42
+ if (tokens[tblEndPos + 1].type === kTokParaOpen &&
43
+ tokens[tblEndPos + 2].type === kTokInline &&
44
+ tokens[tblEndPos + 3].type === kTokParaClose) {
45
45
  const maybeCaption = tokens[tblEndPos + 2];
46
- const isText = maybeCaption.children !== null && maybeCaption.children.length > 0 && maybeCaption.children[0].type === kTokText;
47
- const maybeCaptionText = isText ? maybeCaption.children[0].content : "";
46
+ const isText = maybeCaption.children !== null &&
47
+ maybeCaption.children.length > 0 &&
48
+ maybeCaption.children[0].type === kTokText;
49
+ const maybeCaptionText = isText && maybeCaption.children ? maybeCaption.children[0].content : '';
48
50
  const match = maybeCaptionText.match(/^:\s([^{}]*)(?:\{.*\}){0,1}$/);
49
51
  if (match && match[1]) {
50
52
  // Carve out the existing tokens
51
53
  const capTokens = tokens.splice(tblEndPos + 1, 3);
52
54
  // We have the caption, remove the paragraph and return
53
55
  // the caption
54
- capTokens[0].type = "table_caption";
55
- capTokens[0].tag = "caption";
56
+ capTokens[0].type = 'table_caption';
57
+ capTokens[0].tag = 'caption';
56
58
  // Forward any attributes from the caption up to the table
57
59
  tokens[tblStartPos].attrs = capTokens[0].attrs;
58
60
  capTokens[0].attrs = [];
59
61
  // Trim the content
60
- capTokens[1].children[0].content = match[1];
62
+ if (capTokens[1].children && capTokens[1].children.length > 0) {
63
+ capTokens[1].children[0].content = match[1];
64
+ }
61
65
  // Close the caption
62
- capTokens[2].type = "table_caption";
63
- capTokens[2].tag = "caption";
66
+ capTokens[2].type = 'table_caption';
67
+ capTokens[2].tag = 'caption';
64
68
  tokens.splice(tblStartPos + 1, 0, ...capTokens);
65
69
  }
66
70
  }
67
71
  }
68
72
  }
69
- //# sourceMappingURL=table-captions.js.map
@@ -1,4 +1,4 @@
1
- import Token from "markdown-it/lib/token";
1
+ import Token from 'markdown-it/lib/token';
2
2
  export interface DecoratorOptions {
3
3
  customClass?: string;
4
4
  hide: {
@@ -9,4 +9,3 @@ export interface DecoratorOptions {
9
9
  }
10
10
  export declare const decorator: (contents: string[], customClass?: string) => string;
11
11
  export declare const attributeDecorator: (token: Token, options?: DecoratorOptions) => string;
12
- //# sourceMappingURL=html.d.ts.map
@@ -1,41 +1,46 @@
1
1
  /*
2
- * html.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
7
- import { readAttrValue } from "./markdownit";
2
+ * html.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { readAttrValue } from './markdownit';
8
8
  export const decorator = (contents, customClass) => {
9
9
  if (contents.length > 0) {
10
10
  // Provide a decorator with the attributes
11
- return `<div class="quarto-attribute-decorator${customClass ? ' ' + customClass : ""}">${contents.map(decoratorSpan).join("")}</div>`;
11
+ return `<div class="quarto-attribute-decorator${customClass ? ' ' + customClass : ''}">${contents.map(decoratorSpan).join('')}</div>`;
12
12
  }
13
13
  else {
14
14
  // There is no decorator - no attributes
15
- return "";
15
+ return '';
16
16
  }
17
17
  };
18
18
  export const attributeDecorator = (token, options) => {
19
19
  var _a;
20
20
  // id
21
- const id = readAttrValue("id", token.attrs);
21
+ const id = readAttrValue('id', token.attrs);
22
22
  // classes
23
- const clz = readAttrValue("class", token.attrs);
23
+ const clz = readAttrValue('class', token.attrs);
24
24
  // other attributes
25
- const otherAttrs = (_a = token.attrs) === null || _a === void 0 ? void 0 : _a.filter((attr) => { return attr[0] !== "id" && attr[0] !== "class"; });
25
+ const otherAttrs = (_a = token.attrs) === null || _a === void 0 ? void 0 : _a.filter(attr => {
26
+ return attr[0] !== 'id' && attr[0] !== 'class';
27
+ });
26
28
  // Create a decorator for the div
27
29
  const contents = [];
28
30
  if (id && !(options === null || options === void 0 ? void 0 : options.hide.id)) {
29
31
  contents.push(`#${id}`);
30
32
  }
31
33
  if (clz && !(options === null || options === void 0 ? void 0 : options.hide.classes)) {
32
- const clzStr = clz.split(" ").map((cls) => `.${cls}`).join(" ");
34
+ const clzStr = clz
35
+ .split(' ')
36
+ .map(cls => `.${cls}`)
37
+ .join(' ');
33
38
  contents.push(clzStr);
34
39
  }
35
40
  if (otherAttrs && otherAttrs.length > 0 && !(options === null || options === void 0 ? void 0 : options.hide.attributes)) {
36
- const otherAttrStr = otherAttrs === null || otherAttrs === void 0 ? void 0 : otherAttrs.map((attr) => {
41
+ const otherAttrStr = otherAttrs === null || otherAttrs === void 0 ? void 0 : otherAttrs.map(attr => {
37
42
  return `${attr[0]}="${attr[1]}"`;
38
- }).join(" ");
43
+ }).join(' ');
39
44
  contents.push(otherAttrStr);
40
45
  }
41
46
  return decorator(contents, options === null || options === void 0 ? void 0 : options.customClass);
@@ -43,4 +48,3 @@ export const attributeDecorator = (token, options) => {
43
48
  const decoratorSpan = (contents) => {
44
49
  return `<span class="quarto-attribute-decorator-content">${contents}</span>`;
45
50
  };
46
- //# sourceMappingURL=html.js.map
@@ -13,4 +13,3 @@ export declare const addClass: (clz: string, attrs: null | [
13
13
  string,
14
14
  string
15
15
  ][];
16
- //# sourceMappingURL=markdownit.d.ts.map
@@ -1,45 +1,46 @@
1
1
  /*
2
- * markdownit.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
2
+ * markdownit.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
7
  export const hasClass = (clz, attrs) => {
8
8
  if (attrs === null) {
9
9
  return false;
10
10
  }
11
- const classes = readAttrValue("class", attrs);
11
+ const classes = readAttrValue('class', attrs);
12
12
  if (classes === null) {
13
13
  return false;
14
14
  }
15
15
  else {
16
- return classes === null || classes === void 0 ? void 0 : classes.split(" ").includes(clz);
16
+ return classes === null || classes === void 0 ? void 0 : classes.split(' ').includes(clz);
17
17
  }
18
18
  };
19
19
  export const readAttrValue = (name, attrs) => {
20
20
  if (attrs === null) {
21
21
  return undefined;
22
22
  }
23
- const attr = attrs.find((attr) => { return attr[0] === name; });
23
+ const attr = attrs.find(attr => {
24
+ return attr[0] === name;
25
+ });
24
26
  return attr ? attr[1] : undefined;
25
27
  };
26
28
  export const addClass = (clz, attrs) => {
27
29
  if (attrs === null) {
28
30
  attrs = [];
29
- attrs.push(["class", clz]);
31
+ attrs.push(['class', clz]);
30
32
  return attrs;
31
33
  }
32
34
  else {
33
- const clzIdx = attrs.findIndex((attr) => attr[0] === "class");
35
+ const clzIdx = attrs.findIndex(attr => attr[0] === 'class');
34
36
  if (clzIdx >= 0) {
35
37
  const currentClz = attrs[clzIdx];
36
- attrs[clzIdx] = ["class", `${currentClz[1]} ${clz}`.trim()];
38
+ attrs[clzIdx] = ['class', `${currentClz[1]} ${clz}`.trim()];
37
39
  return attrs;
38
40
  }
39
41
  else {
40
- attrs.push(["class", clz]);
42
+ attrs.push(['class', clz]);
41
43
  return attrs;
42
44
  }
43
45
  }
44
46
  };
45
- //# sourceMappingURL=markdownit.js.map
@@ -5,4 +5,3 @@ export declare const kTokTableOpen = "table_open";
5
5
  export declare const kTokTableClose = "table_close";
6
6
  export declare const kTokText = "text";
7
7
  export declare const kTokHeadingOpen = "heading_open";
8
- //# sourceMappingURL=tok.d.ts.map
@@ -1,14 +1,13 @@
1
1
  /*
2
- * tok.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
7
- export const kTokParaOpen = "paragraph_open";
8
- export const kTokParaClose = "paragraph_close";
9
- export const kTokInline = "inline";
10
- export const kTokTableOpen = "table_open";
11
- export const kTokTableClose = "table_close";
12
- export const kTokText = "text";
13
- export const kTokHeadingOpen = "heading_open";
14
- //# sourceMappingURL=tok.js.map
2
+ * tok.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ export const kTokParaOpen = 'paragraph_open';
8
+ export const kTokParaClose = 'paragraph_close';
9
+ export const kTokInline = 'inline';
10
+ export const kTokTableOpen = 'table_open';
11
+ export const kTokTableClose = 'table_close';
12
+ export const kTokText = 'text';
13
+ export const kTokHeadingOpen = 'heading_open';
@@ -1,3 +1,2 @@
1
- import MarkdownIt from "markdown-it";
1
+ import MarkdownIt from 'markdown-it';
2
2
  export declare function yamlPlugin(md: MarkdownIt, cb?: (yaml: unknown) => void): void;
3
- //# sourceMappingURL=yaml.d.ts.map
@@ -13,14 +13,14 @@
13
13
  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
14
14
  *
15
15
  */
16
- import * as yaml from "js-yaml";
17
- import { decorator } from "./utils/html";
16
+ import * as yaml from 'js-yaml';
17
+ import { decorator } from './utils/html';
18
18
  // Typescript version of https://github.com/parksb/markdown-it-front-matter
19
19
  // TODO: Rationalize this with quarto-core/src/markdownit-yaml.ts
20
20
  // This is a copy with rendering added - the core tokenizing function is identical (or should be)
21
21
  const kTokFrontMatter = 'front_matter';
22
22
  export function yamlPlugin(md, cb) {
23
- const min_markers = 3, marker_str = "-", marker_char = marker_str.charCodeAt(0), marker_len = marker_str.length;
23
+ const min_markers = 3, marker_str = '-', marker_char = marker_str.charCodeAt(0), marker_len = marker_str.length;
24
24
  function frontMatter(state, startLine, endLine, silent) {
25
25
  let pos, nextLine, start_content, user_closed = false, start = state.bMarks[startLine] + state.tShift[startLine], max = state.eMarks[startLine];
26
26
  // Check out the first character of the first line quickly,
@@ -54,7 +54,7 @@ export function yamlPlugin(md, cb) {
54
54
  // also block seems to be autoclosed by end of parent
55
55
  break;
56
56
  }
57
- if (state.src.slice(start, max) === "...") {
57
+ if (state.src.slice(start, max) === '...') {
58
58
  break;
59
59
  }
60
60
  start = state.bMarks[nextLine] + state.tShift[nextLine];
@@ -94,12 +94,12 @@ export function yamlPlugin(md, cb) {
94
94
  // Ensure that we have real yaml here
95
95
  const markup = state.src.slice(startLine, pos);
96
96
  const yaml = parseFrontMatterStr(markup);
97
- const isYamlBlock = yaml !== null && typeof (yaml) === "object";
97
+ const isYamlBlock = yaml !== null && typeof yaml === 'object';
98
98
  // If this is yaml, render it
99
99
  if (isYamlBlock && user_closed) {
100
100
  const old_parent = state.parentType;
101
101
  const old_line_max = state.lineMax;
102
- const token = state.push(kTokFrontMatter, "", 0);
102
+ const token = state.push(kTokFrontMatter, '', 0);
103
103
  token.hidden = true;
104
104
  token.markup = markup;
105
105
  token.block = true;
@@ -119,8 +119,8 @@ export function yamlPlugin(md, cb) {
119
119
  return false;
120
120
  }
121
121
  }
122
- md.block.ruler.before("table", kTokFrontMatter, frontMatter, {
123
- alt: ["paragraph", "reference", "blockquote", "list"],
122
+ md.block.ruler.before('table', kTokFrontMatter, frontMatter, {
123
+ alt: ['paragraph', 'reference', 'blockquote', 'list']
124
124
  });
125
125
  // Add rendering
126
126
  md.renderer.rules[kTokFrontMatter] = renderFrontMatter;
@@ -130,14 +130,14 @@ function renderFrontMatter(tokens, idx) {
130
130
  // Parse the markup
131
131
  const frontUnknown = parseFrontMatterStr(token.markup);
132
132
  // Extract important content
133
- if (typeof (frontUnknown) === "object") {
133
+ if (typeof frontUnknown === 'object') {
134
134
  const titleBlock = {};
135
135
  const frontMatter = frontUnknown;
136
136
  const readStr = (key) => {
137
137
  if (frontMatter[key] === undefined) {
138
138
  return undefined;
139
139
  }
140
- else if (typeof (frontMatter[key]) === "string") {
140
+ else if (typeof frontMatter[key] === 'string') {
141
141
  const val = frontMatter[key];
142
142
  delete frontMatter[key];
143
143
  return val;
@@ -147,12 +147,12 @@ function renderFrontMatter(tokens, idx) {
147
147
  }
148
148
  };
149
149
  // Read simple values
150
- titleBlock.title = readStr("title");
151
- titleBlock.subtitle = readStr("subtitle");
152
- titleBlock.abstract = readStr("abstract");
153
- titleBlock.date = readStr("date");
154
- titleBlock.modified = readStr("date-modified");
155
- titleBlock.doi = readStr("doi");
150
+ titleBlock.title = readStr('title');
151
+ titleBlock.subtitle = readStr('subtitle');
152
+ titleBlock.abstract = readStr('abstract');
153
+ titleBlock.date = readStr('date');
154
+ titleBlock.modified = readStr('date-modified');
155
+ titleBlock.doi = readStr('doi');
156
156
  // Read Authors
157
157
  titleBlock.authors = parseAuthor(frontMatter.author || frontMatter.authors);
158
158
  delete frontMatter.author;
@@ -164,22 +164,22 @@ function renderFrontMatter(tokens, idx) {
164
164
  titleLines.push(titleRendered);
165
165
  if (Object.keys(frontMatter).length > 0) {
166
166
  // decorator
167
- const decor = decorator(["Options"]);
167
+ const decor = decorator(['Options']);
168
168
  titleLines.push(decor);
169
169
  // yaml
170
170
  const yamlDump = yaml.dump(frontMatter);
171
171
  const otherYamlRendered = `<pre class="quarto-frontmatter-container"><code class="cm-s-jupyter language-yaml quarto-frontmatter">${yamlDump}</code></pre>`;
172
172
  titleLines.push(otherYamlRendered);
173
173
  }
174
- return titleLines.join("\n");
174
+ return titleLines.join('\n');
175
175
  }
176
176
  else {
177
- return "";
177
+ return '';
178
178
  }
179
179
  }
180
180
  // TODO: Use core function instead
181
181
  function parseFrontMatterStr(str) {
182
- str = str.replace(/---\s*$/, "");
182
+ str = str.replace(/---\s*$/, '');
183
183
  try {
184
184
  return yaml.load(str, { schema: yaml.FAILSAFE_SCHEMA });
185
185
  }
@@ -212,9 +212,11 @@ function renderTitle(titleBlock) {
212
212
  names.push({ value: author.name, padded: i > 0 });
213
213
  }
214
214
  // Place empty rows to allow affiliations to line up
215
- const emptyCount = author.affil ? Math.max(author.affil.length - 1, 0) : 0;
215
+ const emptyCount = author.affil
216
+ ? Math.max(author.affil.length - 1, 0)
217
+ : 0;
216
218
  for (let j = 0; j < emptyCount; j++) {
217
- names.push({ value: "&nbsp;" });
219
+ names.push({ value: '&nbsp;' });
218
220
  }
219
221
  // Collect affilations
220
222
  if (author.affil) {
@@ -222,26 +224,30 @@ function renderTitle(titleBlock) {
222
224
  const affil = author.affil[k];
223
225
  affils.push({
224
226
  value: affil,
225
- padded: i > 0 && k == 0
227
+ padded: i > 0 && k === 0
226
228
  });
227
229
  }
228
230
  }
229
231
  }
230
- const authLabel = names.length === 1 ? "Author" : "Authors";
232
+ const authLabel = names.length === 1 ? 'Author' : 'Authors';
231
233
  metadataBlocks.push(renderDocMeta(authLabel, names));
232
234
  if (affils.length > 0) {
233
- const affilLabel = affils.length === 1 ? "Affiliation" : "Affiliations";
235
+ const affilLabel = affils.length === 1 ? 'Affiliation' : 'Affiliations';
234
236
  metadataBlocks.push(renderDocMeta(affilLabel, affils));
235
237
  }
236
238
  }
237
239
  if (titleBlock.date) {
238
- metadataBlocks.push(renderDocMeta("Date", [{ value: titleBlock.date }]));
240
+ metadataBlocks.push(renderDocMeta('Date', [{ value: titleBlock.date }]));
239
241
  }
240
242
  if (titleBlock.modified) {
241
- metadataBlocks.push(renderDocMeta("Modified", [{ value: titleBlock.modified }]));
243
+ metadataBlocks.push(renderDocMeta('Modified', [{ value: titleBlock.modified }]));
242
244
  }
243
245
  if (titleBlock.doi) {
244
- metadataBlocks.push(renderDocMeta("DOI", [{ value: `<a href="https://doi.org/${titleBlock.doi}">${titleBlock.doi}</a>` }]));
246
+ metadataBlocks.push(renderDocMeta('DOI', [
247
+ {
248
+ value: `<a href="https://doi.org/${titleBlock.doi}">${titleBlock.doi}</a>`
249
+ }
250
+ ]));
245
251
  }
246
252
  if (metadataBlocks.length > 0) {
247
253
  rendered.push(renderDocMetas(metadataBlocks));
@@ -249,38 +255,41 @@ function renderTitle(titleBlock) {
249
255
  if (titleBlock.abstract) {
250
256
  rendered.push(`<p class="quarto-abstract">${titleBlock.abstract}</p>`);
251
257
  }
252
- return rendered.join("\n");
258
+ return rendered.join('\n');
253
259
  }
254
260
  function renderDocMetas(docMetas) {
255
261
  const rendered = [];
256
- rendered.push(`<div class="quarto-meta-block">`);
257
- docMetas.forEach((docMeta) => { rendered.push(docMeta); });
258
- rendered.push(`</div>`);
259
- return rendered.join("\n");
262
+ rendered.push('<div class="quarto-meta-block">');
263
+ docMetas.forEach(docMeta => {
264
+ rendered.push(docMeta);
265
+ });
266
+ rendered.push('</div>');
267
+ return rendered.join('\n');
260
268
  }
261
269
  function renderDocMeta(label, vals) {
262
270
  const rendered = [];
263
- rendered.push(`<div class="quarto-meta">`);
271
+ rendered.push('<div class="quarto-meta">');
264
272
  rendered.push(`<p class="quarto-meta-title">${label}</p>`);
265
- vals.forEach((val) => {
266
- const clz = val.padded ? ` class="quarto-meta-padded"` : "";
273
+ vals.forEach(val => {
274
+ const clz = val.padded ? ' class="quarto-meta-padded"' : '';
267
275
  rendered.push(`<p${clz}>${val.value}</p>`);
268
276
  });
269
- rendered.push(`</div>`);
270
- return rendered.join("\n");
277
+ rendered.push('</div>');
278
+ return rendered.join('\n');
271
279
  }
272
280
  function parseAuthor(author) {
281
+ var _a;
273
282
  const authorsRaw = Array.isArray(author) ? author : [author];
274
283
  const authors = [];
275
284
  for (const authorRaw of authorsRaw) {
276
- if (typeof (authorRaw) === "string") {
285
+ if (typeof authorRaw === 'string') {
277
286
  authors.push({
278
287
  name: authorRaw
279
288
  });
280
289
  }
281
- else if (typeof (authorRaw) === "object") {
290
+ else if (typeof authorRaw === 'object') {
282
291
  const str = (key, defaultValue) => {
283
- if (typeof (authorRaw[key]) === "string") {
292
+ if (typeof authorRaw[key] === 'string') {
284
293
  return authorRaw[key];
285
294
  }
286
295
  else {
@@ -288,33 +297,34 @@ function parseAuthor(author) {
288
297
  }
289
298
  };
290
299
  const affiliations = [];
291
- const affiliationSimple = str("affiliation");
300
+ const affiliationSimple = str('affiliation');
292
301
  if (affiliationSimple) {
293
302
  affiliations.push(affiliationSimple);
294
303
  }
295
304
  else if (authorRaw.affiliations) {
296
- const affils = Array.isArray(authorRaw.affiliations) ? authorRaw.affiliations : [authorRaw.affiliations];
305
+ const affils = Array.isArray(authorRaw.affiliations)
306
+ ? authorRaw.affiliations
307
+ : [authorRaw.affiliations];
297
308
  affils.forEach((affilRaw) => {
298
- if (typeof (affilRaw) === "string") {
309
+ if (typeof affilRaw === 'string') {
299
310
  affiliations.push(affilRaw);
300
311
  // eslint-disable-next-line no-constant-condition
301
312
  }
302
- else if (typeof (affilRaw === "object")) {
313
+ else if (typeof (affilRaw === 'object')) {
303
314
  const affilRecord = affilRaw;
304
315
  const name = affilRecord.name;
305
- if (typeof (name) === "string") {
316
+ if (typeof name === 'string') {
306
317
  affiliations.push(name);
307
318
  }
308
319
  }
309
320
  });
310
321
  }
311
322
  authors.push({
312
- name: str("name", ""),
313
- orcid: str("orcid"),
323
+ name: (_a = str('name', '')) !== null && _a !== void 0 ? _a : '',
324
+ orcid: str('orcid'),
314
325
  affil: affiliations
315
326
  });
316
327
  }
317
328
  }
318
329
  return authors;
319
330
  }
320
- //# sourceMappingURL=yaml.js.map
@@ -1,2 +1 @@
1
- export declare const attrs: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
- //# sourceMappingURL=attrs.d.ts.map
1
+ export declare const attrs: import("@jupyterlab/application").JupyterFrontEndPlugin<void>;
@@ -1,9 +1,9 @@
1
1
  /*
2
- * attrs.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
2
+ * attrs.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
7
  import { markdownItExtension } from './provider';
8
8
  export const attrs = markdownItExtension({
9
9
  id: '@quarto/attributes',
@@ -13,4 +13,3 @@ export const attrs = markdownItExtension({
13
13
  return [plugin.default];
14
14
  }
15
15
  });
16
- //# sourceMappingURL=attrs.js.map
@@ -1,2 +1 @@
1
- export declare const callouts: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
- //# sourceMappingURL=callouts.d.ts.map
1
+ export declare const callouts: import("@jupyterlab/application").JupyterFrontEndPlugin<void>;