@quarto/jupyterlab-quarto 0.1.41 → 0.1.44
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -3
- package/package.json +1 -1
- package/style/base.css +4 -0
- package/lib/__tests__/index.spec.d.ts +0 -6
- package/lib/__tests__/index.spec.js +0 -60
- package/lib/__tests__/index.spec.js.map +0 -1
- package/lib/__tests__/myextension.spec.d.ts +0 -6
- package/lib/__tests__/myextension.spec.js +0 -10
- package/lib/__tests__/myextension.spec.js.map +0 -1
- package/lib/ast/ast.d.ts +0 -3
- package/lib/ast/ast.js +0 -38
- package/lib/ast/ast.js.map +0 -1
- package/lib/const.d.ts +0 -5
- package/lib/const.js +0 -11
- package/lib/const.js.map +0 -1
- package/lib/hooks/codemirror.d.ts +0 -4
- package/lib/hooks/codemirror.js +0 -51
- package/lib/hooks/codemirror.js.map +0 -1
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -59
- package/lib/index.js.map +0 -1
- package/lib/manager.d.ts +0 -8
- package/lib/manager.js +0 -116
- package/lib/manager.js.map +0 -1
- package/lib/plugins/callouts.d.ts +0 -3
- package/lib/plugins/callouts.js +0 -208
- package/lib/plugins/callouts.js.map +0 -1
- package/lib/plugins/cites.d.ts +0 -3
- package/lib/plugins/cites.js +0 -147
- package/lib/plugins/cites.js.map +0 -1
- package/lib/plugins/decorator.d.ts +0 -3
- package/lib/plugins/decorator.js +0 -58
- package/lib/plugins/decorator.js.map +0 -1
- package/lib/plugins/divs.d.ts +0 -6
- package/lib/plugins/divs.js +0 -99
- package/lib/plugins/divs.js.map +0 -1
- package/lib/plugins/figure-divs.d.ts +0 -3
- package/lib/plugins/figure-divs.js +0 -52
- package/lib/plugins/figure-divs.js.map +0 -1
- package/lib/plugins/figures.d.ts +0 -17
- package/lib/plugins/figures.js +0 -98
- package/lib/plugins/figures.js.map +0 -1
- package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +0 -8
- package/lib/plugins/gridtables/common/gridtables/GetCells.js +0 -44
- package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +0 -1
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +0 -8
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +0 -26
- package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +0 -8
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +0 -12
- package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +0 -5
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +0 -66
- package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +0 -9
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +0 -18
- package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +0 -3
- package/lib/plugins/gridtables/common/markdown-it/GetLine.js +0 -9
- package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +0 -4
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +0 -161
- package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +0 -1
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +0 -13
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +0 -17
- package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +0 -1
- package/lib/plugins/gridtables/index.d.ts +0 -2
- package/lib/plugins/gridtables/index.js +0 -8
- package/lib/plugins/gridtables/index.js.map +0 -1
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +0 -11
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +0 -5
- package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +0 -1
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +0 -7
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +0 -5
- package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +0 -1
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +0 -4
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +0 -5
- package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +0 -1
- package/lib/plugins/gridtables/rules/gridtable.d.ts +0 -4
- package/lib/plugins/gridtables/rules/gridtable.js +0 -25
- package/lib/plugins/gridtables/rules/gridtable.js.map +0 -1
- package/lib/plugins/math.d.ts +0 -5
- package/lib/plugins/math.js +0 -174
- package/lib/plugins/math.js.map +0 -1
- package/lib/plugins/mermaid/index.d.ts +0 -3
- package/lib/plugins/mermaid/index.js +0 -53
- package/lib/plugins/mermaid/index.js.map +0 -1
- package/lib/plugins/shortcodes.d.ts +0 -4
- package/lib/plugins/shortcodes.js +0 -32
- package/lib/plugins/shortcodes.js.map +0 -1
- package/lib/plugins/spans.d.ts +0 -3
- package/lib/plugins/spans.js +0 -38
- package/lib/plugins/spans.js.map +0 -1
- package/lib/plugins/table-captions.d.ts +0 -3
- package/lib/plugins/table-captions.js +0 -74
- package/lib/plugins/table-captions.js.map +0 -1
- package/lib/plugins/yaml.d.ts +0 -3
- package/lib/plugins/yaml.js +0 -309
- package/lib/plugins/yaml.js.map +0 -1
- package/lib/providers/attrs.d.ts +0 -2
- package/lib/providers/attrs.js +0 -15
- package/lib/providers/attrs.js.map +0 -1
- package/lib/providers/callouts.d.ts +0 -2
- package/lib/providers/callouts.js +0 -15
- package/lib/providers/callouts.js.map +0 -1
- package/lib/providers/cites.d.ts +0 -2
- package/lib/providers/cites.js +0 -15
- package/lib/providers/cites.js.map +0 -1
- package/lib/providers/decorator.d.ts +0 -2
- package/lib/providers/decorator.js +0 -15
- package/lib/providers/decorator.js.map +0 -1
- package/lib/providers/deflist.d.ts +0 -2
- package/lib/providers/deflist.js +0 -15
- package/lib/providers/deflist.js.map +0 -1
- package/lib/providers/divs.d.ts +0 -2
- package/lib/providers/divs.js +0 -27
- package/lib/providers/divs.js.map +0 -1
- package/lib/providers/figure-divs.d.ts +0 -2
- package/lib/providers/figure-divs.js +0 -15
- package/lib/providers/figure-divs.js.map +0 -1
- package/lib/providers/figures.d.ts +0 -2
- package/lib/providers/figures.js +0 -15
- package/lib/providers/figures.js.map +0 -1
- package/lib/providers/footnotes.d.ts +0 -2
- package/lib/providers/footnotes.js +0 -15
- package/lib/providers/footnotes.js.map +0 -1
- package/lib/providers/gridtables.d.ts +0 -2
- package/lib/providers/gridtables.js +0 -15
- package/lib/providers/gridtables.js.map +0 -1
- package/lib/providers/math.d.ts +0 -2
- package/lib/providers/math.js +0 -104
- package/lib/providers/math.js.map +0 -1
- package/lib/providers/mermaid.d.ts +0 -2
- package/lib/providers/mermaid.js +0 -13
- package/lib/providers/mermaid.js.map +0 -1
- package/lib/providers/provider.d.ts +0 -4
- package/lib/providers/provider.js +0 -12
- package/lib/providers/provider.js.map +0 -1
- package/lib/providers/shortcodes.d.ts +0 -2
- package/lib/providers/shortcodes.js +0 -15
- package/lib/providers/shortcodes.js.map +0 -1
- package/lib/providers/spans.d.ts +0 -2
- package/lib/providers/spans.js +0 -15
- package/lib/providers/spans.js.map +0 -1
- package/lib/providers/sub.d.ts +0 -2
- package/lib/providers/sub.js +0 -15
- package/lib/providers/sub.js.map +0 -1
- package/lib/providers/sup.d.ts +0 -2
- package/lib/providers/sup.js +0 -15
- package/lib/providers/sup.js.map +0 -1
- package/lib/providers/table-captions.d.ts +0 -2
- package/lib/providers/table-captions.js +0 -15
- package/lib/providers/table-captions.js.map +0 -1
- package/lib/providers/tasklists.d.ts +0 -2
- package/lib/providers/tasklists.js +0 -15
- package/lib/providers/tasklists.js.map +0 -1
- package/lib/providers/yaml.d.ts +0 -2
- package/lib/providers/yaml.js +0 -15
- package/lib/providers/yaml.js.map +0 -1
- package/lib/types.d.ts +0 -44
- package/lib/types.js +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils/html.d.ts +0 -12
- package/lib/utils/html.js +0 -45
- package/lib/utils/html.js.map +0 -1
- package/lib/utils/markdownit.d.ts +0 -16
- package/lib/utils/markdownit.js +0 -44
- package/lib/utils/markdownit.js.map +0 -1
- package/lib/utils/tok.d.ts +0 -8
- package/lib/utils/tok.js +0 -13
- package/lib/utils/tok.js.map +0 -1
- package/lib/widgets.d.ts +0 -15
- package/lib/widgets.js +0 -57
- package/lib/widgets.js.map +0 -1
@@ -1,5 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bas Verweij. All rights reserved.
|
3
|
-
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"IToken.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/interfaces/markdown-it/IToken.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bas Verweij. All rights reserved.
|
3
|
-
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TRuleFunction.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/interfaces/markdown-it/TRuleFunction.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bas Verweij. All rights reserved.
|
3
|
-
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
import emitTable from "../common/markdown-it/EmitTable";
|
6
|
-
import getCharCodeAtStartOfLine from "../common/markdown-it/GetCharCodeAtStartOfLine";
|
7
|
-
import parseTable from "../common/markdown-it/ParseTable";
|
8
|
-
export default function gridTableRule(md) {
|
9
|
-
return function (state, startLine, endLine, silent) {
|
10
|
-
if (getCharCodeAtStartOfLine(state, startLine) !== 0x2B) {
|
11
|
-
// line does not start with a '+'
|
12
|
-
return false;
|
13
|
-
}
|
14
|
-
let parseResult = parseTable(state, startLine, endLine);
|
15
|
-
if (!parseResult.Success) {
|
16
|
-
return false;
|
17
|
-
}
|
18
|
-
if (silent) {
|
19
|
-
return true;
|
20
|
-
}
|
21
|
-
emitTable(md, state, parseResult);
|
22
|
-
state.line = parseResult.CurrentLine;
|
23
|
-
return true;
|
24
|
-
};
|
25
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"gridtable.js","sourceRoot":"","sources":["../../../../src/plugins/gridtables/rules/gridtable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,wBAAwB,MAAM,gDAAgD,CAAC;AACtF,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAI1D,MAAM,CAAC,OAAO,UAAU,aAAa,CACjC,EAAc;IAGd,OAAO,UACH,KAAa,EACb,SAAiB,EACjB,OAAe,EACf,MAAe;QAGf,IAAI,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,EACvD;YACI,iCAAiC;YACjC,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,WAAW,GAAG,UAAU,CACxB,KAAK,EACL,SAAS,EACT,OAAO,CAAC,CAAC;QAEb,IAAI,CAAC,WAAW,CAAC,OAAO,EACxB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,MAAM,EACV;YACI,OAAO,IAAI,CAAC;SACf;QAED,SAAS,CACL,EAAE,EACF,KAAK,EACL,WAAW,CAAC,CAAC;QAEjB,KAAK,CAAC,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC;QAErC,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC"}
|
package/lib/plugins/math.d.ts
DELETED
package/lib/plugins/math.js
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* math.ts
|
3
|
-
*
|
4
|
-
* Copyright (C) 2020-2023 Posit Software, PBC
|
5
|
-
*
|
6
|
-
*/
|
7
|
-
export const kTokMathBlock = "math_block";
|
8
|
-
export const kTokMathInline = "math_inline";
|
9
|
-
function renderMath(content, convertOptions) {
|
10
|
-
if (convertOptions.display) {
|
11
|
-
return `<div class='quarto-display-math'>\\[${content}\\]</div>`;
|
12
|
-
}
|
13
|
-
else {
|
14
|
-
return `<span class='quarto-inline-math'>\\(${content}\\)</span>`;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
// Test if potential opening or closing delimieter
|
18
|
-
// Assumes that there is a "$" at state.src[pos]
|
19
|
-
function isValidDelim(state, pos) {
|
20
|
-
let max = state.posMax, can_open = true, can_close = true;
|
21
|
-
const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1, nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
|
22
|
-
// Check non-whitespace conditions for opening and closing, and
|
23
|
-
// check that closing delimeter isn't followed by a number
|
24
|
-
if (prevChar === 0x20 /* " " */ ||
|
25
|
-
prevChar === 0x09 /* \t */ ||
|
26
|
-
(nextChar >= 0x30 /* "0" */ && nextChar <= 0x39) /* "9" */) {
|
27
|
-
can_close = false;
|
28
|
-
}
|
29
|
-
if (nextChar === 0x20 /* " " */ || nextChar === 0x09 /* \t */) {
|
30
|
-
can_open = false;
|
31
|
-
}
|
32
|
-
return {
|
33
|
-
can_open: can_open,
|
34
|
-
can_close: can_close,
|
35
|
-
};
|
36
|
-
}
|
37
|
-
function math_inline(state, silent) {
|
38
|
-
if (state.src[state.pos] !== "$") {
|
39
|
-
return false;
|
40
|
-
}
|
41
|
-
let res = isValidDelim(state, state.pos);
|
42
|
-
if (!res.can_open) {
|
43
|
-
if (!silent) {
|
44
|
-
state.pending += "$";
|
45
|
-
}
|
46
|
-
state.pos += 1;
|
47
|
-
return true;
|
48
|
-
}
|
49
|
-
// First check for and bypass all properly escaped delimieters
|
50
|
-
// This loop will assume that the first leading backtick can not
|
51
|
-
// be the first character in state.src, which is known since
|
52
|
-
// we have found an opening delimieter already.
|
53
|
-
const start = state.pos + 1;
|
54
|
-
let match = start;
|
55
|
-
while ((match = state.src.indexOf("$", match)) !== -1) {
|
56
|
-
// Found potential $, look for escapes, pos will point to
|
57
|
-
// first non escape when complete
|
58
|
-
let pos = match - 1;
|
59
|
-
while (state.src[pos] === "\\") {
|
60
|
-
pos -= 1;
|
61
|
-
}
|
62
|
-
// Even number of escapes, potential closing delimiter found
|
63
|
-
if ((match - pos) % 2 == 1) {
|
64
|
-
break;
|
65
|
-
}
|
66
|
-
match += 1;
|
67
|
-
}
|
68
|
-
// No closing delimter found. Consume $ and continue.
|
69
|
-
if (match === -1) {
|
70
|
-
if (!silent) {
|
71
|
-
state.pending += "$";
|
72
|
-
}
|
73
|
-
state.pos = start;
|
74
|
-
return true;
|
75
|
-
}
|
76
|
-
// Check if we have empty content, ie: $$. Do not parse.
|
77
|
-
if (match - start === 0) {
|
78
|
-
if (!silent) {
|
79
|
-
state.pending += "$$";
|
80
|
-
}
|
81
|
-
state.pos = start + 1;
|
82
|
-
return true;
|
83
|
-
}
|
84
|
-
// Check for valid closing delimiter
|
85
|
-
res = isValidDelim(state, match);
|
86
|
-
if (!res.can_close) {
|
87
|
-
if (!silent) {
|
88
|
-
state.pending += "$";
|
89
|
-
}
|
90
|
-
state.pos = start;
|
91
|
-
return true;
|
92
|
-
}
|
93
|
-
if (!silent) {
|
94
|
-
const token = state.push("math_inline", "math", 0);
|
95
|
-
token.markup = "$";
|
96
|
-
token.content = state.src.slice(start, match);
|
97
|
-
}
|
98
|
-
state.pos = match + 1;
|
99
|
-
return true;
|
100
|
-
}
|
101
|
-
function math_block(state, start, end, silent) {
|
102
|
-
let next, lastPos;
|
103
|
-
let found = false, pos = state.bMarks[start] + state.tShift[start], max = state.eMarks[start], lastLine = "";
|
104
|
-
if (pos + 2 > max) {
|
105
|
-
return false;
|
106
|
-
}
|
107
|
-
if (state.src.slice(pos, pos + 2) !== "$$") {
|
108
|
-
return false;
|
109
|
-
}
|
110
|
-
pos += 2;
|
111
|
-
let firstLine = state.src.slice(pos, max);
|
112
|
-
if (silent) {
|
113
|
-
return true;
|
114
|
-
}
|
115
|
-
if (firstLine.trim().slice(-2) === "$$") {
|
116
|
-
// Single line expression
|
117
|
-
firstLine = firstLine.trim().slice(0, -2);
|
118
|
-
found = true;
|
119
|
-
}
|
120
|
-
let attrStr = undefined;
|
121
|
-
for (next = start; !found;) {
|
122
|
-
next++;
|
123
|
-
if (next >= end) {
|
124
|
-
break;
|
125
|
-
}
|
126
|
-
pos = state.bMarks[next] + state.tShift[next];
|
127
|
-
max = state.eMarks[next];
|
128
|
-
if (pos < max && state.tShift[next] < state.blkIndent) {
|
129
|
-
// non-empty line with negative indent should stop the list:
|
130
|
-
break;
|
131
|
-
}
|
132
|
-
const line = state.src.slice(pos, max).trim();
|
133
|
-
const match = line.match(/^\$\$\s*(\{.*\})?\s*$/);
|
134
|
-
if (match) {
|
135
|
-
lastPos = state.src.slice(0, max).lastIndexOf("$$");
|
136
|
-
lastLine = state.src.slice(pos, lastPos);
|
137
|
-
attrStr = match[1];
|
138
|
-
found = true;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
state.line = next + 1;
|
142
|
-
const token = state.push(kTokMathBlock, "math", 0);
|
143
|
-
token.block = true;
|
144
|
-
if (attrStr) {
|
145
|
-
token.info = attrStr;
|
146
|
-
}
|
147
|
-
token.content =
|
148
|
-
(firstLine && firstLine.trim() ? firstLine + "\n" : "") +
|
149
|
-
state.getLines(start + 1, next, state.tShift[start], true) +
|
150
|
-
(lastLine && lastLine.trim() ? lastLine : "");
|
151
|
-
token.map = [start, state.line];
|
152
|
-
token.markup = "$$";
|
153
|
-
return true;
|
154
|
-
}
|
155
|
-
export function mathjaxPlugin(md, options) {
|
156
|
-
// Default options
|
157
|
-
const convertOptions = {
|
158
|
-
display: false
|
159
|
-
};
|
160
|
-
// set MathJax as the renderer for markdown-it-simplemath
|
161
|
-
md.inline.ruler.after("escape", kTokMathInline, math_inline);
|
162
|
-
md.block.ruler.after("blockquote", kTokMathBlock, math_block, {
|
163
|
-
alt: ["paragraph", "reference", "blockquote", "list"],
|
164
|
-
});
|
165
|
-
md.renderer.rules.math_inline = function (tokens, idx) {
|
166
|
-
convertOptions.display = false;
|
167
|
-
return renderMath(tokens[idx].content, convertOptions);
|
168
|
-
};
|
169
|
-
md.renderer.rules.math_block = function (tokens, idx) {
|
170
|
-
convertOptions.display = true;
|
171
|
-
return renderMath(tokens[idx].content, convertOptions);
|
172
|
-
};
|
173
|
-
}
|
174
|
-
;
|
package/lib/plugins/math.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/plugins/math.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAO5C,SAAS,UAAU,CAAC,OAAe,EAAE,cAA8B;IACjE,IAAI,cAAc,CAAC,OAAO,EAAE;QAC1B,OAAO,uCAAuC,OAAO,WAAW,CAAC;KAClE;SAAM;QACL,OAAO,uCAAuC,OAAO,YAAY,CAAC;KACnE;AACH,CAAC;AAED,kDAAkD;AAClD,gDAAgD;AAChD,SAAS,YAAY,CAAC,KAAkB,EAAE,GAAW;IACnD,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,EACpB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,IAAI,CAAC;IAEnB,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,CAA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,CAAC,OAAO,GAAG,IAAI,CAAC;QAC9B,OAAO,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IACxD,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import Mermaid from "mermaid";
|
2
|
-
export default function mermaidPlugin(md, options) {
|
3
|
-
const kLang = "mermaid";
|
4
|
-
const kContainer = "quarto-mermaid";
|
5
|
-
Mermaid.initialize({
|
6
|
-
securityLevel: "loose",
|
7
|
-
...options,
|
8
|
-
});
|
9
|
-
let defaultFenceRenderer = md.renderer.rules.fence;
|
10
|
-
// Render custom code types as SVGs, letting the fence parser do all the heavy lifting.
|
11
|
-
function mermaidFenceRenderer(tokens, idx, options, env, slf) {
|
12
|
-
let token = tokens[idx];
|
13
|
-
if (token.info === kLang || (token.attrs !== null && token.attrs.length === 1 && token.attrs[0][0] === kLang)) {
|
14
|
-
let imageHTML = "";
|
15
|
-
let imageAttrs = [];
|
16
|
-
// Create element to render into
|
17
|
-
const element = document.createElement("div");
|
18
|
-
document.body.appendChild(element);
|
19
|
-
// Render with Mermaid
|
20
|
-
try {
|
21
|
-
Mermaid.mermaidAPI.render(kContainer, token.content, (html) => {
|
22
|
-
// We need to forcibly extract the max-width/height attributes to set on img tag
|
23
|
-
let mermaidEl = document.getElementById(kContainer);
|
24
|
-
if (mermaidEl !== null) {
|
25
|
-
imageAttrs.push([
|
26
|
-
"style",
|
27
|
-
`max-width:${mermaidEl.style.maxWidth};max-height:${mermaidEl.style.maxHeight}`,
|
28
|
-
]);
|
29
|
-
}
|
30
|
-
// Store HTML
|
31
|
-
imageHTML = html;
|
32
|
-
}, element);
|
33
|
-
}
|
34
|
-
catch (e) {
|
35
|
-
return `<pre>Failed to render mermaid diagram.${e}</pre>`;
|
36
|
-
}
|
37
|
-
finally {
|
38
|
-
element.remove();
|
39
|
-
}
|
40
|
-
// Store encoded image data
|
41
|
-
imageAttrs.push(["src", `data:image/svg+xml,${encodeURIComponent(imageHTML)}`]);
|
42
|
-
return `<img ${slf.renderAttrs({ attrs: imageAttrs })}>`;
|
43
|
-
}
|
44
|
-
else {
|
45
|
-
if (defaultFenceRenderer !== undefined) {
|
46
|
-
return defaultFenceRenderer(tokens, idx, options, env, slf);
|
47
|
-
}
|
48
|
-
// Missing fence renderer!
|
49
|
-
return "";
|
50
|
-
}
|
51
|
-
}
|
52
|
-
md.renderer.rules.fence = mermaidFenceRenderer;
|
53
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/mermaid/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAc,EAAE,OAAY;IAGhE,MAAM,KAAK,GAAG,SAAS,CAAC;IACxB,MAAM,UAAU,GAAG,gBAAgB,CAAC;IAEpC,OAAO,CAAC,UAAU,CAAC;QACjB,aAAa,EAAE,OAAO;QACtB,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,oBAAoB,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;IAEnD,uFAAuF;IACvF,SAAS,oBAAoB,CAC3B,MAAa,EACb,GAAW,EACX,OAAY,EACZ,GAAQ,EACR,GAAQ;QAER,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,EAAG;YAC9G,IAAI,SAAS,GAAW,EAAE,CAAC;YAC3B,IAAI,UAAU,GAAe,EAAE,CAAC;YAEhC,gCAAgC;YAChC,MAAM,O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,32 +0,0 @@
|
|
1
|
-
import { escapeHtml } from "markdown-it/lib/common/utils";
|
2
|
-
export const kShortcode = "shortcode";
|
3
|
-
export const shortcodePlugin = (md) => {
|
4
|
-
const shortcode = (state, silent) => {
|
5
|
-
// {{< shortcode >}}
|
6
|
-
if (state.src.slice(state.pos, state.pos + 3) !== "{{<") {
|
7
|
-
return false;
|
8
|
-
}
|
9
|
-
const shortcodeEndRegex = />}}/g;
|
10
|
-
// ignore if shortcode doesn't end
|
11
|
-
const end = state.src.slice(state.pos).search(shortcodeEndRegex);
|
12
|
-
if (end === -1) {
|
13
|
-
return false;
|
14
|
-
}
|
15
|
-
const shortcodeContent = state.src.slice(state.pos + 3, state.pos + end);
|
16
|
-
if (!silent) {
|
17
|
-
const token = state.push("shortcode", "shortcode", 0);
|
18
|
-
token.markup = "";
|
19
|
-
token.content = shortcodeContent;
|
20
|
-
}
|
21
|
-
state.pos += end + 3;
|
22
|
-
return true;
|
23
|
-
};
|
24
|
-
md.inline.ruler.after("escape", kShortcode, shortcode);
|
25
|
-
const renderShortcode = (tokens, idx, options, env, self) => {
|
26
|
-
const token = tokens[idx];
|
27
|
-
const content = token.content;
|
28
|
-
// insert shortcode braces and escape content's html entities
|
29
|
-
return `<span class="shortcode">${escapeHtml(`{{<${content}>}}`)}</span>`;
|
30
|
-
};
|
31
|
-
md.renderer.rules[kShortcode] = renderShortcode;
|
32
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"shortcodes.js","sourceRoot":"","sources":["../../src/plugins/shortcodes.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAc,EAAE,EAAE;IAChD,MAAM,SAAS,GAAG,CAAC,KAAkB,EAAE,MAAe,EAAW,EAAE;QACjE,oBAAoB;QACpB,IAAI,KAAK,C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AED,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC;AAClD,CAAC,CAAA"}
|
package/lib/plugins/spans.d.ts
DELETED
package/lib/plugins/spans.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* span.ts
|
3
|
-
*
|
4
|
-
* Copyright (C) 2020-2023 Posit Software, PBC
|
5
|
-
*
|
6
|
-
*/
|
7
|
-
export function spansPlugin(md, _options) {
|
8
|
-
function span(state, silent) {
|
9
|
-
var max = state.posMax;
|
10
|
-
if (state.src.charCodeAt(state.pos) !== 0x5B) {
|
11
|
-
// opening [
|
12
|
-
return false;
|
13
|
-
}
|
14
|
-
var labelStart = state.pos + 1;
|
15
|
-
var labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
|
16
|
-
if (labelEnd < 0) {
|
17
|
-
// parser failed to find closing ]
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
var pos = labelEnd + 1;
|
21
|
-
if (pos < max && state.src.charCodeAt(pos) === 0x7B /* { */) {
|
22
|
-
// probably found span
|
23
|
-
state.pos = labelStart;
|
24
|
-
state.posMax = labelEnd;
|
25
|
-
state.push('span_open', 'span', 1);
|
26
|
-
state.md.inline.tokenize(state);
|
27
|
-
state.push('span_close', 'span', -1);
|
28
|
-
state.pos = pos;
|
29
|
-
state.posMax = max;
|
30
|
-
return true;
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
return false;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
;
|
37
|
-
md.inline.ruler.push('quarto-spans', span);
|
38
|
-
}
|
package/lib/plugins/spans.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"spans.js","sourceRoot":"","sources":["../../src/plugins/spans.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,UAAU,WAAW,CAAC,EAAc,EAAE,QAAiB;IAC3D,SAAS,IAAI,CAAC,KAAkB,EAAE,MAAe;QAC/C,IAA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/*
|
2
|
-
* table-captions.ts
|
3
|
-
*
|
4
|
-
* Copyright (C) 2020-2023 Posit Software, PBC
|
5
|
-
*
|
6
|
-
*/
|
7
|
-
import { kTokInline, kTokParaClose, kTokParaOpen, kTokTableClose, kTokTableOpen, kTokText } from "../utils/tok";
|
8
|
-
const kTableCaptionRule = "quarto-table-captions";
|
9
|
-
export const tableCaptionPlugin = (md) => {
|
10
|
-
md.core.ruler.push(kTableCaptionRule, (state) => {
|
11
|
-
const tableIdxs = [];
|
12
|
-
const tablePoss = [];
|
13
|
-
// Identify tables that we'd like to process
|
14
|
-
// The tables must be the bottom first (we will process them bottom to
|
15
|
-
// top to ensure that the positions remain accurate as the tokens
|
16
|
-
// are mutated
|
17
|
-
for (let i = 0; i < state.tokens.length; i++) {
|
18
|
-
const token = state.tokens[i];
|
19
|
-
if (token.type === kTokTableOpen) {
|
20
|
-
tableIdxs.push(i);
|
21
|
-
}
|
22
|
-
else if (token.type === kTokTableClose) {
|
23
|
-
const start = tableIdxs.pop();
|
24
|
-
if (start) {
|
25
|
-
tablePoss.unshift({
|
26
|
-
start,
|
27
|
-
end: i
|
28
|
-
});
|
29
|
-
}
|
30
|
-
}
|
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
|
34
|
-
for (const tablePos of tablePoss) {
|
35
|
-
resolveTableCaption(state.tokens, tablePos.start, tablePos.end);
|
36
|
-
}
|
37
|
-
});
|
38
|
-
};
|
39
|
-
function resolveTableCaption(tokens, tblStartPos, tblEndPos) {
|
40
|
-
// Must have at least three tokens past the table end
|
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) {
|
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 : "";
|
48
|
-
const match = maybeCaptionText.match(/^:\s([^\{\}]*)(?:\{.*\}){0,1}$/);
|
49
|
-
if (match && match[1]) {
|
50
|
-
// Carve out the existing tokens
|
51
|
-
const capTokens = tokens.splice(tblEndPos + 1, 3);
|
52
|
-
// We have the caption, remove the paragraph and return
|
53
|
-
// the caption
|
54
|
-
capTokens[0].type = "table_caption";
|
55
|
-
capTokens[0].tag = "caption";
|
56
|
-
// Forward any attributes from the caption up to the table
|
57
|
-
tokens[tblStartPos].attrs = capTokens[0].attrs;
|
58
|
-
capTokens[0].attrs = [];
|
59
|
-
// Trim the content
|
60
|
-
capTokens[1].children[0].content = match[1];
|
61
|
-
// Close the caption
|
62
|
-
capTokens[2].type = "table_caption";
|
63
|
-
capTokens[2].tag = "caption";
|
64
|
-
tokens.splice(tblStartPos + 1, 0, ...capTokens);
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
return undefined;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
return undefined;
|
73
|
-
}
|
74
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"table-captions.js","sourceRoot":"","sources":["../../src/plugins/table-captions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGhH,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAc,EAAE,EAAE;IAEnD,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAChB,iBAAiB,EACjB,CAAC,KAAK,EAAE,EAAE;QAER,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAe,EAAE,CAAC;QAEjC,4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