@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.
Files changed (174) hide show
  1. package/README.md +2 -3
  2. package/package.json +1 -1
  3. package/style/base.css +4 -0
  4. package/lib/__tests__/index.spec.d.ts +0 -6
  5. package/lib/__tests__/index.spec.js +0 -60
  6. package/lib/__tests__/index.spec.js.map +0 -1
  7. package/lib/__tests__/myextension.spec.d.ts +0 -6
  8. package/lib/__tests__/myextension.spec.js +0 -10
  9. package/lib/__tests__/myextension.spec.js.map +0 -1
  10. package/lib/ast/ast.d.ts +0 -3
  11. package/lib/ast/ast.js +0 -38
  12. package/lib/ast/ast.js.map +0 -1
  13. package/lib/const.d.ts +0 -5
  14. package/lib/const.js +0 -11
  15. package/lib/const.js.map +0 -1
  16. package/lib/hooks/codemirror.d.ts +0 -4
  17. package/lib/hooks/codemirror.js +0 -51
  18. package/lib/hooks/codemirror.js.map +0 -1
  19. package/lib/index.d.ts +0 -6
  20. package/lib/index.js +0 -59
  21. package/lib/index.js.map +0 -1
  22. package/lib/manager.d.ts +0 -8
  23. package/lib/manager.js +0 -116
  24. package/lib/manager.js.map +0 -1
  25. package/lib/plugins/callouts.d.ts +0 -3
  26. package/lib/plugins/callouts.js +0 -208
  27. package/lib/plugins/callouts.js.map +0 -1
  28. package/lib/plugins/cites.d.ts +0 -3
  29. package/lib/plugins/cites.js +0 -147
  30. package/lib/plugins/cites.js.map +0 -1
  31. package/lib/plugins/decorator.d.ts +0 -3
  32. package/lib/plugins/decorator.js +0 -58
  33. package/lib/plugins/decorator.js.map +0 -1
  34. package/lib/plugins/divs.d.ts +0 -6
  35. package/lib/plugins/divs.js +0 -99
  36. package/lib/plugins/divs.js.map +0 -1
  37. package/lib/plugins/figure-divs.d.ts +0 -3
  38. package/lib/plugins/figure-divs.js +0 -52
  39. package/lib/plugins/figure-divs.js.map +0 -1
  40. package/lib/plugins/figures.d.ts +0 -17
  41. package/lib/plugins/figures.js +0 -98
  42. package/lib/plugins/figures.js.map +0 -1
  43. package/lib/plugins/gridtables/common/gridtables/GetCells.d.ts +0 -8
  44. package/lib/plugins/gridtables/common/gridtables/GetCells.js +0 -44
  45. package/lib/plugins/gridtables/common/gridtables/GetCells.js.map +0 -1
  46. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.d.ts +0 -8
  47. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js +0 -26
  48. package/lib/plugins/gridtables/common/gridtables/GetColumnWidths.js.map +0 -1
  49. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.d.ts +0 -8
  50. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js +0 -12
  51. package/lib/plugins/gridtables/common/markdown-it/ColumnAlignments.js.map +0 -1
  52. package/lib/plugins/gridtables/common/markdown-it/EmitTable.d.ts +0 -5
  53. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js +0 -66
  54. package/lib/plugins/gridtables/common/markdown-it/EmitTable.js.map +0 -1
  55. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.d.ts +0 -9
  56. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js +0 -18
  57. package/lib/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.js.map +0 -1
  58. package/lib/plugins/gridtables/common/markdown-it/GetLine.d.ts +0 -3
  59. package/lib/plugins/gridtables/common/markdown-it/GetLine.js +0 -9
  60. package/lib/plugins/gridtables/common/markdown-it/GetLine.js.map +0 -1
  61. package/lib/plugins/gridtables/common/markdown-it/ParseTable.d.ts +0 -4
  62. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js +0 -161
  63. package/lib/plugins/gridtables/common/markdown-it/ParseTable.js.map +0 -1
  64. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.d.ts +0 -13
  65. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js +0 -17
  66. package/lib/plugins/gridtables/common/markdown-it/ParseTableResult.js.map +0 -1
  67. package/lib/plugins/gridtables/index.d.ts +0 -2
  68. package/lib/plugins/gridtables/index.js +0 -8
  69. package/lib/plugins/gridtables/index.js.map +0 -1
  70. package/lib/plugins/gridtables/interfaces/markdown-it/IState.d.ts +0 -11
  71. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js +0 -5
  72. package/lib/plugins/gridtables/interfaces/markdown-it/IState.js.map +0 -1
  73. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.d.ts +0 -7
  74. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js +0 -5
  75. package/lib/plugins/gridtables/interfaces/markdown-it/IToken.js.map +0 -1
  76. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.d.ts +0 -4
  77. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js +0 -5
  78. package/lib/plugins/gridtables/interfaces/markdown-it/TRuleFunction.js.map +0 -1
  79. package/lib/plugins/gridtables/rules/gridtable.d.ts +0 -4
  80. package/lib/plugins/gridtables/rules/gridtable.js +0 -25
  81. package/lib/plugins/gridtables/rules/gridtable.js.map +0 -1
  82. package/lib/plugins/math.d.ts +0 -5
  83. package/lib/plugins/math.js +0 -174
  84. package/lib/plugins/math.js.map +0 -1
  85. package/lib/plugins/mermaid/index.d.ts +0 -3
  86. package/lib/plugins/mermaid/index.js +0 -53
  87. package/lib/plugins/mermaid/index.js.map +0 -1
  88. package/lib/plugins/shortcodes.d.ts +0 -4
  89. package/lib/plugins/shortcodes.js +0 -32
  90. package/lib/plugins/shortcodes.js.map +0 -1
  91. package/lib/plugins/spans.d.ts +0 -3
  92. package/lib/plugins/spans.js +0 -38
  93. package/lib/plugins/spans.js.map +0 -1
  94. package/lib/plugins/table-captions.d.ts +0 -3
  95. package/lib/plugins/table-captions.js +0 -74
  96. package/lib/plugins/table-captions.js.map +0 -1
  97. package/lib/plugins/yaml.d.ts +0 -3
  98. package/lib/plugins/yaml.js +0 -309
  99. package/lib/plugins/yaml.js.map +0 -1
  100. package/lib/providers/attrs.d.ts +0 -2
  101. package/lib/providers/attrs.js +0 -15
  102. package/lib/providers/attrs.js.map +0 -1
  103. package/lib/providers/callouts.d.ts +0 -2
  104. package/lib/providers/callouts.js +0 -15
  105. package/lib/providers/callouts.js.map +0 -1
  106. package/lib/providers/cites.d.ts +0 -2
  107. package/lib/providers/cites.js +0 -15
  108. package/lib/providers/cites.js.map +0 -1
  109. package/lib/providers/decorator.d.ts +0 -2
  110. package/lib/providers/decorator.js +0 -15
  111. package/lib/providers/decorator.js.map +0 -1
  112. package/lib/providers/deflist.d.ts +0 -2
  113. package/lib/providers/deflist.js +0 -15
  114. package/lib/providers/deflist.js.map +0 -1
  115. package/lib/providers/divs.d.ts +0 -2
  116. package/lib/providers/divs.js +0 -27
  117. package/lib/providers/divs.js.map +0 -1
  118. package/lib/providers/figure-divs.d.ts +0 -2
  119. package/lib/providers/figure-divs.js +0 -15
  120. package/lib/providers/figure-divs.js.map +0 -1
  121. package/lib/providers/figures.d.ts +0 -2
  122. package/lib/providers/figures.js +0 -15
  123. package/lib/providers/figures.js.map +0 -1
  124. package/lib/providers/footnotes.d.ts +0 -2
  125. package/lib/providers/footnotes.js +0 -15
  126. package/lib/providers/footnotes.js.map +0 -1
  127. package/lib/providers/gridtables.d.ts +0 -2
  128. package/lib/providers/gridtables.js +0 -15
  129. package/lib/providers/gridtables.js.map +0 -1
  130. package/lib/providers/math.d.ts +0 -2
  131. package/lib/providers/math.js +0 -104
  132. package/lib/providers/math.js.map +0 -1
  133. package/lib/providers/mermaid.d.ts +0 -2
  134. package/lib/providers/mermaid.js +0 -13
  135. package/lib/providers/mermaid.js.map +0 -1
  136. package/lib/providers/provider.d.ts +0 -4
  137. package/lib/providers/provider.js +0 -12
  138. package/lib/providers/provider.js.map +0 -1
  139. package/lib/providers/shortcodes.d.ts +0 -2
  140. package/lib/providers/shortcodes.js +0 -15
  141. package/lib/providers/shortcodes.js.map +0 -1
  142. package/lib/providers/spans.d.ts +0 -2
  143. package/lib/providers/spans.js +0 -15
  144. package/lib/providers/spans.js.map +0 -1
  145. package/lib/providers/sub.d.ts +0 -2
  146. package/lib/providers/sub.js +0 -15
  147. package/lib/providers/sub.js.map +0 -1
  148. package/lib/providers/sup.d.ts +0 -2
  149. package/lib/providers/sup.js +0 -15
  150. package/lib/providers/sup.js.map +0 -1
  151. package/lib/providers/table-captions.d.ts +0 -2
  152. package/lib/providers/table-captions.js +0 -15
  153. package/lib/providers/table-captions.js.map +0 -1
  154. package/lib/providers/tasklists.d.ts +0 -2
  155. package/lib/providers/tasklists.js +0 -15
  156. package/lib/providers/tasklists.js.map +0 -1
  157. package/lib/providers/yaml.d.ts +0 -2
  158. package/lib/providers/yaml.js +0 -15
  159. package/lib/providers/yaml.js.map +0 -1
  160. package/lib/types.d.ts +0 -44
  161. package/lib/types.js +0 -1
  162. package/lib/types.js.map +0 -1
  163. package/lib/utils/html.d.ts +0 -12
  164. package/lib/utils/html.js +0 -45
  165. package/lib/utils/html.js.map +0 -1
  166. package/lib/utils/markdownit.d.ts +0 -16
  167. package/lib/utils/markdownit.js +0 -44
  168. package/lib/utils/markdownit.js.map +0 -1
  169. package/lib/utils/tok.d.ts +0 -8
  170. package/lib/utils/tok.js +0 -13
  171. package/lib/utils/tok.js.map +0 -1
  172. package/lib/widgets.d.ts +0 -15
  173. package/lib/widgets.js +0 -57
  174. package/lib/widgets.js.map +0 -1
