@quarto/jupyterlab-quarto 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +71 -0
  3. package/lib/const.d.ts +5 -0
  4. package/lib/const.js +11 -0
  5. package/lib/const.js.map +1 -0
  6. package/lib/hooks/codemirror.d.ts +4 -0
  7. package/lib/hooks/codemirror.js +51 -0
  8. package/lib/hooks/codemirror.js.map +1 -0
  9. package/lib/index.d.ts +6 -0
  10. package/lib/index.js +57 -0
  11. package/lib/index.js.map +1 -0
  12. package/lib/manager.d.ts +8 -0
  13. package/lib/manager.js +116 -0
  14. package/lib/manager.js.map +1 -0
  15. package/lib/plugins/callouts.d.ts +3 -0
  16. package/lib/plugins/callouts.js +208 -0
  17. package/lib/plugins/callouts.js.map +1 -0
  18. package/lib/plugins/cites.d.ts +3 -0
  19. package/lib/plugins/cites.js +147 -0
  20. package/lib/plugins/cites.js.map +1 -0
  21. package/lib/plugins/decorator.d.ts +3 -0
  22. package/lib/plugins/decorator.js +58 -0
  23. package/lib/plugins/decorator.js.map +1 -0
  24. package/lib/plugins/divs.d.ts +6 -0
  25. package/lib/plugins/divs.js +99 -0
  26. package/lib/plugins/divs.js.map +1 -0
  27. package/lib/plugins/figure-divs.d.ts +3 -0
  28. package/lib/plugins/figure-divs.js +52 -0
  29. package/lib/plugins/figure-divs.js.map +1 -0
  30. package/lib/plugins/figures.d.ts +17 -0
  31. package/lib/plugins/figures.js +98 -0
  32. package/lib/plugins/figures.js.map +1 -0
  33. package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +8 -0
  34. package/lib/plugins/gridtables/common/gridtables/GetCells.js +44 -0
  35. package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +1 -0
  36. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +8 -0
  37. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +26 -0
  38. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +1 -0
  39. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +8 -0
  40. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +12 -0
  41. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +1 -0
  42. package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +5 -0
  43. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +66 -0
  44. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +1 -0
  45. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +9 -0
  46. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +18 -0
  47. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +1 -0
  48. package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +3 -0
  49. package/lib/plugins/gridtables/common/markdown-it/GetLine.js +9 -0
  50. package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +1 -0
  51. package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +4 -0
  52. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +161 -0
  53. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +1 -0
  54. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +13 -0
  55. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +17 -0
  56. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +1 -0
  57. package/lib/plugins/gridtables/index.d.ts +2 -0
  58. package/lib/plugins/gridtables/index.js +8 -0
  59. package/lib/plugins/gridtables/index.js.map +1 -0
  60. package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +11 -0
  61. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +5 -0
  62. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +1 -0
  63. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +7 -0
  64. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +5 -0
  65. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +1 -0
  66. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +4 -0
  67. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +5 -0
  68. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +1 -0
  69. package/lib/plugins/gridtables/rules/gridtable.d.ts +4 -0
  70. package/lib/plugins/gridtables/rules/gridtable.js +25 -0
  71. package/lib/plugins/gridtables/rules/gridtable.js.map +1 -0
  72. package/lib/plugins/math.d.ts +5 -0
  73. package/lib/plugins/math.js +174 -0
  74. package/lib/plugins/math.js.map +1 -0
  75. package/lib/plugins/mermaid/index.d.ts +3 -0
  76. package/lib/plugins/mermaid/index.js +53 -0
  77. package/lib/plugins/mermaid/index.js.map +1 -0
  78. package/lib/plugins/spans.d.ts +3 -0
  79. package/lib/plugins/spans.js +38 -0
  80. package/lib/plugins/table-captions.d.ts +3 -0
  81. package/lib/plugins/table-captions.js +74 -0
  82. package/lib/plugins/table-captions.js.map +1 -0
  83. package/lib/plugins/yaml.d.ts +3 -0
  84. package/lib/plugins/yaml.js +309 -0
  85. package/lib/plugins/yaml.js.map +1 -0
  86. package/lib/providers/attrs.d.ts +2 -0
  87. package/lib/providers/attrs.js +15 -0
  88. package/lib/providers/attrs.js.map +1 -0
  89. package/lib/providers/callouts.d.ts +2 -0
  90. package/lib/providers/callouts.js +15 -0
  91. package/lib/providers/callouts.js.map +1 -0
  92. package/lib/providers/cites.d.ts +2 -0
  93. package/lib/providers/cites.js +15 -0
  94. package/lib/providers/cites.js.map +1 -0
  95. package/lib/providers/decorator.d.ts +2 -0
  96. package/lib/providers/decorator.js +15 -0
  97. package/lib/providers/decorator.js.map +1 -0
  98. package/lib/providers/deflist.d.ts +2 -0
  99. package/lib/providers/deflist.js +15 -0
  100. package/lib/providers/deflist.js.map +1 -0
  101. package/lib/providers/divs.d.ts +2 -0
  102. package/lib/providers/divs.js +27 -0
  103. package/lib/providers/divs.js.map +1 -0
  104. package/lib/providers/figure-divs.d.ts +2 -0
  105. package/lib/providers/figure-divs.js +15 -0
  106. package/lib/providers/figure-divs.js.map +1 -0
  107. package/lib/providers/figures.d.ts +2 -0
  108. package/lib/providers/figures.js +15 -0
  109. package/lib/providers/figures.js.map +1 -0
  110. package/lib/providers/footnotes.d.ts +2 -0
  111. package/lib/providers/footnotes.js +15 -0
  112. package/lib/providers/footnotes.js.map +1 -0
  113. package/lib/providers/gridtables.d.ts +2 -0
  114. package/lib/providers/gridtables.js +15 -0
  115. package/lib/providers/gridtables.js.map +1 -0
  116. package/lib/providers/math.d.ts +2 -0
  117. package/lib/providers/math.js +104 -0
  118. package/lib/providers/math.js.map +1 -0
  119. package/lib/providers/mermaid.d.ts +2 -0
  120. package/lib/providers/mermaid.js +13 -0
  121. package/lib/providers/mermaid.js.map +1 -0
  122. package/lib/providers/provider.d.ts +4 -0
  123. package/lib/providers/provider.js +12 -0
  124. package/lib/providers/provider.js.map +1 -0
  125. package/lib/providers/spans.d.ts +2 -0
  126. package/lib/providers/spans.js +15 -0
  127. package/lib/providers/sub.d.ts +2 -0
  128. package/lib/providers/sub.js +15 -0
  129. package/lib/providers/sub.js.map +1 -0
  130. package/lib/providers/sup.d.ts +2 -0
  131. package/lib/providers/sup.js +15 -0
  132. package/lib/providers/sup.js.map +1 -0
  133. package/lib/providers/table-captions.d.ts +2 -0
  134. package/lib/providers/table-captions.js +15 -0
  135. package/lib/providers/table-captions.js.map +1 -0
  136. package/lib/providers/tasklists.d.ts +2 -0
  137. package/lib/providers/tasklists.js +15 -0
  138. package/lib/providers/tasklists.js.map +1 -0
  139. package/lib/providers/yaml.d.ts +2 -0
  140. package/lib/providers/yaml.js +15 -0
  141. package/lib/providers/yaml.js.map +1 -0
  142. package/lib/types.d.ts +44 -0
  143. package/lib/types.js +1 -0
  144. package/lib/types.js.map +1 -0
  145. package/lib/utils/html.d.ts +12 -0
  146. package/lib/utils/html.js +45 -0
  147. package/lib/utils/html.js.map +1 -0
  148. package/lib/utils/markdownit.d.ts +4 -0
  149. package/lib/utils/markdownit.js +44 -0
  150. package/lib/utils/markdownit.js.map +1 -0
  151. package/lib/utils/tok.d.ts +8 -0
  152. package/lib/utils/tok.js +13 -0
  153. package/lib/utils/tok.js.map +1 -0
  154. package/lib/widgets.d.ts +15 -0
  155. package/lib/widgets.js +57 -0
  156. package/lib/widgets.js.map +1 -0
  157. package/package.json +120 -0
  158. package/schema/plugin.json +8 -0
  159. package/src/@types/markdown-it-deflist.d.ts +10 -0
  160. package/src/@types/markdown-it-footnote.d.ts +10 -0
  161. package/src/@types/markdown-it-gridtables.d.ts +10 -0
  162. package/src/@types/markdown-it-implicit-figures.d.ts +10 -0
  163. package/src/@types/markdown-it-sub.d.ts +10 -0
  164. package/src/@types/markdown-it-sup.d.ts +10 -0
  165. package/src/@types/markdown-it-task-lists.d.ts +10 -0
  166. package/style/base.css +340 -0
  167. package/style/index.css +1 -0
  168. package/style/index.js +1 -0
