@podlite/schema 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -4
- package/README.md +40 -0
- package/lib/ast-helpers.js +1 -0
- package/lib/ast-inerator.d.ts +0 -1
- package/lib/ast-inerator.js +5 -13
- package/lib/blocks-helpers.d.ts +1 -1
- package/lib/blocks-helpers.js +15 -12
- package/lib/exportAny.js +14 -6
- package/lib/exportHtml.js +43 -36
- package/lib/grammar.js +1 -0
- package/lib/grammarfc.js +1 -0
- package/lib/helpers/config.js +8 -3
- package/lib/helpers/corePlugins.d.ts +12 -0
- package/lib/helpers/corePlugins.js +26 -0
- package/lib/helpers/handlers.js +1 -0
- package/lib/helpers/ids.d.ts +18 -0
- package/lib/helpers/ids.js +74 -0
- package/lib/helpers/makeInterator.js +6 -3
- package/lib/helpers/makeQuery.js +5 -1
- package/lib/helpers/makeQuery.test.js +32 -22
- package/lib/helpers/makeTransformer.js +7 -10
- package/lib/helpers/plugins.d.ts +2 -0
- package/lib/helpers/plugins.js +27 -0
- package/lib/index.d.ts +24 -21
- package/lib/index.js +18 -8
- package/lib/pluggableParser.d.ts +27 -0
- package/lib/pluggableParser.js +80 -0
- package/lib/plugin-clean-location.js +6 -3
- package/lib/plugin-defn-fill-term.js +7 -4
- package/lib/plugin-formatting-codes.js +39 -11
- package/lib/plugin-group-defn.js +10 -10
- package/lib/plugin-group-items.js +22 -20
- package/lib/plugin-heading.js +6 -3
- package/lib/plugin-items.js +9 -6
- package/lib/plugin-tables.js +46 -31
- package/lib/plugin-vmargin.js +5 -3
- package/lib/query-helpers.js +9 -6
- package/lib/types.d.ts +69 -69
- package/lib/types.js +1 -0
- package/lib/writer.js +22 -7
- package/lib/writerHtml.js +3 -2
- package/package.json +7 -8
- package/schema/index.d.ts +3 -3
- package/index.js +0 -2
|
@@ -4,46 +4,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_1 = __importDefault(require("./helpers/config"));
|
|
7
|
-
exports.default = () =>
|
|
8
|
-
const isNodesEqual = (n1, n2) =>
|
|
9
|
-
// if nodes items
|
|
7
|
+
exports.default = () => tree => {
|
|
8
|
+
const isNodesEqual = (n1, n2) =>
|
|
9
|
+
// if nodes items
|
|
10
10
|
(n1.name === 'item' || n1.name === 'defn') &&
|
|
11
11
|
n2.name === n1.name &&
|
|
12
12
|
n1['level'] === n2.level &&
|
|
13
|
-
isNumbered(n1) === isNumbered(n2)
|
|
14
|
-
const isNumbered =
|
|
13
|
+
isNumbered(n1) === isNumbered(n2);
|
|
14
|
+
const isNumbered = node => Boolean((0, config_1.default)(node, {}).exists('numbered'));
|
|
15
15
|
const group = (a, level = 1) => {
|
|
16
|
-
const isInListMode =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const isInListMode = a => {
|
|
17
|
+
return a.length > 0 && a[a.length - 1].type === 'list';
|
|
18
|
+
};
|
|
19
|
+
const getList = a => {
|
|
20
|
+
if (isInListMode(a))
|
|
21
|
+
return a[a.length - 1];
|
|
22
|
+
};
|
|
23
|
+
const isInsertableToList = (l, i) => (i.name && i.name === 'item' && i.type && i.type === 'block') || i.type === 'blankline';
|
|
22
24
|
let lastItem = {};
|
|
23
25
|
let result = a.reduce((a, i) => {
|
|
24
26
|
// skip items out of level
|
|
25
27
|
if (i.name === 'item' && i.type === 'block' && i.level < level) {
|
|
26
28
|
return [...a, i];
|
|
27
29
|
}
|
|
28
|
-
if (i.name === 'item' &&
|
|
29
|
-
|
|
30
|
+
if (i.name === 'item' &&
|
|
31
|
+
i.type === 'block' &&
|
|
32
|
+
(!isInListMode(a) ||
|
|
30
33
|
// different type of list and item
|
|
31
34
|
// at the same level
|
|
32
|
-
(i.level === level
|
|
33
|
-
&&
|
|
34
|
-
getList(a).list !== (isNumbered(i) ? 'ordered' : 'itemized')))) {
|
|
35
|
+
(i.level === level && getList(a).list !== (isNumbered(i) ? 'ordered' : 'itemized')))) {
|
|
35
36
|
// create empty list
|
|
36
37
|
// list = ['ordered', 'variable', 'itemized']
|
|
37
38
|
a.push({
|
|
38
39
|
type: 'list',
|
|
39
40
|
level: i.level,
|
|
40
41
|
content: [],
|
|
41
|
-
list: isNumbered(i) ? 'ordered' : 'itemized'
|
|
42
|
+
list: isNumbered(i) ? 'ordered' : 'itemized',
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
// main logic
|
|
45
|
-
if (isInListMode(a)
|
|
46
|
-
|
|
46
|
+
if (isInListMode(a) && isInsertableToList(getList(a), i)) {
|
|
47
|
+
// getlist and push item to them
|
|
47
48
|
getList(a).content.push(i);
|
|
48
49
|
}
|
|
49
50
|
else {
|
|
@@ -66,7 +67,7 @@ exports.default = () => (tree) => {
|
|
|
66
67
|
return item;
|
|
67
68
|
});
|
|
68
69
|
};
|
|
69
|
-
const visit =
|
|
70
|
+
const visit = node => {
|
|
70
71
|
if (Array.isArray(node)) {
|
|
71
72
|
node = group(node);
|
|
72
73
|
}
|
|
@@ -80,3 +81,4 @@ exports.default = () => (tree) => {
|
|
|
80
81
|
tree = visit(tree);
|
|
81
82
|
return tree;
|
|
82
83
|
};
|
|
84
|
+
//# sourceMappingURL=plugin-group-items.js.map
|
package/lib/plugin-heading.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = () =>
|
|
4
|
-
const visit =
|
|
3
|
+
exports.default = () => tree => {
|
|
4
|
+
const visit = node => {
|
|
5
5
|
if (Array.isArray(node)) {
|
|
6
|
-
node.forEach(i => {
|
|
6
|
+
node.forEach(i => {
|
|
7
|
+
visit(i);
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
else {
|
|
9
11
|
if (node && node.type === 'block') {
|
|
@@ -30,3 +32,4 @@ exports.default = () => (tree) => {
|
|
|
30
32
|
visit(tree);
|
|
31
33
|
return tree;
|
|
32
34
|
};
|
|
35
|
+
//# sourceMappingURL=plugin-heading.js.map
|
package/lib/plugin-items.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = () =>
|
|
4
|
-
const visit =
|
|
3
|
+
exports.default = () => tree => {
|
|
4
|
+
const visit = node => {
|
|
5
5
|
if (Array.isArray(node)) {
|
|
6
|
-
node.forEach(i => {
|
|
6
|
+
node.forEach(i => {
|
|
7
|
+
visit(i);
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
else {
|
|
9
11
|
if (node && node.type === 'block') {
|
|
@@ -23,9 +25,9 @@ exports.default = () => (tree) => {
|
|
|
23
25
|
}
|
|
24
26
|
node.config = node.config || [];
|
|
25
27
|
node.config.push({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
name: 'numbered',
|
|
29
|
+
value: true,
|
|
30
|
+
type: 'boolean',
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -38,3 +40,4 @@ exports.default = () => (tree) => {
|
|
|
38
40
|
visit(tree);
|
|
39
41
|
return tree;
|
|
40
42
|
};
|
|
43
|
+
//# sourceMappingURL=plugin-items.js.map
|
package/lib/plugin-tables.js
CHANGED
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
*/
|
|
11
11
|
const makeTransformer_1 = __importDefault(require("./helpers/makeTransformer"));
|
|
12
12
|
function flattenDeep(arr) {
|
|
13
|
-
return arr.reduce((acc, val) => Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val), []);
|
|
13
|
+
return arr.reduce((acc, val) => (Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val)), []);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Helpers section
|
|
17
17
|
*/
|
|
18
|
-
// run cb in symbols pair
|
|
18
|
+
// run cb in symbols pair
|
|
19
19
|
const strbin = (str1, str2, cb) => {
|
|
20
20
|
let res = [];
|
|
21
21
|
for (let i = 0; str1.length > i; i++) {
|
|
@@ -28,33 +28,36 @@ const makeMask = (lines, separators) => {
|
|
|
28
28
|
// calculate template length
|
|
29
29
|
const tmplLength = Math.max(...[...lines, ...separators].map(s => s.length));
|
|
30
30
|
// make bin mask for each string
|
|
31
|
-
const masks = lines.map(
|
|
31
|
+
const masks = lines.map(str => {
|
|
32
32
|
/** make mask for each line
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
' The Shoveller | Eddie Stevens | King Arthur\'s singing shovel',
|
|
34
|
+
'0000000011111111111110001111111111111000001111111111111111111111111111' ]
|
|
35
|
+
then not(mask) ... then & masks
|
|
36
|
+
*/
|
|
37
37
|
// enlarge string to tmplLength
|
|
38
|
-
let tstr = str +
|
|
38
|
+
let tstr = str + ' '.repeat(tmplLength - str.length);
|
|
39
39
|
let mask = [];
|
|
40
40
|
const re = /\s+[+|\s]\s/g;
|
|
41
41
|
let match;
|
|
42
42
|
while ((match = re.exec(tstr)) != null) {
|
|
43
|
-
const tmpMask = '1'.repeat(match.index) +
|
|
44
|
-
'0'.repeat(match[0].length);
|
|
43
|
+
const tmpMask = '1'.repeat(match.index) + '0'.repeat(match[0].length);
|
|
45
44
|
mask.push(tmpMask + '1'.repeat(tmplLength - tmpMask.length));
|
|
46
45
|
}
|
|
47
|
-
return mask.reduce((a, b) => {
|
|
46
|
+
return mask.reduce((a, b) => {
|
|
47
|
+
return strbin(a, b, (i1, i2) => i1 & i2);
|
|
48
|
+
}, '1'.repeat(tmplLength));
|
|
48
49
|
});
|
|
49
50
|
// make result mask
|
|
50
|
-
const inverted = masks.map(m => strbin(m, '',
|
|
51
|
-
const columnTemplate = inverted.reduce((a, b) => {
|
|
51
|
+
const inverted = masks.map(m => strbin(m, '', i1 => (i1 == 0 ? 1 : 0)));
|
|
52
|
+
const columnTemplate = inverted.reduce((a, b) => {
|
|
53
|
+
return strbin(a, b, (i1, i2) => i1 & i2);
|
|
54
|
+
}, '1'.repeat(tmplLength));
|
|
52
55
|
return columnTemplate;
|
|
53
56
|
};
|
|
54
57
|
const extractColumnsByTemplate = (text, template) => {
|
|
55
|
-
const lines = flattenDeep(text
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
+
const lines = flattenDeep(text
|
|
59
|
+
.split(/\n/) // split each row by eol
|
|
60
|
+
.filter(str => str.length > 0));
|
|
58
61
|
const cols = lines.map(line => {
|
|
59
62
|
const re = /((1+|0+))/g;
|
|
60
63
|
let columns = [];
|
|
@@ -79,53 +82,65 @@ const extractColumnsByTemplate = (text, template) => {
|
|
|
79
82
|
/**
|
|
80
83
|
* Main transforms
|
|
81
84
|
*/
|
|
82
|
-
exports.default = () =>
|
|
83
|
-
const transformer = (0, makeTransformer_1.default)({
|
|
85
|
+
exports.default = () => tree => {
|
|
86
|
+
const transformer = (0, makeTransformer_1.default)({
|
|
87
|
+
table: node => {
|
|
84
88
|
let rows = [];
|
|
85
|
-
const collectValues =
|
|
89
|
+
const collectValues = row => {
|
|
90
|
+
rows.push(row.value);
|
|
91
|
+
};
|
|
86
92
|
// collect separators for calculate max length of rows
|
|
87
93
|
let seps = [];
|
|
88
94
|
(0, makeTransformer_1.default)({
|
|
89
95
|
'row:text': collectValues,
|
|
90
96
|
'head:text': collectValues,
|
|
91
|
-
':separator':
|
|
97
|
+
':separator': sep => {
|
|
98
|
+
seps.push(sep.text);
|
|
99
|
+
},
|
|
92
100
|
})(node);
|
|
93
101
|
// add table-caption
|
|
94
102
|
// if table empty return node as is
|
|
95
103
|
if (!rows.length)
|
|
96
104
|
return node;
|
|
97
|
-
const splitToLines =
|
|
98
|
-
.
|
|
105
|
+
const splitToLines = row => row
|
|
106
|
+
.split(/\n/) // split each row by eol
|
|
107
|
+
.filter(str => str.length > 0); // filter empty strings ( after slit )
|
|
99
108
|
// split each row into lines
|
|
100
109
|
const lines = flattenDeep(rows.map(splitToLines));
|
|
101
110
|
const separators = flattenDeep(seps.map(splitToLines));
|
|
102
111
|
// collect text rows
|
|
103
112
|
let textRows = [];
|
|
104
113
|
(0, makeTransformer_1.default)({
|
|
105
|
-
'row:text':
|
|
114
|
+
'row:text': row => {
|
|
115
|
+
textRows.push(row.value);
|
|
116
|
+
},
|
|
106
117
|
})(node);
|
|
107
118
|
const columnTemplate = makeMask(lines, separators);
|
|
108
|
-
const makeBlock = (name, content, ...attr) => {
|
|
119
|
+
const makeBlock = (name, content, ...attr) => {
|
|
120
|
+
return { ...attr, name, type: 'block', content: Array.isArray(content) ? content : [content] };
|
|
121
|
+
};
|
|
109
122
|
// make columns
|
|
110
123
|
const res = (0, makeTransformer_1.default)({
|
|
111
|
-
'row:text':
|
|
124
|
+
'row:text': row => {
|
|
112
125
|
if (textRows.length == 1) {
|
|
113
126
|
// split each text row into lines
|
|
114
127
|
const textRowsLines = flattenDeep([row.value].map(splitToLines));
|
|
115
|
-
return textRowsLines.map(
|
|
128
|
+
return textRowsLines.map(rowValue => {
|
|
116
129
|
const res = extractColumnsByTemplate(rowValue, columnTemplate);
|
|
117
|
-
return makeBlock('table_row', res.map(
|
|
130
|
+
return makeBlock('table_row', res.map(col => makeBlock('table_cell', { type: 'text', value: col })));
|
|
118
131
|
});
|
|
119
132
|
}
|
|
120
133
|
const res = extractColumnsByTemplate(row.value, columnTemplate);
|
|
121
|
-
return makeBlock('table_row', res.map(
|
|
134
|
+
return makeBlock('table_row', res.map(col => makeBlock('table_cell', { type: 'text', value: col })));
|
|
122
135
|
},
|
|
123
|
-
'head:text':
|
|
136
|
+
'head:text': head => {
|
|
124
137
|
const res = extractColumnsByTemplate(head.value, columnTemplate);
|
|
125
|
-
return makeBlock('table_head', res.map(
|
|
138
|
+
return makeBlock('table_head', res.map(col => makeBlock('table_cell', { type: 'text', value: col })));
|
|
126
139
|
},
|
|
127
140
|
})(node);
|
|
128
141
|
return res;
|
|
129
|
-
}
|
|
142
|
+
},
|
|
143
|
+
});
|
|
130
144
|
return transformer(tree, {});
|
|
131
145
|
};
|
|
146
|
+
//# sourceMappingURL=plugin-tables.js.map
|
package/lib/plugin-vmargin.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const middle = () =>
|
|
3
|
+
const middle = () => tree => {
|
|
4
4
|
const visit_node = (node, context = {}) => {
|
|
5
5
|
// if( (node.type || "").match(/(code|text)/) ) {
|
|
6
6
|
if (node.type == 'code' || node.type == 'text') {
|
|
7
7
|
if (node.margin && context.margin && context.margin.length > 0 && context.margin.length == node.margin.length) {
|
|
8
|
+
;
|
|
8
9
|
node.type = 'para';
|
|
9
10
|
}
|
|
10
11
|
if (node.type === 'code') {
|
|
@@ -17,13 +18,14 @@ const middle = () => (tree) => {
|
|
|
17
18
|
context.margin = typeof node.margin !== 'string' ? '' : node.margin;
|
|
18
19
|
let newctx = { ...context };
|
|
19
20
|
newctx.nest = (newctx.nest || 0) + 1;
|
|
20
|
-
node.content.map(
|
|
21
|
+
node.content.map(n => {
|
|
21
22
|
visit_node(n, context);
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
var ctx = {};
|
|
26
|
-
tree.forEach(
|
|
27
|
+
tree.forEach(n => visit_node(n, ctx));
|
|
27
28
|
return tree;
|
|
28
29
|
};
|
|
29
30
|
exports.default = middle;
|
|
31
|
+
//# sourceMappingURL=plugin-vmargin.js.map
|
package/lib/query-helpers.js
CHANGED
|
@@ -31,7 +31,7 @@ const compileQuery = (...obj) => {
|
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
// obj should accomplished if some queries is true
|
|
34
|
-
if (compiledQueries.some(
|
|
34
|
+
if (compiledQueries.some(fn => fn(item).length > 0)) {
|
|
35
35
|
result.push(item);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -43,7 +43,7 @@ exports.compileQuery = compileQuery;
|
|
|
43
43
|
const compileAtomQuery = (obj) => {
|
|
44
44
|
const queries = [];
|
|
45
45
|
if (obj instanceof Array) {
|
|
46
|
-
throw new Error(
|
|
46
|
+
throw new Error('Wrong query parameter [Array], should be [Function] or [Object]');
|
|
47
47
|
}
|
|
48
48
|
else if (typeof obj === 'function') {
|
|
49
49
|
queries.push(obj);
|
|
@@ -51,7 +51,7 @@ const compileAtomQuery = (obj) => {
|
|
|
51
51
|
else {
|
|
52
52
|
for (const entry of Object.entries(obj)) {
|
|
53
53
|
const [key, value] = entry;
|
|
54
|
-
const checkValue =
|
|
54
|
+
const checkValue = val => {
|
|
55
55
|
if (value instanceof Array) {
|
|
56
56
|
return value.includes(val);
|
|
57
57
|
}
|
|
@@ -81,7 +81,7 @@ const compileAtomQuery = (obj) => {
|
|
|
81
81
|
result.push(...AND(item));
|
|
82
82
|
}
|
|
83
83
|
// obj should accomplished if all queries to be true
|
|
84
|
-
if (queries.every(
|
|
84
|
+
if (queries.every(fn => fn(item))) {
|
|
85
85
|
result.push(item);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
@@ -100,12 +100,14 @@ const getFromTree = (tree, ...queries) => {
|
|
|
100
100
|
}
|
|
101
101
|
let results = [];
|
|
102
102
|
let rules = {};
|
|
103
|
-
const transformer = (0, _1.makeTransformer)({
|
|
103
|
+
const transformer = (0, _1.makeTransformer)({
|
|
104
|
+
'*:*': (node, ctx) => {
|
|
104
105
|
results.push(node);
|
|
105
106
|
if ('content' in node) {
|
|
106
107
|
return { node, content: transformer(node.content, { ...ctx }) };
|
|
107
108
|
}
|
|
108
|
-
}
|
|
109
|
+
},
|
|
110
|
+
});
|
|
109
111
|
transformer(tree, {});
|
|
110
112
|
//convert queries
|
|
111
113
|
const queryAtoms = [];
|
|
@@ -131,3 +133,4 @@ const getFromTree = (tree, ...queries) => {
|
|
|
131
133
|
return (0, exports.compileQuery)(...queryAtoms)(results);
|
|
132
134
|
};
|
|
133
135
|
exports.getFromTree = getFromTree;
|
|
136
|
+
//# sourceMappingURL=query-helpers.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export interface RulesStrict {
|
|
|
28
28
|
'U<>': RuleHandler<FormattingCodeAny>;
|
|
29
29
|
'Z<>': RuleHandler<FormattingCodeAny>;
|
|
30
30
|
'Delete<>': RuleHandler<FormattingCodeAny>;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
pod: RuleHandler<Para>;
|
|
32
|
+
root: RuleHandler<RootBlock>;
|
|
33
33
|
':para': RuleHandler<Para>;
|
|
34
34
|
':text': RuleHandler<Text>;
|
|
35
35
|
':blankline': RuleHandler<BlankLine>;
|
|
@@ -39,33 +39,33 @@ export interface RulesStrict {
|
|
|
39
39
|
':list': RuleHandler<List>;
|
|
40
40
|
':config': RuleHandler<BlockConfig>;
|
|
41
41
|
':alias': RuleHandler<Alias>;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
data: RuleHandler<BlockData>;
|
|
43
|
+
code: RuleHandler<BlockCode>;
|
|
44
|
+
para: RuleHandler<BlockPara>;
|
|
45
|
+
defn: RuleHandler<BlockDefn>;
|
|
46
|
+
nested: RuleHandler<BlockNested>;
|
|
47
|
+
output: RuleHandler<BlockOutput>;
|
|
48
|
+
input: RuleHandler<BlockInput>;
|
|
49
|
+
image: RuleHandler<BlockImage>;
|
|
50
50
|
':image': RuleHandler<Image>;
|
|
51
51
|
'item:block': RuleHandler<BlockItem>;
|
|
52
|
-
|
|
52
|
+
item: RuleHandler<BlockItem>;
|
|
53
53
|
'comment:block': RuleHandler<BlockComment>;
|
|
54
|
-
|
|
54
|
+
comment: RuleHandler<BlockComment>;
|
|
55
55
|
'head:block': RuleHandler<BlockHead>;
|
|
56
|
-
|
|
56
|
+
head: RuleHandler<BlockHead>;
|
|
57
57
|
':fcode': RuleHandler<FormattingCodes>;
|
|
58
58
|
'table:block': RuleHandler<BlockTable>;
|
|
59
|
-
|
|
59
|
+
table: RuleHandler<BlockTable>;
|
|
60
60
|
':separator': RuleHandler<Separator>;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
table_row: RuleHandler<TableRow>;
|
|
62
|
+
table_cell: RuleHandler<TableCell>;
|
|
63
|
+
table_head: RuleHandler<TableHead>;
|
|
64
64
|
':toc': RuleHandler<Toc>;
|
|
65
65
|
':toc-list': RuleHandler<TocList>;
|
|
66
66
|
':toc-item': RuleHandler<TocItem>;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
Diagram: RuleHandler<BlockDiagram>;
|
|
68
|
+
Image: RuleHandler<BlockNamed>;
|
|
69
69
|
}
|
|
70
70
|
export interface Rules extends RulesStrict {
|
|
71
71
|
[name: string]: RuleHandler;
|
|
@@ -114,112 +114,112 @@ export interface RootBlock extends Omit<Block, 'location'> {
|
|
|
114
114
|
content: AstTree;
|
|
115
115
|
}
|
|
116
116
|
export interface FormattingCodeB {
|
|
117
|
-
type:
|
|
118
|
-
name:
|
|
117
|
+
type: 'fcode';
|
|
118
|
+
name: 'B';
|
|
119
119
|
content?: Array<Node>;
|
|
120
120
|
}
|
|
121
121
|
export interface FormattingCodeC {
|
|
122
|
-
type:
|
|
123
|
-
name:
|
|
122
|
+
type: 'fcode';
|
|
123
|
+
name: 'C';
|
|
124
124
|
content?: Array<FormattingCodes | string>;
|
|
125
125
|
}
|
|
126
126
|
export interface FormattingCodeE {
|
|
127
|
-
type:
|
|
128
|
-
name:
|
|
127
|
+
type: 'fcode';
|
|
128
|
+
name: 'E';
|
|
129
129
|
content: Array<{
|
|
130
|
-
type:
|
|
130
|
+
type: 'number';
|
|
131
131
|
value: number;
|
|
132
132
|
}>;
|
|
133
133
|
}
|
|
134
134
|
export interface FormattingCodeN {
|
|
135
|
-
type:
|
|
136
|
-
name:
|
|
135
|
+
type: 'fcode';
|
|
136
|
+
name: 'N';
|
|
137
137
|
content?: Array<FormattingCodes | string>;
|
|
138
138
|
}
|
|
139
139
|
export interface FormattingCodeX {
|
|
140
|
-
type:
|
|
141
|
-
name:
|
|
140
|
+
type: 'fcode';
|
|
141
|
+
name: 'X';
|
|
142
142
|
entry: Array<string> | null;
|
|
143
143
|
content?: Array<FormattingCodes | string>;
|
|
144
144
|
}
|
|
145
145
|
export interface FormattingCodeZ {
|
|
146
|
-
type:
|
|
147
|
-
name:
|
|
146
|
+
type: 'fcode';
|
|
147
|
+
name: 'Z';
|
|
148
148
|
content?: string;
|
|
149
149
|
}
|
|
150
150
|
export interface FormattingCodeV {
|
|
151
|
-
type:
|
|
152
|
-
name:
|
|
151
|
+
type: 'fcode';
|
|
152
|
+
name: 'V';
|
|
153
153
|
content?: string;
|
|
154
154
|
}
|
|
155
155
|
export interface FormattingCodeS {
|
|
156
|
-
type:
|
|
157
|
-
name:
|
|
156
|
+
type: 'fcode';
|
|
157
|
+
name: 'S';
|
|
158
158
|
content?: string | Text;
|
|
159
159
|
}
|
|
160
160
|
export interface FormattingCodeA {
|
|
161
|
-
type:
|
|
162
|
-
name:
|
|
161
|
+
type: 'fcode';
|
|
162
|
+
name: 'A';
|
|
163
163
|
content: string | Text;
|
|
164
164
|
}
|
|
165
165
|
export interface FormattingCodeD {
|
|
166
|
-
type:
|
|
167
|
-
name:
|
|
166
|
+
type: 'fcode';
|
|
167
|
+
name: 'D';
|
|
168
168
|
synonyms: Array<string>;
|
|
169
169
|
content: string;
|
|
170
170
|
}
|
|
171
171
|
export interface FormattingCodeL {
|
|
172
|
-
type:
|
|
173
|
-
name:
|
|
172
|
+
type: 'fcode';
|
|
173
|
+
name: 'L';
|
|
174
174
|
meta: string | null;
|
|
175
175
|
content: string | Text;
|
|
176
176
|
}
|
|
177
177
|
export interface FormattingCodeI {
|
|
178
|
-
type:
|
|
179
|
-
name:
|
|
178
|
+
type: 'fcode';
|
|
179
|
+
name: 'I';
|
|
180
180
|
meta: string;
|
|
181
181
|
content: string | Text;
|
|
182
182
|
}
|
|
183
183
|
export interface FormattingCodeAny {
|
|
184
|
-
type:
|
|
184
|
+
type: 'fcode';
|
|
185
185
|
name: string;
|
|
186
186
|
content?: Array<FormattingCodes | string>;
|
|
187
187
|
}
|
|
188
188
|
export interface Ambient {
|
|
189
|
-
type:
|
|
189
|
+
type: 'ambient';
|
|
190
190
|
text: string;
|
|
191
191
|
location: Location;
|
|
192
192
|
}
|
|
193
193
|
export interface Verbatim {
|
|
194
|
-
type:
|
|
194
|
+
type: 'verbatim';
|
|
195
195
|
value: string;
|
|
196
196
|
}
|
|
197
197
|
export interface Text {
|
|
198
|
-
type:
|
|
198
|
+
type: 'text';
|
|
199
199
|
value: string;
|
|
200
200
|
}
|
|
201
201
|
export interface Para {
|
|
202
|
-
type:
|
|
202
|
+
type: 'para';
|
|
203
203
|
text: string;
|
|
204
204
|
margin: string;
|
|
205
205
|
location: Location;
|
|
206
206
|
content: Array<Node | FormattingCodes>;
|
|
207
207
|
}
|
|
208
208
|
export interface Code {
|
|
209
|
-
type:
|
|
209
|
+
type: 'code';
|
|
210
210
|
text: string;
|
|
211
211
|
margin: string;
|
|
212
212
|
location: Location;
|
|
213
213
|
content: Array<Verbatim | string>;
|
|
214
214
|
}
|
|
215
215
|
export interface BlankLine {
|
|
216
|
-
type:
|
|
216
|
+
type: 'blankline';
|
|
217
217
|
}
|
|
218
218
|
export interface List {
|
|
219
|
-
type:
|
|
219
|
+
type: 'list';
|
|
220
220
|
level: string | number;
|
|
221
221
|
content: Array<BlockItem | BlankLine | List>;
|
|
222
|
-
list:
|
|
222
|
+
list: 'itemized';
|
|
223
223
|
}
|
|
224
224
|
export interface ConfigItemKV {
|
|
225
225
|
[key: string]: string | number | boolean;
|
|
@@ -233,13 +233,13 @@ export interface ConfigItem {
|
|
|
233
233
|
}
|
|
234
234
|
export interface BlockConfig {
|
|
235
235
|
name: string;
|
|
236
|
-
type:
|
|
236
|
+
type: 'config';
|
|
237
237
|
config: Array<ConfigItem>;
|
|
238
238
|
margin: string;
|
|
239
239
|
}
|
|
240
240
|
export interface Alias {
|
|
241
241
|
name: string;
|
|
242
|
-
type:
|
|
242
|
+
type: 'alias';
|
|
243
243
|
replacement: Array<string>;
|
|
244
244
|
margin: string;
|
|
245
245
|
}
|
|
@@ -248,7 +248,7 @@ export interface Separator {
|
|
|
248
248
|
text: string;
|
|
249
249
|
}
|
|
250
250
|
export interface Block {
|
|
251
|
-
type:
|
|
251
|
+
type: 'block';
|
|
252
252
|
location: Location;
|
|
253
253
|
content: Array<Node>;
|
|
254
254
|
margin: string;
|
|
@@ -268,18 +268,18 @@ export interface BlockDefn extends Block {
|
|
|
268
268
|
name: 'defn';
|
|
269
269
|
}
|
|
270
270
|
export interface BlockItem extends Block {
|
|
271
|
-
name:
|
|
271
|
+
name: 'item';
|
|
272
272
|
content: Array<Node>;
|
|
273
273
|
level: string | number;
|
|
274
274
|
}
|
|
275
275
|
export interface BlockOutput extends Block {
|
|
276
|
-
name:
|
|
276
|
+
name: 'output';
|
|
277
277
|
}
|
|
278
278
|
export interface BlockInput extends Block {
|
|
279
|
-
name:
|
|
279
|
+
name: 'input';
|
|
280
280
|
}
|
|
281
281
|
export interface BlockPara extends Block {
|
|
282
|
-
name:
|
|
282
|
+
name: 'para';
|
|
283
283
|
}
|
|
284
284
|
export interface BlockCode extends Block {
|
|
285
285
|
name: 'code';
|
|
@@ -292,28 +292,28 @@ export interface BlockHead extends Block {
|
|
|
292
292
|
level: number | string;
|
|
293
293
|
}
|
|
294
294
|
export interface BlockTable extends Omit<Block, 'content'> {
|
|
295
|
-
name:
|
|
295
|
+
name: 'table';
|
|
296
296
|
content: Array<TableHead | TableSeparator | TableRow | BlankLine>;
|
|
297
297
|
text?: string;
|
|
298
298
|
}
|
|
299
299
|
export interface TableCell {
|
|
300
|
-
name:
|
|
301
|
-
type:
|
|
300
|
+
name: 'table_cell';
|
|
301
|
+
type: 'block';
|
|
302
302
|
content: Array<string>;
|
|
303
303
|
}
|
|
304
304
|
export interface TableRow {
|
|
305
|
-
name:
|
|
306
|
-
type:
|
|
305
|
+
name: 'table_row';
|
|
306
|
+
type: 'block';
|
|
307
307
|
content: Array<TableCell>;
|
|
308
308
|
}
|
|
309
309
|
export interface TableHead {
|
|
310
|
-
name:
|
|
311
|
-
type:
|
|
310
|
+
name: 'table_head';
|
|
311
|
+
type: 'block';
|
|
312
312
|
content: Array<TableCell>;
|
|
313
313
|
}
|
|
314
314
|
export interface TableSeparator {
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
type: 'separator';
|
|
316
|
+
text: string;
|
|
317
317
|
}
|
|
318
318
|
export declare type BlockAny = BlockNamed;
|
|
319
319
|
export interface BlockNamed extends Omit<Block, 'content'> {
|