@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.
- package/lib/__tests__/index.spec.d.ts +6 -0
- package/lib/__tests__/index.spec.js +61 -0
- package/lib/__tests__/index.spec.js.map +1 -0
- package/lib/__tests__/myextension.spec.d.ts +6 -0
- package/lib/__tests__/myextension.spec.js +11 -0
- package/lib/__tests__/myextension.spec.js.map +1 -0
- package/lib/ast/ast.d.ts +3 -0
- package/lib/ast/ast.js +39 -0
- package/lib/ast/ast.js.map +1 -0
- package/lib/const.d.ts +5 -0
- package/lib/const.js +12 -0
- package/lib/const.js.map +1 -0
- package/lib/hooks/codemirror.d.ts +4 -0
- package/lib/hooks/codemirror.js +52 -0
- package/lib/hooks/codemirror.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +60 -0
- package/lib/index.js.map +1 -0
- package/lib/manager.d.ts +8 -0
- package/lib/manager.js +117 -0
- package/lib/manager.js.map +1 -0
- package/lib/plugins/callouts.d.ts +3 -0
- package/lib/plugins/callouts.js +209 -0
- package/lib/plugins/callouts.js.map +1 -0
- package/lib/plugins/cites.d.ts +3 -0
- package/lib/plugins/cites.js +148 -0
- package/lib/plugins/cites.js.map +1 -0
- package/lib/plugins/decorator.d.ts +3 -0
- package/lib/plugins/decorator.js +59 -0
- package/lib/plugins/decorator.js.map +1 -0
- package/lib/plugins/divs.d.ts +6 -0
- package/lib/plugins/divs.js +100 -0
- package/lib/plugins/divs.js.map +1 -0
- package/lib/plugins/figure-divs.d.ts +3 -0
- package/lib/plugins/figure-divs.js +53 -0
- package/lib/plugins/figure-divs.js.map +1 -0
- package/lib/plugins/figures.d.ts +17 -0
- package/lib/plugins/figures.js +99 -0
- package/lib/plugins/figures.js.map +1 -0
- package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +8 -0
- package/lib/plugins/gridtables/common/gridtables/GetCells.js +45 -0
- package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +1 -0
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +8 -0
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +27 -0
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +8 -0
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +13 -0
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +5 -0
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +67 -0
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +9 -0
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +19 -0
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +3 -0
- package/lib/plugins/gridtables/common/markdown-it/GetLine.js +10 -0
- package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +4 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +162 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +1 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +13 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +18 -0
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +1 -0
- package/lib/plugins/gridtables/index.d.ts +2 -0
- package/lib/plugins/gridtables/index.js +11 -0
- package/lib/plugins/gridtables/index.js.map +1 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +11 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +6 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +1 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +7 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +6 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +1 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +4 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +6 -0
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +1 -0
- package/lib/plugins/gridtables/rules/gridtable.d.ts +4 -0
- package/lib/plugins/gridtables/rules/gridtable.js +26 -0
- package/lib/plugins/gridtables/rules/gridtable.js.map +1 -0
- package/lib/plugins/math.d.ts +5 -0
- package/lib/plugins/math.js +177 -0
- package/lib/plugins/math.js.map +1 -0
- package/lib/plugins/mermaid/index.d.ts +5 -0
- package/lib/plugins/mermaid/index.js +55 -0
- package/lib/plugins/mermaid/index.js.map +1 -0
- package/lib/plugins/shortcodes.d.ts +4 -0
- package/lib/plugins/shortcodes.js +33 -0
- package/lib/plugins/shortcodes.js.map +1 -0
- package/lib/plugins/spans.d.ts +3 -0
- package/lib/plugins/spans.js +39 -0
- package/lib/plugins/spans.js.map +1 -0
- package/lib/plugins/table-captions.d.ts +3 -0
- package/lib/plugins/table-captions.js +69 -0
- package/lib/plugins/table-captions.js.map +1 -0
- package/lib/plugins/utils/html.d.ts +12 -0
- package/lib/plugins/utils/html.js +46 -0
- package/lib/plugins/utils/html.js.map +1 -0
- package/lib/plugins/utils/markdownit.d.ts +16 -0
- package/lib/plugins/utils/markdownit.js +45 -0
- package/lib/plugins/utils/markdownit.js.map +1 -0
- package/lib/plugins/utils/tok.d.ts +8 -0
- package/lib/plugins/utils/tok.js +14 -0
- package/lib/plugins/utils/tok.js.map +1 -0
- package/lib/plugins/yaml.d.ts +3 -0
- package/lib/plugins/yaml.js +320 -0
- package/lib/plugins/yaml.js.map +1 -0
- package/lib/providers/attrs.d.ts +2 -0
- package/lib/providers/attrs.js +16 -0
- package/lib/providers/attrs.js.map +1 -0
- package/lib/providers/callouts.d.ts +2 -0
- package/lib/providers/callouts.js +16 -0
- package/lib/providers/callouts.js.map +1 -0
- package/lib/providers/cites.d.ts +2 -0
- package/lib/providers/cites.js +16 -0
- package/lib/providers/cites.js.map +1 -0
- package/lib/providers/decorator.d.ts +2 -0
- package/lib/providers/decorator.js +16 -0
- package/lib/providers/decorator.js.map +1 -0
- package/lib/providers/deflist.d.ts +2 -0
- package/lib/providers/deflist.js +16 -0
- package/lib/providers/deflist.js.map +1 -0
- package/lib/providers/divs.d.ts +2 -0
- package/lib/providers/divs.js +28 -0
- package/lib/providers/divs.js.map +1 -0
- package/lib/providers/figure-divs.d.ts +2 -0
- package/lib/providers/figure-divs.js +16 -0
- package/lib/providers/figure-divs.js.map +1 -0
- package/lib/providers/figures.d.ts +2 -0
- package/lib/providers/figures.js +16 -0
- package/lib/providers/figures.js.map +1 -0
- package/lib/providers/footnotes.d.ts +2 -0
- package/lib/providers/footnotes.js +16 -0
- package/lib/providers/footnotes.js.map +1 -0
- package/lib/providers/gridtables.d.ts +2 -0
- package/lib/providers/gridtables.js +16 -0
- package/lib/providers/gridtables.js.map +1 -0
- package/lib/providers/math.d.ts +2 -0
- package/lib/providers/math.js +105 -0
- package/lib/providers/math.js.map +1 -0
- package/lib/providers/mermaid.d.ts +2 -0
- package/lib/providers/mermaid.js +16 -0
- package/lib/providers/mermaid.js.map +1 -0
- package/lib/providers/provider.d.ts +4 -0
- package/lib/providers/provider.js +13 -0
- package/lib/providers/provider.js.map +1 -0
- package/lib/providers/shortcodes.d.ts +2 -0
- package/lib/providers/shortcodes.js +16 -0
- package/lib/providers/shortcodes.js.map +1 -0
- package/lib/providers/spans.d.ts +2 -0
- package/lib/providers/spans.js +16 -0
- package/lib/providers/spans.js.map +1 -0
- package/lib/providers/sub.d.ts +2 -0
- package/lib/providers/sub.js +16 -0
- package/lib/providers/sub.js.map +1 -0
- package/lib/providers/sup.d.ts +2 -0
- package/lib/providers/sup.js +16 -0
- package/lib/providers/sup.js.map +1 -0
- package/lib/providers/table-captions.d.ts +2 -0
- package/lib/providers/table-captions.js +16 -0
- package/lib/providers/table-captions.js.map +1 -0
- package/lib/providers/tasklists.d.ts +2 -0
- package/lib/providers/tasklists.js +16 -0
- package/lib/providers/tasklists.js.map +1 -0
- package/lib/providers/yaml.d.ts +2 -0
- package/lib/providers/yaml.js +16 -0
- package/lib/providers/yaml.js.map +1 -0
- package/lib/types.d.ts +44 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/widgets.d.ts +15 -0
- package/lib/widgets.js +58 -0
- package/lib/widgets.js.map +1 -0
- package/package.json +1 -1
@@ -0,0 +1,105 @@
|
|
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
|
+
*/
|
105
|
+
//# sourceMappingURL=math.js.map
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8D5B,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,16 @@
|
|
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
|
+
// Figure out whether this is dark mode
|
13
|
+
const isDark = document.body.getAttribute("data-jp-theme-light") === "false";
|
14
|
+
return [mermaidPlugin, { dark: isDark }];
|
15
|
+
} });
|
16
|
+
//# sourceMappingURL=mermaid.js.map
|
@@ -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,uCAAuC;QACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,KAAK,OAAO,CAAC;QAE7E,OAAO,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3C,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,13 @@
|
|
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
|
+
}
|
13
|
+
//# sourceMappingURL=provider.js.map
|
@@ -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,16 @@
|
|
1
|
+
/*
|
2
|
+
* shortcodes.ts
|
3
|
+
*
|
4
|
+
* Copyright (C) 2020-2023 Posit Software, PBC
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
import { shortcodePlugin } from '../plugins/shortcodes';
|
8
|
+
import { markdownItExtension } from './provider';
|
9
|
+
export const shortcodes = markdownItExtension({
|
10
|
+
id: '@quarto/shortcode',
|
11
|
+
title: 'Shortcodes',
|
12
|
+
plugin: async () => {
|
13
|
+
return [shortcodePlugin];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=shortcodes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shortcodes.js","sourceRoot":"","sources":["../../src/providers/shortcodes.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC;IAC5C,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
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
|
+
});
|
16
|
+
//# sourceMappingURL=spans.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spans.js","sourceRoot":"","sources":["../../src/providers/spans.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,CAAC,MAAM,KAAK,GAAG,mBAAmB,CAAC;IACvC,EAAE,EAAE,eAAe;IACnB,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC;CACF,CAAC,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
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
|
+
});
|
16
|
+
//# sourceMappingURL=sub.js.map
|
@@ -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,16 @@
|
|
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
|
+
});
|
16
|
+
//# sourceMappingURL=sup.js.map
|
@@ -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,16 @@
|
|
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
|
+
});
|
16
|
+
//# sourceMappingURL=table-captions.js.map
|
@@ -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,16 @@
|
|
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
|
+
});
|
16
|
+
//# sourceMappingURL=tasklists.js.map
|
@@ -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,16 @@
|
|
1
|
+
/*
|
2
|
+
* yaml-block.ts
|
3
|
+
*
|
4
|
+
* Copyright (C) 2020-2023 Posit Software, PBC
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
import { yamlPlugin } 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 [yamlPlugin];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
//# sourceMappingURL=yaml.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../src/providers/yaml.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,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,UAAU,CAAC,CAAC;IACtB,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
package/lib/types.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/lib/widgets.d.ts
ADDED
@@ -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,58 @@
|
|
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
|
+
}
|
58
|
+
//# sourceMappingURL=widgets.js.map
|
@@ -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"}
|