@@ -0,0 +1,104 @@
1
+ /*
2
+ * math.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { mathjaxPlugin } from '../plugins/math';
8
+ import { markdownItExtension } from './provider';
9
+ export const math = markdownItExtension({
10
+ id: '@quarto/math',
11
+ title: 'LaTex Math',
12
+ plugin: async () => {
13
+ return [mathjaxPlugin];
14
+ },
15
+ hooks: {
16
+ postRender: {
17
+ run: (node) => {
18
+ // Inject mathjax
19
+ const mathjaxId = "MathJax-script";
20
+ const mathJaxScript = document.getElementById(mathjaxId);
21
+ if (!mathJaxScript) {
22
+ const configEl = document.createElement("script");
23
+ configEl.innerText = `
24
+
25
+ MathJax = {
26
+ svg: {
27
+ fontCache: 'global'
28
+ },
29
+ startup: {
30
+ typeset: false,
31
+ pageReady: () => {
32
+ MathJax.startup.promise.then(() => {
33
+
34
+ const typesetMath = (els) => {
35
+ MathJax.startup.promise = MathJax.startup.promise
36
+ .then(() => {
37
+ return MathJax.typesetPromise(els); }
38
+ )
39
+ .catch((err) => console.log('Typeset failed: ' + err.message));
40
+ return MathJax.startup.promise;
41
+ };
42
+
43
+ const typesetCellObserver = new MutationObserver((mutationList, observer) => {
44
+ const els = mutationList.map((list) => list.target);
45
+ const typesetEls = [];
46
+ for (const el of els) {
47
+ const childMathEls = el.querySelectorAll('.quarto-inline-math, .quarto-display-math');
48
+ if (childMathEls && childMathEls.length > 0) {
49
+ typesetEls.push(...childMathEls);
50
+ }
51
+ }
52
+ typesetMath(typesetEls);
53
+ });
54
+
55
+ const containerObserver = new MutationObserver((mutationList, observer) => {
56
+ const nodes = [];
57
+ mutationList.forEach((record) => {
58
+ for (const node of record.addedNodes) {
59
+ nodes.push(node);
60
+ }
61
+ });
62
+
63
+ const markdownNodes = nodes.filter((node) => {
64
+ return node.class.contains("jp-MarkdownCell");
65
+ }).forEach((node) => {
66
+ typesetCellObserver.observe(node, { childList: true, subtree: true });
67
+ });
68
+
69
+ });
70
+
71
+ const nbContainer = document.querySelector('.jp-Notebook');
72
+ if (nbContainer !== null) {
73
+ containerObserver.observe(nbContainer, { childList: true });
74
+ }
75
+
76
+ const mathEls = document.body.querySelectorAll('.quarto-inline-math, .quarto-display-math');
77
+ return typesetMath([...mathEls]).then(() => {
78
+ for (const mathEl of mathEls) {
79
+ typesetCellObserver.observe(mathEl.parentElement, { childList: true, subtree: true });
80
+ }
81
+ });
82
+ });
83
+ },
84
+ }
85
+ };`;
86
+ document.head.appendChild(configEl);
87
+ const polyFillEl = document.createElement("script");
88
+ polyFillEl.setAttribute("src", "https://polyfill.io/v3/polyfill.min.js?features=es6");
89
+ document.head.appendChild(polyFillEl);
90
+ const scriptEl = document.createElement("script");
91
+ scriptEl.id = mathjaxId;
92
+ scriptEl.setAttribute("src", "https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js");
93
+ document.head.appendChild(scriptEl);
94
+ }
95
+ return Promise.resolve();
96
+ }
97
+ }
98
+ }
99
+ });
100
+ /*
101
+ <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
102
+ <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
103
+
104
+ */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/providers/math.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAC;IACtC,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IACD,KAAK,EAAE;QACL,UAAU,EAAE;YACV,GAAG,EAAE,CAAC,IAAiB,EAAE,EAAE;gBAEzB,iBAAiB;gBACjB,MAAM,SAAS,GAAG,gBAAgB,CAAC;gBACnC,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;gBACzD,IAAI,CAAC,aAAa,EAAE;oBAElB,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBAClD,QAAQ,CAAC,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyC5B,CAAC;oBACM,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;oBAGpC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACpD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,qDAAqD,CAAC,CAAC;oBACtF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;oBAEtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBAClD,QAAQ,CAAC,EAAE,GAAG,SAAS,CAAC;oBACxB,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,iEAAiE,CAAC,CAAC;oBAChG,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;iBACrC;gBAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;SACF;KACF;CACF,CAAC,CAAC;AAEH;;;;EAIE"}
@@ -0,0 +1,2 @@
1
+ export declare const mermaid: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=mermaid.d.ts.map
@@ -0,0 +1,13 @@
1
+ /*
2
+ * mermaid.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import mermaidPlugin from '../plugins/mermaid';
8
+ import { markdownItExtension } from './provider';
9
+ export const mermaid = markdownItExtension({ id: '@quarto/mermaid',
10
+ title: 'Mermaid',
11
+ plugin: async () => {
12
+ return [mermaidPlugin];
13
+ } });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid.js","sourceRoot":"","sources":["../../src/providers/mermaid.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,OAAO,GAAG,mBAAmB,CACxC,EAAC,EAAE,EAAE,iBAAiB;IACtB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC,EAAC,CACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ import { MarkdownItPluginProvider } from '../types';
3
+ export declare function markdownItExtension(provider: MarkdownItPluginProvider): JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
4
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { kMarkdownItMgr, kPackageNamespace } from '../const';
2
+ export function markdownItExtension(provider) {
3
+ return {
4
+ id: `${kPackageNamespace}:${provider.id}`,
5
+ autoStart: true,
6
+ requires: [kMarkdownItMgr],
7
+ activate: (_app, manager) => {
8
+ console.log(`Quarto MarkdownIt plugin ${provider.id} is activated!`);
9
+ manager.registerPlugin(provider);
10
+ }
11
+ };
12
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/providers/provider.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7D,MAAM,UAAU,mBAAmB,CAAC,QAAkC;IAClE,OAAO;QACH,EAAE,EAAE,GAAG,iBAAiB,IAAI,QAAQ,CAAC,EAAE,EAAE;QACzC,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,CAAC,cAAc,CAAC;QAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,OAA0B,EAAE,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,4BAA4B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC;YACrE,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC;KAC2B,CAAC;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const spans: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=spans.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * spans.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { spansPlugin } from "../plugins/spans";
8
+ import { markdownItExtension } from "./provider";
9
+ export const spans = markdownItExtension({
10
+ id: '@quarto/spans',
11
+ title: 'Pandoc bracketed spans',
12
+ plugin: async () => {
13
+ return [spansPlugin];
14
+ },
15
+ });
@@ -0,0 +1,2 @@
1
+ export declare const sub: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=sub.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * sub.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { markdownItExtension } from './provider';
8
+ export const sub = markdownItExtension({
9
+ id: '@quarto/sub',
10
+ title: 'Subscript Text',
11
+ plugin: async () => {
12
+ const plugin = await import('markdown-it-sub');
13
+ return [plugin.default];
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub.js","sourceRoot":"","sources":["../../src/providers/sub.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,GAAG,GAAG,mBAAmB,CAAC;IACrC,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,MAAM,CACzB,iBAAiB,CAClB,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const sup: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=sup.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * sup.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { markdownItExtension } from './provider';
8
+ export const sup = markdownItExtension({
9
+ id: '@quarto/sup',
10
+ title: 'Superscript Text',
11
+ plugin: async () => {
12
+ const plugin = await import('markdown-it-sup');
13
+ return [plugin.default];
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sup.js","sourceRoot":"","sources":["../../src/providers/sup.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,GAAG,GAAG,mBAAmB,CAAC;IACrC,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,MAAM,CACzB,iBAAiB,CAClB,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const tableCaptions: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=table-captions.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * table-captions.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { tableCaptionPlugin } from '../plugins/table-captions';
8
+ import { markdownItExtension } from './provider';
9
+ export const tableCaptions = markdownItExtension({
10
+ id: '@quarto/tableCaptions',
11
+ title: 'Quarto Table Captions',
12
+ plugin: async () => {
13
+ return [tableCaptionPlugin];
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-captions.js","sourceRoot":"","sources":["../../src/providers/table-captions.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;IAC/C,EAAE,EAAE,uBAAuB;IAC3B,KAAK,EAAE,uBAAuB;IAC9B,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const tasklists: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=tasklists.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * tasklists.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { markdownItExtension } from './provider';
8
+ export const tasklists = markdownItExtension({
9
+ id: '@quarto/tasklists',
10
+ title: 'Task Lists',
11
+ plugin: async () => {
12
+ const plugin = await import('markdown-it-task-lists');
13
+ return [plugin.default];
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasklists.js","sourceRoot":"","sources":["../../src/providers/tasklists.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,SAAS,GAAG,mBAAmB,CAAC;IAC3C,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,MAAM,CACzB,wBAAwB,CACzB,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const yaml: import("@jupyterlab/application").JupyterFrontEndPlugin<void, import("@jupyterlab/application").JupyterFrontEnd.IShell, "desktop" | "mobile">;
2
+ //# sourceMappingURL=yaml.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * yaml-block.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { markdownitFrontMatterPlugin } from "../plugins/yaml";
8
+ import { markdownItExtension } from "./provider";
9
+ export const yaml = markdownItExtension({
10
+ id: '@quarto/yaml',
11
+ title: 'Quarto Yaml',
12
+ plugin: async () => {
13
+ return [markdownitFrontMatterPlugin];
14
+ }
15
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../src/providers/yaml.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAC;IACtC,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
package/lib/types.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ import { RenderedMarkdown } from './widgets';
3
+ import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
4
+ import { ISanitizer } from '@jupyterlab/apputils';
5
+ export interface MarkdownItManager {
6
+ registerPlugin(provider: MarkdownItPluginProvider): void;
7
+ getRenderer(widget: RenderedMarkdown, options?: MarkdownIt.Options): Promise<Renderer>;
8
+ }
9
+ export interface Ranked {
10
+ rank?: number;
11
+ }
12
+ export interface MarkdownItPlugin {
13
+ (md: MarkdownIt, ...params: any[]): void;
14
+ }
15
+ export interface Hook<A, V> extends Ranked {
16
+ run(arg: A): Promise<V>;
17
+ }
18
+ export interface MarkdownItPluginProvider extends Ranked {
19
+ id: string;
20
+ title: string;
21
+ plugin(): Promise<[MarkdownItPlugin, ...any]>;
22
+ options?(widget: RenderedMarkdown): Partial<MarkdownIt.Options>;
23
+ hooks?: {
24
+ preParse?: Hook<string, string>;
25
+ postRender?: Hook<HTMLElement, void>;
26
+ };
27
+ }
28
+ export interface RenderOptions {
29
+ host: HTMLElement;
30
+ source: string;
31
+ trusted: boolean;
32
+ sanitizer: ISanitizer;
33
+ resolver: IRenderMime.IResolver | null;
34
+ linkHandler: IRenderMime.ILinkHandler | null;
35
+ shouldTypeset: boolean;
36
+ renderer: Renderer;
37
+ latexTypesetter: IRenderMime.ILatexTypesetter | null;
38
+ }
39
+ export interface Renderer {
40
+ render(content: string): string;
41
+ preParse(node: string): Promise<string>;
42
+ postRender(node: HTMLElement): Promise<void>;
43
+ }
44
+ //# sourceMappingURL=types.d.ts.map
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import Token from "markdown-it/lib/token";
2
+ export interface DecoratorOptions {
3
+ customClass?: string;
4
+ hide: {
5
+ id?: boolean;
6
+ classes?: boolean;
7
+ attributes?: boolean;
8
+ };
9
+ }
10
+ export declare const decorator: (contents: string[], customClass?: string | undefined) => string;
11
+ export declare const attributeDecorator: (token: Token, options?: DecoratorOptions | undefined) => string;
12
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1,45 @@
1
+ /*
2
+ * html.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { readAttrValue } from "./markdownit";
8
+ export const decorator = (contents, customClass) => {
9
+ if (contents.length > 0) {
10
+ // Provide a decorator with the attributes
11
+ return `<div class="quarto-attribute-decorator${customClass ? ' ' + customClass : ""}">${contents.map(decoratorSpan).join("")}</div>`;
12
+ }
13
+ else {
14
+ // There is no decorator - no attributes
15
+ return "";
16
+ }
17
+ };
18
+ export const attributeDecorator = (token, options) => {
19
+ var _a;
20
+ // id
21
+ const id = readAttrValue("id", token.attrs);
22
+ // classes
23
+ const clz = readAttrValue("class", token.attrs);
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"; });
26
+ // Create a decorator for the div
27
+ const contents = [];
28
+ if (id && !(options === null || options === void 0 ? void 0 : options.hide.id)) {
29
+ contents.push(`#${id}`);
30
+ }
31
+ if (clz && !(options === null || options === void 0 ? void 0 : options.hide.classes)) {
32
+ const clzStr = clz.split(" ").map((cls) => `.${cls}`).join(" ");
33
+ contents.push(clzStr);
34
+ }
35
+ 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) => {
37
+ return `${attr[0]}="${attr[1]}"`;
38
+ }).join(" ");
39
+ contents.push(otherAttrStr);
40
+ }
41
+ return decorator(contents, options === null || options === void 0 ? void 0 : options.customClass);
42
+ };
43
+ const decoratorSpan = (contents) => {
44
+ return `<span class="quarto-attribute-decorator-content">${contents}</span>`;
45
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAGF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAW7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAkB,EAAE,WAAoB,EAAE,EAAE;IACpE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACvB,0CAA0C;QAC1C,OAAO,yCAAyC,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAA;KACtI;SAAM;QACL,wCAAwC;QACxC,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAE,OAA0B,EAAE,EAAE;;IAC7E,KAAK;IACL,MAAM,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAE5C,UAAU;IACV,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAEhD,mBAAmB;IACnB,MAAM,UAAU,SAAG,KAAK,CAAC,KAAK,0CAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAA,CAAA,CAAC,CAAC,CAAC;IAEpG,iCAAiC;IACjC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,EAAE,IAAI,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,EAAE,CAAA,EAAE;QAC3B,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KACzB;IACD,IAAI,GAAG,IAAI,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,OAAO,CAAA,EAAE;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvB;IACD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,UAAU,CAAA,EAAE;QACpE,MAAM,YAAY,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAA;QAClC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC7B;IACD,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC,CAAC;AACnD,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,EAAE;IACzC,OAAO,oDAAoD,QAAQ,SAAS,CAAA;AAC9E,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export declare const hasClass: (clz: string, attrs: null | [string, string][]) => boolean | undefined;
2
+ export declare const readAttrValue: (name: string, attrs: null | [string, string][]) => string | undefined;
3
+ export declare const addClass: (clz: string, attrs: null | [string, string][]) => [string, string][];
4
+ //# sourceMappingURL=markdownit.d.ts.map
@@ -0,0 +1,44 @@
1
+ /*
2
+ * markdownit.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ export const hasClass = (clz, attrs) => {
8
+ if (attrs === null) {
9
+ return false;
10
+ }
11
+ const classes = readAttrValue("class", attrs);
12
+ if (classes === null) {
13
+ return false;
14
+ }
15
+ else {
16
+ return classes === null || classes === void 0 ? void 0 : classes.split(" ").includes(clz);
17
+ }
18
+ };
19
+ export const readAttrValue = (name, attrs) => {
20
+ if (attrs === null) {
21
+ return undefined;
22
+ }
23
+ const attr = attrs.find((attr) => { return attr[0] === name; });
24
+ return attr ? attr[1] : undefined;
25
+ };
26
+ export const addClass = (clz, attrs) => {
27
+ if (attrs === null) {
28
+ attrs = [];
29
+ attrs.push(["class", clz]);
30
+ return attrs;
31
+ }
32
+ else {
33
+ const clzIdx = attrs.findIndex((attr) => attr[0] === "class");
34
+ if (clzIdx >= 0) {
35
+ const currentClz = attrs[clzIdx];
36
+ attrs[clzIdx] = ["class", `${currentClz[1]} ${clz}`.trim()];
37
+ return attrs;
38
+ }
39
+ else {
40
+ attrs.push(["class", clz]);
41
+ return attrs;
42
+ }
43
+ }
44
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownit.js","sourceRoot":"","sources":["../../src/utils/markdownit.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAgC,EAAE,EAAE;IACxE,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,KAAK,CAAC;KACd;SAAM;QACL,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE;KAC1C;AAGH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,KAAgC,EAAE,EAAE;IAC9E,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,KAAgC,EAAsB,EAAE;IAC5F,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,KAAK,GAAG,EAAE,CAAA;QACV,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;QAC1B,OAAO,KAAK,CAAC;KACd;SAAM;QACL,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QAC9D,IAAI,MAAM,IAAI,CAAC,EAAE;YACf,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5D,OAAO,KAAK,CAAC;SACd;aAAM;YACL,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;YAC1B,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ export declare const kTokParaOpen = "paragraph_open";
2
+ export declare const kTokParaClose = "paragraph_close";
3
+ export declare const kTokInline = "inline";
4
+ export declare const kTokTableOpen = "table_open";
5
+ export declare const kTokTableClose = "table_close";
6
+ export declare const kTokText = "text";
7
+ export declare const kTokHeadingOpen = "heading_open";
8
+ //# sourceMappingURL=tok.d.ts.map
@@ -0,0 +1,13 @@
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";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tok.js","sourceRoot":"","sources":["../../src/utils/tok.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAGF,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAC7C,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { RenderedHTMLCommon } from '@jupyterlab/rendermime';
2
+ import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
3
+ import { Message } from '@lumino/messaging';
4
+ import { MarkdownItManager, Renderer } from './types';
5
+ export declare class RenderedMarkdown extends RenderedHTMLCommon {
6
+ constructor(options: IRenderMime.IRendererOptions, manager: MarkdownItManager);
7
+ private markdownItManager;
8
+ render(model: IRenderMime.IMimeModel): Promise<void>;
9
+ renderer: Renderer | null;
10
+ /**
11
+ * A message handler invoked on an `'after-attach'` message.
12
+ */
13
+ onAfterAttach(msg: Message): void;
14
+ }
15
+ //# sourceMappingURL=widgets.d.ts.map
package/lib/widgets.js ADDED
@@ -0,0 +1,57 @@
1
+ /*
2
+ * widgets.ts
3
+ *
4
+ * Copyright (C) 2020-2023 Posit Software, PBC
5
+ *
6
+ */
7
+ import { RenderedHTMLCommon, renderHTML } from '@jupyterlab/rendermime';
8
+ // A mime rendered that renders Quarto Markdown
9
+ export class RenderedMarkdown extends RenderedHTMLCommon {
10
+ constructor(options, manager) {
11
+ super(options);
12
+ this.renderer = null;
13
+ this.addClass('quarto-rendered-md');
14
+ this.markdownItManager = manager;
15
+ }
16
+ // Renders a mime model
17
+ async render(model) {
18
+ if (this.renderer === null) {
19
+ this.renderer = await this.markdownItManager.getRenderer(this, {});
20
+ }
21
+ const { host, source, renderer, ...others } = {
22
+ host: this.node,
23
+ source: String(model.data[this.mimeType]),
24
+ trusted: model.trusted,
25
+ resolver: this.resolver,
26
+ sanitizer: this.sanitizer,
27
+ linkHandler: this.linkHandler,
28
+ shouldTypeset: this.isAttached,
29
+ renderer: this.renderer,
30
+ latexTypesetter: this.latexTypesetter
31
+ };
32
+ // Transform source
33
+ const markup = await renderer.preParse(source);
34
+ // Clear the content if there is no source.
35
+ if (!markup) {
36
+ host.textContent = '';
37
+ return;
38
+ }
39
+ // Render HTML.
40
+ await renderHTML({
41
+ host,
42
+ source: renderer.render(markup),
43
+ ...others,
44
+ shouldTypeset: false
45
+ });
46
+ await renderer.postRender(host);
47
+ }
48
+ /**
49
+ * A message handler invoked on an `'after-attach'` message.
50
+ */
51
+ onAfterAttach(msg) {
52
+ // Don't render math automatically
53
+ // if (this.latexTypesetter ) {
54
+ // this.latexTypesetter.typeset(this.node);
55
+ // }
56
+ }
57
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.js","sourceRoot":"","sources":["../src/widgets.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKxE,+CAA+C;AAC/C,MAAM,OAAO,gBAAiB,SAAQ,kBAAkB;IAEtD,YAAY,OAAqC,EAAE,OAA0B;QAC3E,KAAK,CAAC,OAAO,CAAC,CAAC;QA0CjB,aAAQ,GAAoB,IAAI,CAAC;QAzC/B,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC;IACnC,CAAC;IAGD,uBAAuB;IACvB,KAAK,CAAC,MAAM,CAAC,KAA6B;QACxC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC1B,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACpE;QAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG;YAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EAAE,IAAI,CAAC,UAAU;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;QAEF,mBAAmB;QACnB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/C,2CAA2C;QAC3C,IAAI,CAAC,MAAM,EAAE;YACX,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,OAAO;SACR;QAED,eAAe;QACf,MAAM,UAAU,CAAC;YACf,IAAI;YACJ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YAC/B,GAAG,MAAM;YACT,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;QACH,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAGD;;OAEG;IACH,aAAa,CAAC,GAAY;QACxB,kCAAkC;QAClC,+BAA+B;QAC/B,6CAA6C;QAC7C,IAAI;IACN,CAAC;CACF"}