@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,27 @@
|
|
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
|
+
/**
|
6
|
+
* getColumnWidths parses the provided line and returns the associated column widths.
|
7
|
+
*
|
8
|
+
* @param line The separator line to parse for the column widths.
|
9
|
+
* @returns The column widths for the provided line, or an empty array if the line is invalid.
|
10
|
+
*/
|
11
|
+
export default function getColumnWidths(line) {
|
12
|
+
// try to parse as a row separator line
|
13
|
+
let columnMatch = line
|
14
|
+
.substr(1)
|
15
|
+
.match(/[:-][-]+[:-]\+/g);
|
16
|
+
if (columnMatch == null) {
|
17
|
+
// try to parse as a header separator line
|
18
|
+
columnMatch = line
|
19
|
+
.substr(1)
|
20
|
+
.match(/[:=][=]+[:=]\+/g);
|
21
|
+
}
|
22
|
+
if (columnMatch == null) {
|
23
|
+
return [];
|
24
|
+
}
|
25
|
+
return columnMatch.map(s => s.length);
|
26
|
+
}
|
27
|
+
//# sourceMappingURL=GetColumnWidths.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GetColumnWidths.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/gridtables/GetColumnWidths.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;;;EAKE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CACnC,IAAY;IAGZ,uCAAuC;IACvC,IAAI,WAAW,GAAG,IAAI;SACjB,MAAM,CAAC,CAAC,CAAC;SACT,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE9B,IAAI,WAAW,IAAI,IAAI,EACvB;QACI,0CAA0C;QAC1C,WAAW,GAAG,IAAI;aACb,MAAM,CAAC,CAAC,CAAC;aACT,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACjC;IAED,IAAI,WAAW,IAAI,IAAI,EACvB;QACI,OAAO,EAAE,CAAC;KACb;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
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
|
+
var ColumnAlignments;
|
6
|
+
(function (ColumnAlignments) {
|
7
|
+
ColumnAlignments["None"] = "";
|
8
|
+
ColumnAlignments["Left"] = "left";
|
9
|
+
ColumnAlignments["Center"] = "center";
|
10
|
+
ColumnAlignments["Right"] = "right";
|
11
|
+
})(ColumnAlignments || (ColumnAlignments = {}));
|
12
|
+
export default ColumnAlignments;
|
13
|
+
//# sourceMappingURL=ColumnAlignments.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ColumnAlignments.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ColumnAlignments.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,IAAK,gBAMJ;AAND,WAAK,gBAAgB;IAEjB,6BAAS,CAAA;IACT,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,mCAAe,CAAA;AACnB,CAAC,EANI,gBAAgB,KAAhB,gBAAgB,QAMpB;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import * as MarkdownIt from "markdown-it";
|
2
|
+
import IState from "../../interfaces/markdown-it/IState";
|
3
|
+
import ParseTableResult from "./ParseTableResult";
|
4
|
+
export default function emitTable(md: MarkdownIt, state: IState, result: ParseTableResult): void;
|
5
|
+
//# sourceMappingURL=EmitTable.d.ts.map
|
@@ -0,0 +1,67 @@
|
|
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 getCells from "../gridtables/GetCells";
|
6
|
+
import ColumnAlignments from "./ColumnAlignments";
|
7
|
+
export default function emitTable(md, state, result) {
|
8
|
+
let offsets = result.SeparatorLineOffsets;
|
9
|
+
let token = state.push('table_open', 'table', 1);
|
10
|
+
token.map = [offsets[0], offsets[offsets.length - 1]];
|
11
|
+
if (result.HeaderLines.length > 0) {
|
12
|
+
// emit table header
|
13
|
+
const token = state.push('thead_open', 'thead', 1);
|
14
|
+
token.map = [offsets[0], offsets[1]];
|
15
|
+
const cells = getCells(result.HeaderLines);
|
16
|
+
processRow(md, state, 'th', result.ColumnAlignments, offsets[0], offsets[1], cells);
|
17
|
+
state.push('thead_close', 'thead', -1);
|
18
|
+
offsets = offsets.slice(1);
|
19
|
+
}
|
20
|
+
// emit table body
|
21
|
+
token = state.push('tbody_open', 'tbody', 1);
|
22
|
+
token.map = [offsets[0], offsets[offsets.length - 1]];
|
23
|
+
for (let i = 0; i < result.RowLines.length; i++) {
|
24
|
+
let cells = getCells(result.RowLines[i]);
|
25
|
+
processRow(md, state, 'td', result.ColumnAlignments, offsets[i], offsets[i + 1], cells);
|
26
|
+
}
|
27
|
+
state.push('tbody_close', 'tbody', -1);
|
28
|
+
state.push('table_close', 'table', -1);
|
29
|
+
}
|
30
|
+
function processRow(md, state, tag, columnAlignments, lineBegin, lineEnd, cells) {
|
31
|
+
let token = state.push('tr_open', 'tr', 1);
|
32
|
+
token.map = [lineBegin, lineEnd];
|
33
|
+
for (let i = 0; i < cells.length; i++) {
|
34
|
+
let token = state.push(tag + '_open', tag, 1);
|
35
|
+
token.map = [lineBegin + 1, lineEnd - 1];
|
36
|
+
if (columnAlignments[i] !== ColumnAlignments.None) {
|
37
|
+
token.attrSet("style", `text-align: ${columnAlignments[i]};`);
|
38
|
+
}
|
39
|
+
if (cells[i].length === 0) {
|
40
|
+
// empty cell
|
41
|
+
}
|
42
|
+
else if (cells[i].length === 1) {
|
43
|
+
// single line cell -> emit as inline markdown
|
44
|
+
let token = state.push('inline', '', 0);
|
45
|
+
token.content = cells[i][0].trim();
|
46
|
+
token.children = [];
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
// multi line cell -> render and emit as html
|
50
|
+
let cell = md
|
51
|
+
.render(cells[i].join('\r\n'))
|
52
|
+
.trim();
|
53
|
+
// remove single p tag because we're in a table cell
|
54
|
+
if ((cell.slice(0, 3) === '<p>') &&
|
55
|
+
(cell.slice(-4) === '</p>') &&
|
56
|
+
(cell.indexOf('<p>', 3) === -1)) {
|
57
|
+
cell = cell.slice(3, cell.length - 4);
|
58
|
+
}
|
59
|
+
let token = state.push('html_block', '', 0);
|
60
|
+
token.content = cell;
|
61
|
+
token.children = [];
|
62
|
+
}
|
63
|
+
state.push(tag + '_close', tag, -1);
|
64
|
+
}
|
65
|
+
state.push('tr_close', 'tr', -1);
|
66
|
+
}
|
67
|
+
//# sourceMappingURL=EmitTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EmitTable.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/EmitTable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,gBAAgB,MA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,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import IState from "../../interfaces/markdown-it/IState";
|
2
|
+
/**
|
3
|
+
* Returns the char code of the character at the start of the current line,
|
4
|
+
* or -1 if this is not available (e.g. on an empty line).
|
5
|
+
*
|
6
|
+
* @param state The Markdown It state.
|
7
|
+
*/
|
8
|
+
export default function getCharCodeAtStartOfLine(state: IState, line: number): number;
|
9
|
+
//# sourceMappingURL=GetCharCodeAtStartOfLine.d.ts.map
|
@@ -0,0 +1,19 @@
|
|
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
|
+
/**
|
6
|
+
* Returns the char code of the character at the start of the current line,
|
7
|
+
* or -1 if this is not available (e.g. on an empty line).
|
8
|
+
*
|
9
|
+
* @param state The Markdown It state.
|
10
|
+
*/
|
11
|
+
export default function getCharCodeAtStartOfLine(state, line) {
|
12
|
+
const pos = state.bMarks[line] +
|
13
|
+
state.tShift[line];
|
14
|
+
if (pos >= state.eMarks[line]) {
|
15
|
+
return -1;
|
16
|
+
}
|
17
|
+
return state.src.charCodeAt(pos);
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=GetCharCodeAtStartOfLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GetCharCodeAtStartOfLine.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/GetCharCodeAtStartOfLine.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC5C,KAAa,EACb,IAAY;IAGZ,MAAM,GAAG,GACL,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;QAClB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEvB,IAAI,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAC7B;QACI,OAAO,CAAC,CAAC,CAAC;KACb;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
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 default function getLine(state, line) {
|
6
|
+
const start = state.bMarks[line] + state.blkIndent;
|
7
|
+
const end = state.eMarks[line];
|
8
|
+
return state.src.substr(start, end - start);
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=GetLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GetLine.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/GetLine.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,CAAC,OAAO,UAAU,OAAO,CAC3B,KAAa,EACb,IAAY;IAGZ,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAEnD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CACnB,KAAK,EACL,GAAG,GAAG,KAAK,CAAC,CAAC;AACrB,CAAC"}
|
@@ -0,0 +1,162 @@
|
|
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 wcwidth from "wcwidth";
|
6
|
+
import getColumnWidths from "../gridtables/GetColumnWidths";
|
7
|
+
import ColumnAlignments from "./ColumnAlignments";
|
8
|
+
import getLine from "./GetLine";
|
9
|
+
import ParseTableResult from "./ParseTableResult";
|
10
|
+
export default function parseTable(state, startLine, endLine) {
|
11
|
+
const result = new ParseTableResult();
|
12
|
+
let rowLine = getLine(state, startLine);
|
13
|
+
if (rowLine.charAt(0) !== '+') {
|
14
|
+
// line does not start with a '+'
|
15
|
+
return result;
|
16
|
+
}
|
17
|
+
result.ColumnWidths = getColumnWidths(rowLine);
|
18
|
+
if (result.ColumnWidths.length === 0) {
|
19
|
+
// no columns found
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
// initialize column alignments
|
23
|
+
result.ColumnAlignments = result.ColumnWidths
|
24
|
+
.map(_ => ColumnAlignments.None);
|
25
|
+
if (rowLine.indexOf(':') >= 0) {
|
26
|
+
// column alignment specifiers present in first row line
|
27
|
+
result.HeaderLess = true;
|
28
|
+
// set column alignments
|
29
|
+
result.ColumnAlignments = getColumnAlignments(rowLine, result.ColumnWidths);
|
30
|
+
// remove alignment specifiers for further matching
|
31
|
+
rowLine = rowLine.replace(/[:]/g, '-');
|
32
|
+
}
|
33
|
+
// create header line matcher
|
34
|
+
const headerLineMatcher = new RegExp('^\\+' +
|
35
|
+
result.ColumnWidths
|
36
|
+
.map(w => `[=:][=]{${w - 3}}[=:]\\+`)
|
37
|
+
.join('') +
|
38
|
+
'$');
|
39
|
+
// build column offsets
|
40
|
+
result.ColumnOffsets = [0];
|
41
|
+
for (let i = 0; i < result.ColumnWidths.length - 1; i++) {
|
42
|
+
result.ColumnOffsets.push(result.ColumnOffsets[i] +
|
43
|
+
result.ColumnWidths[i]);
|
44
|
+
}
|
45
|
+
// create cell line matcher
|
46
|
+
const cellLineMatcher = new RegExp('^\\|' +
|
47
|
+
result.ColumnWidths
|
48
|
+
.map(w => `([^|]{${Math.ceil((w - 1) / 2)},${w - 1}})\\|`)
|
49
|
+
.join('') +
|
50
|
+
'$');
|
51
|
+
// save first separator line offset
|
52
|
+
result.SeparatorLineOffsets.push(startLine);
|
53
|
+
// continue to scan until a complete table is found, or an invalid line is encountered
|
54
|
+
let currentRow = [];
|
55
|
+
let currentLine = startLine + 1;
|
56
|
+
for (; currentLine <= endLine; currentLine++) {
|
57
|
+
const line = getLine(state, currentLine);
|
58
|
+
if (line.charCodeAt(0) === 0x2B) // '+'
|
59
|
+
{
|
60
|
+
// separator line
|
61
|
+
if (currentRow.length === 0) {
|
62
|
+
// no row lines since last separator -> invalid table
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
// save separator line offset
|
66
|
+
result.SeparatorLineOffsets.push(currentLine);
|
67
|
+
if (line === rowLine) {
|
68
|
+
// new regular row
|
69
|
+
result.RowLines.push(currentRow);
|
70
|
+
if (result.HeaderLines.length === 0) {
|
71
|
+
result.HeaderLess = true;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
else if (!result.HeaderLess &&
|
75
|
+
line.match(headerLineMatcher)) {
|
76
|
+
// found header line
|
77
|
+
if (result.HeaderLines.length > 0 ||
|
78
|
+
result.RowLines.length > 0) {
|
79
|
+
// header already found, or not the first row -> invalid table
|
80
|
+
return result;
|
81
|
+
}
|
82
|
+
// header row
|
83
|
+
result.HeaderLines = currentRow;
|
84
|
+
if (line.indexOf(':') >= 0) {
|
85
|
+
// set column alignments
|
86
|
+
result.ColumnAlignments = getColumnAlignments(line, result.ColumnWidths);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
// not a header or regular row -> invalid table
|
91
|
+
return result;
|
92
|
+
}
|
93
|
+
// reset current row
|
94
|
+
currentRow = [];
|
95
|
+
}
|
96
|
+
else if (line.charCodeAt(0) === 0x7C) // '|'
|
97
|
+
{
|
98
|
+
// cell line
|
99
|
+
const matches = line.match(cellLineMatcher);
|
100
|
+
if (matches === null) {
|
101
|
+
// cell line does not match -> invalid table
|
102
|
+
return result;
|
103
|
+
}
|
104
|
+
const cells = validateColumnWidths(matches, result.ColumnWidths);
|
105
|
+
if (cells === null) {
|
106
|
+
// cell line does not match -> invalid table
|
107
|
+
return result;
|
108
|
+
}
|
109
|
+
// add the line to the current row
|
110
|
+
currentRow.push(cells);
|
111
|
+
}
|
112
|
+
else {
|
113
|
+
// not a separator or cell line, check if we have a complete table
|
114
|
+
if (currentRow.length === 0 &&
|
115
|
+
((result.HeaderLines.length > 0) ||
|
116
|
+
(result.RowLines.length > 0))) {
|
117
|
+
// found a complete table
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
return result;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
result.CurrentLine = currentLine;
|
124
|
+
result.Success = true;
|
125
|
+
return result;
|
126
|
+
}
|
127
|
+
function getColumnAlignments(line, columnWidths) {
|
128
|
+
let alignments = [];
|
129
|
+
let left = 1;
|
130
|
+
let right = -1;
|
131
|
+
for (let i = 0; i < columnWidths.length; i++) {
|
132
|
+
right += columnWidths[i];
|
133
|
+
let alignment = ColumnAlignments.None;
|
134
|
+
if (line.charAt(right) === ':') {
|
135
|
+
if (line.charAt(left) === ':') {
|
136
|
+
alignment = ColumnAlignments.Center;
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
alignment = ColumnAlignments.Right;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
else if (line.charAt(left) === ':') {
|
143
|
+
alignment = ColumnAlignments.Left;
|
144
|
+
}
|
145
|
+
alignments.push(alignment);
|
146
|
+
left += columnWidths[i];
|
147
|
+
}
|
148
|
+
return alignments;
|
149
|
+
}
|
150
|
+
function validateColumnWidths(matches, columnWidths) {
|
151
|
+
const cells = [];
|
152
|
+
for (var i = 0; i < columnWidths.length; i++) {
|
153
|
+
const cell = matches[i + 1];
|
154
|
+
const columnWidth = wcwidth(cell) + 1; // add 1 for separator
|
155
|
+
if (columnWidth !== columnWidths[i]) {
|
156
|
+
return null;
|
157
|
+
}
|
158
|
+
cells.push(cell);
|
159
|
+
}
|
160
|
+
return cells;
|
161
|
+
}
|
162
|
+
//# sourceMappingURL=ParseTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ParseTable.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ParseTable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,UAAU,CAC9B,KAAa,EACb,SAAiB,EACjB,OAAe;IAGf,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAEtC,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAExC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAC7B;QACI,iCAAiC;QACjC,OAAO,MAAM,CAAC;KACjB;IAED,MAAM,CAAC,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EACpC;QACI,mBAAmB;QACnB,OAAO,MAAM,CAAC;KACjB;IAED,+BAA+B;IAC/B,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,YAAY;SACxC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAC7B;QACI,wDAAwD;QACxD,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;QAEzB,wBAAwB;QACxB,MAAM,CAAC,gBAAgB,GAAG,mBAAmB,CACzC,OAAO,EACP,MAAM,CAAC,YAAY,CAAC,CAAC;QAEzB,mDAAmD;QACnD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EA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S,GAAG,gBAAgB,CAAC,KAAK,CAAC;aACtC;SACJ;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EACpC;YACI,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC;SACrC;QAED,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;KAC3B;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,SAAS,oBAAoB,CACzB,OAAyB,EACzB,YAAsB;IAGtB,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAC5C;QACI,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE5B,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,sBAAsB;QAE7D,IAAI,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,EACnC;YACI,OAAO,IAAI,CAAC;SACf;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import ColumnAlignments from "./ColumnAlignments";
|
2
|
+
export default class ParseTableResult {
|
3
|
+
Success: boolean;
|
4
|
+
ColumnWidths: number[];
|
5
|
+
ColumnOffsets: number[];
|
6
|
+
ColumnAlignments: ColumnAlignments[];
|
7
|
+
HeaderLess: boolean;
|
8
|
+
HeaderLines: string[][];
|
9
|
+
RowLines: string[][][];
|
10
|
+
SeparatorLineOffsets: number[];
|
11
|
+
CurrentLine: number;
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=ParseTableResult.d.ts.map
|
@@ -0,0 +1,18 @@
|
|
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 default class ParseTableResult {
|
6
|
+
constructor() {
|
7
|
+
this.Success = false;
|
8
|
+
this.ColumnWidths = [];
|
9
|
+
this.ColumnOffsets = [];
|
10
|
+
this.ColumnAlignments = [];
|
11
|
+
this.HeaderLess = false;
|
12
|
+
this.HeaderLines = [];
|
13
|
+
this.RowLines = [];
|
14
|
+
this.SeparatorLineOffsets = [];
|
15
|
+
this.CurrentLine = 0;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=ParseTableResult.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ParseTableResult.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/common/markdown-it/ParseTableResult.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAArC;QAEI,YAAO,GAAY,KAAK,CAAC;QAEzB,iBAAY,GAAa,EAAE,CAAC;QAE5B,kBAAa,GAAa,EAAE,CAAC;QAE7B,qBAAgB,GAAuB,EAAE,CAAC;QAE1C,eAAU,GAAY,KAAK,CAAC;QAE5B,gBAAW,GAAe,EAAE,CAAC;QAE7B,aAAQ,GAAiB,EAAE,CAAC;QAE5B,yBAAoB,GAAa,EAAE,CAAC;QAEpC,gBAAW,GAAW,CAAC,CAAC;IAC5B,CAAC;CAAA"}
|
@@ -0,0 +1,11 @@
|
|
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 gridTableRule from "./rules/gridtable";
|
6
|
+
export default function gridTableRulePlugin(
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8
|
+
md) {
|
9
|
+
md.block.ruler.before("table", "gridtable", gridTableRule(md));
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/gridtables/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,mBAAmB;AACvC,8DAA8D;AAC9D,EAAO;IAEP,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CACjB,OAAO,EACP,WAAW,EACX,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import IToken from "./IToken";
|
2
|
+
export default interface IState {
|
3
|
+
src: string;
|
4
|
+
bMarks: number[];
|
5
|
+
eMarks: number[];
|
6
|
+
blkIndent: number;
|
7
|
+
tShift: number[];
|
8
|
+
line: number;
|
9
|
+
push(action: string, tag: string, level: number): IToken;
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=IState.d.ts.map
|
@@ -0,0 +1,6 @@
|
|
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 {};
|
6
|
+
//# sourceMappingURL=IState.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IState.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/interfaces/markdown-it/IState.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
@@ -0,0 +1,6 @@
|
|
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 {};
|
6
|
+
//# sourceMappingURL=IToken.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IToken.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/interfaces/markdown-it/IToken.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
@@ -0,0 +1,6 @@
|
|
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 {};
|
6
|
+
//# sourceMappingURL=TRuleFunction.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TRuleFunction.js","sourceRoot":"","sources":["../../../../../src/plugins/gridtables/interfaces/markdown-it/TRuleFunction.ts"],"names":[],"mappings":"AAAA;;;gGAGgG"}
|
@@ -0,0 +1,26 @@
|
|
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
|
+
}
|
26
|
+
//# sourceMappingURL=gridtable.js.map
|
@@ -0,0 +1 @@
|
|
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"}
|