@@ -1,208 +0,0 @@
1
- import Token from "markdown-it/lib/token";
2
- import { addClass, readAttrValue } from "../utils/markdownit";
3
- import { kTokDivClose, kTokDivOpen } from "./divs";
4
- const kTokCalloutOpen = "quarto_callout_open";
5
- const kTokCalloutClose = "quarto_callout_close";
6
- const kTokCalloutTitleOpen = "quarto_callout_title_open";
7
- const kTokCalloutTitleClose = "quarto_callout_title_close";
8
- const kTokCalloutContentOpen = "quarto_callout_content_open";
9
- const kTokCalloutContentClose = "quarto_callout_content_close";
10
- const kCalloutPrefix = "callout-";
11
- const kCalloutRuleName = "quarto-callouts";
12
- export const calloutPlugin = (md) => {
13
- // Handle pandoc-style divs
14
- md.core.ruler.push(kCalloutRuleName, (state) => {
15
- const noteStartCallout = (callout, depth) => {
16
- if (calloutDepth == -1) {
17
- calloutDepth = depth;
18
- }
19
- state.env['quarto-active-callout'] = callout;
20
- };
21
- const noteCloseCallout = () => {
22
- calloutDepth = -1;
23
- state.env['quarto-active-callout'] = undefined;
24
- };
25
- const activeCallout = () => {
26
- return state.env['quarto-active-callout'];
27
- };
28
- const isCloseCallout = (depth) => {
29
- return calloutDepth === depth;
30
- };
31
- const titleOpenTok = (title) => {
32
- const token = new Token(kTokCalloutTitleOpen, "", 1);
33
- token.tag = "div";
34
- token.attrs = [["class", "callout-header"]];
35
- if (title) {
36
- token.attrs.push(["title", title]);
37
- }
38
- return token;
39
- };
40
- const titleCloseTok = () => {
41
- const token = new Token(kTokCalloutTitleClose, "", -1);
42
- token.tag = "div";
43
- return token;
44
- };
45
- const contentOpenTok = () => {
46
- const token = new Token(kTokCalloutContentOpen, "", 1);
47
- token.tag = "div";
48
- token.attrs = [["class", "callout-body-container callout-body"]];
49
- return token;
50
- };
51
- const contentCloseTok = () => {
52
- const token = new Token(kTokCalloutContentClose, "", -1);
53
- token.tag = "div";
54
- return token;
55
- };
56
- const outTokens = [];
57
- let calloutDepth = -1;
58
- let divDepth = 0;
59
- // just started callout - process title
60
- // finished processing title - process content
61
- let calloutState = "scanning";
62
- for (const token of state.tokens) {
63
- switch (calloutState) {
64
- case "add-title":
65
- if (token.type === "heading_open") {
66
- outTokens.push(titleOpenTok());
67
- calloutState = "capturing-title";
68
- }
69
- else {
70
- const callout = activeCallout();
71
- outTokens.push(titleOpenTok(callout.title));
72
- outTokens.push(titleCloseTok());
73
- calloutState = "add-body";
74
- }
75
- break;
76
- case "capturing-title":
77
- if (token.type === "heading_close") {
78
- outTokens.push(titleCloseTok());
79
- calloutState = "add-body";
80
- }
81
- else {
82
- outTokens.push(token);
83
- }
84
- break;
85
- case "add-body":
86
- outTokens.push(contentOpenTok());
87
- outTokens.push(token);
88
- calloutState = "capturing-body";
89
- break;
90
- case "scanning":
91
- default:
92
- if (token.type === kTokDivOpen) {
93
- divDepth++;
94
- const callout = parseCallout(token.attrs);
95
- if (callout) {
96
- noteStartCallout(callout, divDepth);
97
- calloutState = "add-title";
98
- const openCallout = new Token(kTokCalloutOpen, "", 1);
99
- openCallout.attrs = openCallout.attrs || [];
100
- openCallout.meta = callout;
101
- outTokens.push(openCallout);
102
- }
103
- else {
104
- outTokens.push(token);
105
- }
106
- }
107
- else if (token.type === kTokDivClose) {
108
- if (isCloseCallout(divDepth)) {
109
- outTokens.push(contentCloseTok());
110
- outTokens.push(new Token(kTokCalloutClose, "", -1));
111
- noteCloseCallout();
112
- }
113
- else {
114
- outTokens.push(token);
115
- }
116
- divDepth--;
117
- }
118
- else {
119
- outTokens.push(token);
120
- }
121
- break;
122
- }
123
- }
124
- state.tokens = outTokens;
125
- return false;
126
- });
127
- md.renderer.rules[kTokCalloutOpen] = renderStartCallout;
128
- md.renderer.rules[kTokCalloutClose] = renderEndCallout;
129
- md.renderer.rules[kTokCalloutTitleOpen] = renderStartCalloutTitle;
130
- md.renderer.rules[kTokCalloutTitleClose] = renderEndCalloutTitle;
131
- };
132
- // Render pandoc-style divs
133
- function renderStartCallout(tokens, idx, options, env, self) {
134
- const token = tokens[idx];
135
- const callout = token.meta;
136
- // Add classes decorating as callout
137
- token.attrs = addClass(`callout ${callout.clz}`, token.attrs);
138
- // Add class that reflects the style
139
- token.attrs = addClass(appearanceClass(callout.appearance), token.attrs);
140
- return `<div ${self.renderAttrs(token)}>`;
141
- }
142
- // Render pandoc-style divs
143
- function renderEndCallout(tokens, idx, options, env, self) {
144
- return `</div>`;
145
- }
146
- function renderStartCalloutTitle(tokens, idx, options, env, self) {
147
- const token = tokens[idx];
148
- const title = readAttrValue("title", token.attrs) || "";
149
- const startContent = `
150
- <div class="callout-header">
151
- <div class="callout-icon-container">
152
- <i class="callout-icon"></i>
153
- </div>
154
- <div class="callout-title-container">${title}
155
- `;
156
- return startContent;
157
- }
158
- function renderEndCalloutTitle(tokens, idx, options, env, self) {
159
- return `</div>\n</div>`;
160
- }
161
- const calloutAppearance = (val) => {
162
- if (val) {
163
- switch (val) {
164
- case "minimal":
165
- return "minimal";
166
- case "simple":
167
- return "simple";
168
- case "default":
169
- default:
170
- return "default";
171
- }
172
- }
173
- else {
174
- return "default";
175
- }
176
- };
177
- const parseCallout = (attrs) => {
178
- if (attrs === null) {
179
- return undefined;
180
- }
181
- const classAttr = attrs.find((attr) => { return attr[0] === "class"; });
182
- if (!classAttr) {
183
- return undefined;
184
- }
185
- const classes = classAttr[1].split(" ");
186
- const calloutClass = classes.find((clz) => {
187
- return clz.startsWith('callout-');
188
- });
189
- if (calloutClass) {
190
- const type = calloutClass.replace(kCalloutPrefix, "");
191
- const title = readAttrValue("title", attrs) || type.slice(0, 1).toUpperCase() + type.slice(1);
192
- ;
193
- const appearance = calloutAppearance(readAttrValue("appearance", attrs));
194
- return {
195
- type: type || "note",
196
- clz: calloutClass,
197
- title,
198
- appearance
199
- };
200
- }
201
- else {
202
- return undefined;
203
- }
204
- };
205
- const appearanceClass = (appearance) => {
206
- let style = appearance || "default";
207
- return `callout-style-${style}`;
208
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"callouts.js","sourceRoot":"","sources":["../../src/plugins/callouts.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAgB,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGjE,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AACzD,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAE3D,MAAM,sBAAsB,GAAG,6BAA6B,CAAC;AAC7D,MAAM,uBAAuB,GAAG,8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IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAA,CAAA,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QACxC,OAAO,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC,CAAC,CAAA;IAEF,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAErD,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC;QAC/F,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;QAEzE,OAAO;YACL,IAAI,EAAE,IAAI,IAAI,MAAM;YACpB,GAAG,EAAE,YAAY;YACjB,KAAK;YACL,UAAU;SACX,CAAA;KAEF;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AAEH,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,UAA8C,EAAE,EAAE;IACzE,IAAI,KAAK,GAAG,UAAU,IAAI,SAAS,CAAC;IACpC,OAAO,iBAAiB,KAAK,EAAE,CAAC;AAClC,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import type MarkdownIt from "markdown-it/lib";
2
- export declare const citationPlugin: (md: MarkdownIt) => void;
3
- //# sourceMappingURL=cites.d.ts.map
@@ -1,147 +0,0 @@
1
- /*
2
- * citation.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
7
- const kTokCite = "quarto_cite";
8
- export const citationPlugin = (md) => {
9
- // Very simple plugin example that surrounds @text with `code`
10
- md.core.ruler.push('quarto-citation', function replaceAtSymbol(state) {
11
- const tokens = state.tokens;
12
- for (const token of tokens) {
13
- if (token.type === 'inline' && token.children) {
14
- // Rebuild the child list
15
- const children = [];
16
- for (let i = 0; i < token.children.length; i++) {
17
- const child = token.children[i];
18
- if (child.type === 'text') {
19
- let content = child.content;
20
- const textToken = (text) => {
21
- const newToken = new state.Token('text', '', 0);
22
- newToken.content = text.join("");
23
- return newToken;
24
- };
25
- let text = [];
26
- const flushText = () => {
27
- if (text.length) {
28
- children.push(textToken(text));
29
- text = [];
30
- }
31
- };
32
- let cite = [];
33
- const flushCite = () => {
34
- var _a;
35
- if (cite.length) {
36
- // Determine the cite style
37
- let style = cite[0] === "-" ? "suppress-author" : "in-text";
38
- if (bracketCount > 0) {
39
- style = "normal";
40
- }
41
- // The classes
42
- const clz = ["cite", style];
43
- // If the cite ends in punctuation, trim that off and make that text
44
- let puncText = [];
45
- // Trim off ending punctuation
46
- if ([":", ".", "#", "$", "%", "&", "-", "+", "?", "<", ">", "~", "/", "!"].includes(cite[cite.length - 1])) {
47
- puncText.push(cite[cite.length - 1]);
48
- cite = cite.slice(0, -1);
49
- }
50
- // Make a cite token
51
- const newToken = new state.Token(kTokCite, '', 0);
52
- newToken.content = cite.join("");
53
- newToken.attrs = newToken.attrs || [];
54
- (_a = newToken.attrs) === null || _a === void 0 ? void 0 : _a.push(["class", clz.join(" ")]);
55
- children.push(newToken);
56
- cite = [];
57
- if (puncText.length > 0) {
58
- children.push(textToken(puncText));
59
- }
60
- }
61
- };
62
- let capture = "text";
63
- let bracketCount = 0;
64
- for (let j = 0; j < content.length; j++) {
65
- const char = content.charAt(j);
66
- if (char === "@") {
67
- if ((text.length === 1 && text[0] === '-') ||
68
- text.length > 1 && text[text.length - 1] === "-" && text[text.length - 2] === "[") {
69
- cite.push('-');
70
- cite.push(char);
71
- text.pop();
72
- flushText();
73
- capture = 'cite';
74
- }
75
- else if (text[text.length - 1] === ' ') {
76
- flushText();
77
- cite.push(char);
78
- capture = 'cite';
79
- }
80
- else if (text[text.length - 1] === '-' && text[text.length - 2] === ' ') {
81
- text = text.slice(0, -1);
82
- flushText();
83
- cite.push('-');
84
- cite.push(char);
85
- capture = 'cite';
86
- }
87
- else if (text[text.length - 1] === '[' && text[text.length - 2] === ' ') {
88
- flushText();
89
- cite.push(char);
90
- capture = 'cite';
91
- }
92
- else if (text.length === 0) {
93
- cite.push(char);
94
- capture = 'cite';
95
- }
96
- else {
97
- if (capture === 'cite') {
98
- cite.push(char);
99
- }
100
- else {
101
- text.push(char);
102
- }
103
- }
104
- }
105
- else if (char === " ") {
106
- capture = 'text';
107
- flushCite();
108
- text.push(char);
109
- }
110
- else if (char === "[") {
111
- bracketCount++;
112
- text.push(char);
113
- }
114
- else if (char === "]") {
115
- bracketCount--;
116
- capture = 'text';
117
- flushCite();
118
- text.push(char);
119
- }
120
- else {
121
- if (capture === 'cite') {
122
- cite.push(char);
123
- }
124
- else {
125
- text.push(char);
126
- }
127
- }
128
- }
129
- flushCite();
130
- flushText();
131
- }
132
- else {
133
- children.push(child);
134
- }
135
- }
136
- token.children = children.length > 0 ? children : null;
137
- }
138
- }
139
- });
140
- md.renderer.rules[kTokCite] = renderCite;
141
- };
142
- // Render pandoc-style divs
143
- function renderCite(tokens, idx, options, env, self) {
144
- const token = tokens[idx];
145
- const citeContent = `<code ${self.renderAttrs(token)}>${token.content}</code>`;
146
- return citeContent;
147
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"cites.js","sourceRoot":"","sources":["../../src/plugins/cites.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAOF,MAAM,QAAQ,GAAG,aAAa,CAAC;AAE/B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAc,EAAE,EAAE;IAE/C,8DAA8D;IAC9D,EAAE,CAAC,IA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AAC,IAAI,CAAC,CAAC;6BACjB;iCACI;gCACH,IAAI,OAAO,KAAK,MAAM,EAAE;oCACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iCACjB;qCAAM;oCACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iCACjB;6BACF;yBACF;wBACD,SAAS,EAAE,CAAC;wBACZ,SAAS,EAAE,CAAC;qBACb;yBAAM;wBACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACtB;iBACF;gBACD,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;aACxD;SACF;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAA;AAC1C,CAAC,CAAA;AAGD,2BAA2B;AAC3B,SAAS,UAAU,CAAC,MAAe,EAAE,GAAW,EAAE,OAA2B,EAAE,GAAQ,EAAE,IAAc;IACrG,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,SAAS,CAAC;IAChF,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type MarkdownIt from "markdown-it/lib";
2
- export declare const decoratorPlugin: (md: MarkdownIt) => void;
3
- //# sourceMappingURL=decorator.d.ts.map
@@ -1,58 +0,0 @@
1
- import Token from "markdown-it/lib/token";
2
- import { attributeDecorator, decorator } from "../utils/html";
3
- import { kTokDivOpen } from "./divs";
4
- import { kTokFigureOpen } from "./figures";
5
- import { kTokHeadingOpen, kTokTableOpen } from "../utils/tok";
6
- import { kTokMathBlock } from "./math";
7
- const kTokDecorator = "quarto_decorator";
8
- const kQuartoDecoratorOptions = "quarto-decorator-options";
9
- export const decoratorPlugin = (md) => {
10
- md.core.ruler.push('quarto-decorator', function replaceAtSymbol(state) {
11
- const outTokens = [];
12
- for (const token of state.tokens) {
13
- if (token.type === "fence" && !token.attrs && token.info) {
14
- outTokens.push(decoratorTokForToken(token));
15
- }
16
- else if (token.type === kTokHeadingOpen && token.attrs) {
17
- outTokens.push(decoratorTokForToken(token));
18
- }
19
- else if (token.type === kTokDivOpen && token.attrs) {
20
- outTokens.push(decoratorTokForToken(token));
21
- }
22
- else if (token.type === kTokFigureOpen && token.attrs) {
23
- outTokens.push(decoratorTokForToken(token, { hide: { attributes: true } }));
24
- }
25
- else if (token.type === kTokTableOpen && token.attrs) {
26
- outTokens.push(decoratorTokForToken(token));
27
- }
28
- else if (token.type === kTokMathBlock && token.attrs) {
29
- outTokens.push(decoratorTokForToken(token));
30
- }
31
- outTokens.push(token);
32
- }
33
- state.tokens = outTokens;
34
- });
35
- md.renderer.rules[kTokDecorator] = renderDecorator;
36
- };
37
- function decoratorTokForToken(token, options) {
38
- const decoratorTok = new Token(kTokDecorator, "div", 1);
39
- decoratorTok.attrs = token.attrs;
40
- decoratorTok.info = token.info;
41
- if (options) {
42
- decoratorTok.meta = decoratorTok.meta || {};
43
- decoratorTok.meta[kQuartoDecoratorOptions] = options;
44
- }
45
- return decoratorTok;
46
- }
47
- // Render pandoc-style divs
48
- function renderDecorator(tokens, idx, options, env, self) {
49
- var _a;
50
- const token = tokens[idx];
51
- const decoratorOptions = (_a = token.meta) === null || _a === void 0 ? void 0 : _a[kQuartoDecoratorOptions];
52
- if (token.info) {
53
- return decorator([token.info]);
54
- }
55
- else {
56
- return attributeDecorator(token, decoratorOptions);
57
- }
58
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../src/plugins/decorator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,uBAAuB,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAoB,MAAM,eAAe,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AAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAE;KACjC;SAAM;QACL,OAAO,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;KACpD;AACH,CAAC"}
@@ -1,6 +0,0 @@
1
- import type MarkdownIt from "markdown-it/lib";
2
- export declare const kDivRuleName = "pandocDiv";
3
- export declare const kTokDivOpen = "pandoc_div_open";
4
- export declare const kTokDivClose = "pandoc_div_close";
5
- export declare const divPlugin: (md: MarkdownIt) => void;
6
- //# sourceMappingURL=divs.d.ts.map
@@ -1,99 +0,0 @@
1
- import { addClass } from "../utils/markdownit";
2
- export const kDivRuleName = "pandocDiv";
3
- export const kTokDivOpen = 'pandoc_div_open';
4
- export const kTokDivClose = 'pandoc_div_close';
5
- export const divPlugin = (md) => {
6
- // Render pandoc-style divs
7
- function renderStartDiv(tokens, idx, options, env, self) {
8
- // Add a class to designate that this is a quarto dev
9
- const token = tokens[idx];
10
- token.attrs = addClass("quarto-div", token.attrs);
11
- return `<div ${self.renderAttrs(token)}>`;
12
- }
13
- // Render pandoc-style divs
14
- function renderEndDiv(tokens, idx, options, env, self) {
15
- return `</div>`;
16
- }
17
- // TODO Implement a better test during validation run
18
- // Handle pandoc-style divs
19
- md.block.ruler.before("fence", kDivRuleName, (state, start, end, silent) => {
20
- // This is a validation run, can ignore
21
- if (silent) {
22
- return true;
23
- }
24
- // Get the line for parsing
25
- const lineStart = state.bMarks[start] + state.tShift[start];
26
- const lineEnd = state.eMarks[start];
27
- const line = state.src.slice(lineStart, lineEnd);
28
- // The current state of the divs (e.g. is there an open)
29
- // div. Data structure holds key that is the number of colons
30
- const divState = state.env.quartoOpenDivs || {};
31
- const incrementDivCount = (fence) => {
32
- state.env.quartoOpenDivs = state.env.quartoOpenDivs || {};
33
- const current = state.env.quartoOpenDivs[fence] || 0;
34
- state.env.quartoOpenDivs[fence] = Math.max(0, current + 1);
35
- };
36
- const decrementDivCount = (fence) => {
37
- state.env.quartoOpenDivs = state.env.quartoOpenDivs || {};
38
- const current = state.env.quartoOpenDivs[fence] || 0;
39
- state.env.quartoOpenDivs[fence] = Math.max(0, current - 1);
40
- };
41
- // Three or more colons followed by a an optional brace with attributes
42
- const divBraceRegex = /^(:::+)\s*(?:(\{[\s\S]+?\}))?$/;
43
- // Three or more colons followed by a string with no braces
44
- const divNoBraceRegex = /^(:::+)\s*(?:([^\{\}\s]+?))?$/;
45
- const matchers = [divBraceRegex, divNoBraceRegex];
46
- let match;
47
- for (const matcher of matchers) {
48
- match = matcher.exec(line);
49
- if (match) {
50
- break;
51
- }
52
- }
53
- if (match) {
54
- // There is a div here, is one already open?
55
- const divFence = match[1];
56
- const attr = match[2];
57
- // Is this open?
58
- let isOpenDiv = false;
59
- const openCount = divState[divFence];
60
- if (!openCount || openCount === 0) {
61
- // There isn't an existing open div at this level (number of colons)
62
- isOpenDiv = true;
63
- }
64
- else if (attr) {
65
- // If it has attributes it is always open
66
- isOpenDiv = true;
67
- }
68
- if (isOpenDiv) {
69
- // Add to the open count (or set it to 1)
70
- incrementDivCount(divFence);
71
- // Make an open token
72
- const token = state.push(kTokDivOpen, "div", 1);
73
- token.markup = line;
74
- // Allow this to be parsed for attributes by markdown-it-attr
75
- if (attr && attr.startsWith("{")) {
76
- token.info = attr;
77
- }
78
- else if (attr) {
79
- token.info = `{.${attr}}`;
80
- }
81
- token.block = true;
82
- }
83
- else {
84
- // Subtract from the open count (min zero)
85
- decrementDivCount(divFence);
86
- // Make a close token
87
- const token = state.push(kTokDivClose, "div", -1);
88
- token.markup = line;
89
- }
90
- state.line = start + 1;
91
- return true;
92
- }
93
- else {
94
- return false;
95
- }
96
- }, { alt: [] });
97
- md.renderer.rules[kTokDivOpen] = renderStartDiv;
98
- md.renderer.rules[kTokDivClose] = renderEndDiv;
99
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"divs.js","sourceRoot":"","sources":["../../src/plugins/divs.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,qB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ACd;IACH,CAAC,EACD,EAAE,GAAG,EAAE,EAAE,EAAE,CACZ,CAAA;IAED,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;IAC/C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;AAChD,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import MarkdownIt from "markdown-it";
2
- export declare const figureDivsPlugin: (md: MarkdownIt) => void;
3
- //# sourceMappingURL=figure-divs.d.ts.map
@@ -1,52 +0,0 @@
1
- /*
2
- * figure-divs.ts
3
- *
4
- * Copyright (C) 2020-2023 Posit Software, PBC
5
- *
6
- */
7
- import { readAttrValue } from "../utils/markdownit";
8
- import { kTokInline, kTokParaClose, kTokParaOpen } from "../utils/tok";
9
- import { kTokDivClose, kTokDivOpen } from "./divs";
10
- import { kTokFigCaptionClose, kTokFigCaptionOpen, mutateToFigureTok } from "./figures";
11
- const kFigureDivRuleName = "quarto-figure-divs";
12
- const kFigurePrefix = "fig-";
13
- export const figureDivsPlugin = (md) => {
14
- // Handle pandoc-style divs
15
- md.core.ruler.push(kFigureDivRuleName, (state) => {
16
- let isFigureDiv = [];
17
- for (let i = 0; i < state.tokens.length; i++) {
18
- const token = state.tokens[i];
19
- if (token.type === kTokDivOpen) {
20
- const id = readAttrValue("id", token.attrs);
21
- if (id === null || id === void 0 ? void 0 : id.startsWith(kFigurePrefix)) {
22
- isFigureDiv.push(true);
23
- mutateToFigureTok(token, "open");
24
- }
25
- else {
26
- // Note the div, but not a figure div
27
- isFigureDiv.push(false);
28
- }
29
- }
30
- else if (token.type === kTokDivClose) {
31
- const isFigDiv = isFigureDiv.pop();
32
- if (isFigDiv) {
33
- // If the preview token is paragraph, use that as the caption
34
- if (i - 3 >= 0) {
35
- const maybeParaStart = state.tokens[i - 3];
36
- const maybeInline = state.tokens[i - 2];
37
- const maybeParaEnd = state.tokens[i - 1];
38
- if (maybeParaStart.type === kTokParaOpen && maybeParaEnd.type === kTokParaClose && maybeInline.type === kTokInline) {
39
- mutateToFigCaption(state.tokens[i - 3], "open");
40
- mutateToFigCaption(state.tokens[i - 1], "close");
41
- }
42
- }
43
- mutateToFigureTok(token, "close");
44
- }
45
- }
46
- }
47
- });
48
- };
49
- const mutateToFigCaption = (token, type) => {
50
- token.tag = "figcaption";
51
- token.type = type === "open" ? kTokFigCaptionClose : kTokFigCaptionOpen;
52
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"figure-divs.js","sourceRoot":"","sources":["../../src/plugins/figure-divs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGvF,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAChD,MAAM,aAAa,GAAG,MAAM,CAAC;AAG7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAc,EAAE,EAAE;IAEjD,2BAA2B;IAC3B,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAChB,kBAAkB,EAClB,CAAC,KAAK,EAAE,EAAE;QAER,IAAI,WAAW,GAAc,EAAE,CAAC;QAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE;gBAC9B,MAAM,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,K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CAAC,GAAG,GAAG,YAAY,CAAC;IACzB,KAAK,CAAC,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAC1E,CAAC,CAAA"}
@@ -1,17 +0,0 @@
1
- import MarkdownIt from "markdown-it";
2
- import Token from "markdown-it/lib/token";
3
- export interface FigureOptions {
4
- dataType?: boolean;
5
- link?: boolean;
6
- figcaption?: boolean;
7
- copyAttrs?: boolean;
8
- tabindex?: boolean;
9
- lazyLoading?: boolean;
10
- }
11
- export declare const kTokFigureOpen = "figure_open";
12
- export declare const kTokFigureClose = "figure_close";
13
- export declare const kTokFigCaptionOpen = "figcaption_open";
14
- export declare const kTokFigCaptionClose = "figcaption_close";
15
- export declare const mutateToFigureTok: (token: Token, type: "open" | "close") => void;
16
- export declare function figuresPlugin(md: MarkdownIt, options: FigureOptions): void;
17
- //# sourceMappingURL=figures.d.ts.map