@podlite/schema 0.0.15 → 0.0.17
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 +9 -0
- package/esm/blocks-helpers.d.ts +2 -2
- package/esm/blocks-helpers.js.map +1 -1
- package/esm/grammar.js +4 -3
- package/esm/grammar.js.map +1 -1
- package/esm/helpers/ids.d.ts +5 -0
- package/esm/helpers/ids.js +26 -2
- package/esm/helpers/ids.js.map +1 -1
- package/esm/plugin-formatting-codes.js +2 -1
- package/esm/plugin-formatting-codes.js.map +1 -1
- package/esm/types.d.ts +17 -2
- package/lib/blocks-helpers.d.ts +2 -2
- package/lib/grammar.js +4 -3
- package/lib/helpers/ids.d.ts +5 -0
- package/lib/helpers/ids.js +30 -4
- package/lib/plugin-formatting-codes.js +2 -1
- package/lib/types.d.ts +17 -2
- package/package.json +1 -1
- package/schema/AstTree.json +71 -0
- package/schema/PodliteDocument.json +71 -0
package/esm/helpers/ids.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const cleanIds: (src?: {
|
|
|
7
7
|
skipChain: number;
|
|
8
8
|
podMode: number;
|
|
9
9
|
}) => (tree: any) => any;
|
|
10
|
+
export declare const slugifyText: (text: string) => string;
|
|
10
11
|
/**
|
|
11
12
|
* Add set id to 'id' to each blocks
|
|
12
13
|
*/
|
|
@@ -14,5 +15,9 @@ export declare const frozenIds: (src?: {
|
|
|
14
15
|
skipChain: number;
|
|
15
16
|
podMode: number;
|
|
16
17
|
}) => (tree: any) => any;
|
|
18
|
+
export declare const cleanLocalHrefs: (src?: {
|
|
19
|
+
skipChain: number;
|
|
20
|
+
podMode: number;
|
|
21
|
+
}) => (tree: any) => any;
|
|
17
22
|
declare const middleware: ParserPlugin;
|
|
18
23
|
export default middleware;
|
package/esm/helpers/ids.js
CHANGED
|
@@ -19,18 +19,42 @@ export const cleanIds = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
|
19
19
|
});
|
|
20
20
|
return transformerBlocks(tree, {});
|
|
21
21
|
};
|
|
22
|
+
// TODO: refactor linking for blocks
|
|
23
|
+
export const slugifyText = (text) => {
|
|
24
|
+
// https://github.com/microsoft/vscode/blob/master/extensions/markdown-language-features/src/slugify.ts
|
|
25
|
+
return text.trim()
|
|
26
|
+
// .toLowerCase()
|
|
27
|
+
.replace(/\s+/g, '-')
|
|
28
|
+
.replace(/[\]\[\!\/\'\"\#\$\%\&\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, '')
|
|
29
|
+
.replace(/^\-+/, '');
|
|
30
|
+
};
|
|
22
31
|
/**
|
|
23
32
|
* Add set id to 'id' to each blocks
|
|
24
33
|
*/
|
|
25
34
|
export const frozenIds = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
26
35
|
const transformerBlocks = makeTransformer({
|
|
27
36
|
'*': (node, ctx, visiter) => {
|
|
37
|
+
if ('content' in node) {
|
|
38
|
+
node.content = visiter(node.content, ctx);
|
|
39
|
+
}
|
|
28
40
|
if ('id' in node) {
|
|
41
|
+
const { id, ...rest } = node;
|
|
42
|
+
return { ...rest, id: 'id' };
|
|
43
|
+
}
|
|
44
|
+
return node;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return transformerBlocks(tree, {});
|
|
48
|
+
};
|
|
49
|
+
export const cleanLocalHrefs = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
50
|
+
const transformerBlocks = makeTransformer({
|
|
51
|
+
'L<>': (node, ctx, visiter) => {
|
|
52
|
+
if ('meta' in node) {
|
|
29
53
|
if ('content' in node) {
|
|
30
54
|
node.content = visiter(node.content, ctx);
|
|
31
55
|
}
|
|
32
56
|
const { id, ...rest } = node;
|
|
33
|
-
return { ...rest,
|
|
57
|
+
return { ...rest, meta: '#' };
|
|
34
58
|
}
|
|
35
59
|
return node;
|
|
36
60
|
},
|
|
@@ -46,7 +70,7 @@ const middleware = () => tree => {
|
|
|
46
70
|
return node;
|
|
47
71
|
}
|
|
48
72
|
else if (node.name == 'head') {
|
|
49
|
-
return { ...node, id: getTextContentFromNode(node)
|
|
73
|
+
return { ...node, id: slugifyText(getTextContentFromNode(node)) };
|
|
50
74
|
}
|
|
51
75
|
else {
|
|
52
76
|
return { ...node, id: nanoid() };
|
package/esm/helpers/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/helpers/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,sBAAsB,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAEvE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B;;;GAGG;AAEH,MAAM,CAAC,MAAM,QAAQ,GACnB,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CACvC,IAAI,CAAC,EAAE;IACL,MAAM,iBAAiB,GAAG,eAAe,CAAC;QACxC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;YAC1B,IAAI,IAAI,IAAI,IAAI,EAAE;gBAChB,IAAI,SAAS,IAAI,IAAI,EAAE;oBACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;iBAC1C;gBACD,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;gBAC5B,OAAO,EAAE,GAAG,IAAI,EAAE,CAAA;aACnB;YACD,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAC,CAAA;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GACpB,CAAC,GAAG,GAAG,EAAE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AA;YACD,MAAM,cAAc,GAAG,CAAC,IAAa,EAAW,EAAE;gBAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,IAAI,IAAI,EAAE;oBACjD,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAA;iBACxD;gBACD,OAAO,IAAI,CAAA;YACb,CAAC,CAAA;YACD,OAAO,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;QACzC,CAAC;KACF,CAAC,CAAA;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AACD,eAAe,UAAU,CAAA"}
|
|
@@ -26,9 +26,10 @@ const middle = () => tree => {
|
|
|
26
26
|
const isCodeBlock = 'name' in n && n.name === 'code';
|
|
27
27
|
const isDataBlock = 'name' in n && n.name === 'data';
|
|
28
28
|
const isMarkdownBlock = 'name' in n && n.name === 'markdown';
|
|
29
|
+
const isPictureBlock = 'name' in n && n.name === 'picture';
|
|
29
30
|
const allowValues = conf.getAllValues('allow');
|
|
30
31
|
// for code block not parse content by default
|
|
31
|
-
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
32
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
|
|
32
33
|
return n;
|
|
33
34
|
const allowed = allowValues.sort();
|
|
34
35
|
const transformer = makeTransformer({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-formatting-codes.js","sourceRoot":"","sources":["../src/plugin-formatting-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,eAAe,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,SAAS,MAAM,kBAAkB,CAAA;AAUxC,MA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E,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAA;gBAC9D,CAAC;aACF,CAAC,CAAA;YACF,OAAO,WAAW,CAAC,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,CAAA;QACnC,CAAC;KACF,CAAC,CAAA;IACF,OAAO,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AACD,eAAe,MAAM,CAAA"}
|
package/esm/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface RulesStrict {
|
|
|
46
46
|
nested: RuleHandler<BlockNested>;
|
|
47
47
|
output: RuleHandler<BlockOutput>;
|
|
48
48
|
input: RuleHandler<BlockInput>;
|
|
49
|
+
picture: RuleHandler<BlockPicture>;
|
|
49
50
|
image: RuleHandler<BlockImage>;
|
|
50
51
|
':image': RuleHandler<Image>;
|
|
51
52
|
'item:block': RuleHandler<BlockItem>;
|
|
@@ -67,6 +68,7 @@ export interface RulesStrict {
|
|
|
67
68
|
':toc-item': RuleHandler<TocItem>;
|
|
68
69
|
markdown: RuleHandler<BlockMarkdown>;
|
|
69
70
|
Diagram: RuleHandler<BlockDiagram>;
|
|
71
|
+
Mermaid: RuleHandler<BlockMermaid>;
|
|
70
72
|
Image: RuleHandler<BlockNamed>;
|
|
71
73
|
}
|
|
72
74
|
export interface Rules extends RulesStrict {
|
|
@@ -107,6 +109,12 @@ export interface BlockImage extends Omit<Block, 'content'> {
|
|
|
107
109
|
link?: string;
|
|
108
110
|
content: [Image, BlockCaption];
|
|
109
111
|
}
|
|
112
|
+
export interface BlockPicture extends Omit<Block, 'content'> {
|
|
113
|
+
name: 'picture';
|
|
114
|
+
caption?: string;
|
|
115
|
+
link?: string;
|
|
116
|
+
content: [Image, BlockCaption];
|
|
117
|
+
}
|
|
110
118
|
export interface BlockCaption extends Omit<Block, 'content' | 'location' | 'margin' | 'config' | 'id'> {
|
|
111
119
|
name: 'caption';
|
|
112
120
|
content: Array<Node>;
|
|
@@ -325,7 +333,7 @@ export interface TableSeparator {
|
|
|
325
333
|
}
|
|
326
334
|
export declare type BlockAny = BlockNamed;
|
|
327
335
|
export interface BlockNamed extends Omit<Block, 'content'> {
|
|
328
|
-
name:
|
|
336
|
+
name: string;
|
|
329
337
|
content: [(Verbatim | Para | Code)?] | Array<Image | BlockCaption> | RootBlock;
|
|
330
338
|
}
|
|
331
339
|
export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
@@ -335,8 +343,15 @@ export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
|
335
343
|
location: Location;
|
|
336
344
|
};
|
|
337
345
|
}
|
|
346
|
+
export interface BlockMermaid extends Omit<BlockNamed, 'content'> {
|
|
347
|
+
name: 'Mermaid';
|
|
348
|
+
content: [Verbatim];
|
|
349
|
+
custom?: {
|
|
350
|
+
location: Location;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
338
353
|
export declare type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeI | FormattingCodeL | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
339
|
-
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
354
|
+
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockPicture | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
340
355
|
export declare type Node = PodNode;
|
|
341
356
|
export declare type AstTree = Array<PodNode>;
|
|
342
357
|
export declare type PodliteDocument = RootBlock;
|
package/lib/blocks-helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AstTree, BlockCaption, BlockItem, Location, PodNode, RootBlock, Toc, TocItem, TocList, Node, Image } from './types';
|
|
1
|
+
import { AstTree, BlockCaption, BlockItem, Location, PodNode, RootBlock, Toc, TocItem, TocList, Node, Image, FormattingCodeL } from './types';
|
|
2
2
|
export declare const mkNode: <P extends Record<string, any>>(attr: P) => P;
|
|
3
3
|
export declare const filterNulls: (content: any) => any[];
|
|
4
4
|
export declare const mkBlock: (attrs: any, content: any) => any;
|
|
@@ -6,7 +6,7 @@ export declare const mkBlankline: () => {
|
|
|
6
6
|
type: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const mkFomattingCode: (attrs: any, content: any) => any;
|
|
9
|
-
export declare const mkFomattingCodeL: (attrs: any, content: any) =>
|
|
9
|
+
export declare const mkFomattingCodeL: (attrs: any, content: any) => FormattingCodeL;
|
|
10
10
|
export declare const mkFomattingCodeDelete: (content: any) => {
|
|
11
11
|
type: string;
|
|
12
12
|
name: string;
|
package/lib/grammar.js
CHANGED
|
@@ -134,7 +134,7 @@ function peg$parse(input, options) {
|
|
|
134
134
|
type: "boolean"
|
|
135
135
|
};
|
|
136
136
|
}, peg$c88 = function (isFalse, key, value) { return { name: key, ...value }; }, peg$c89 = function (first, rest) { return rest; }, peg$c90 = function (first, cont) { return flattenDeep([...first, ...cont]); }, peg$c91 = /^[^'"]/, peg$c92 = peg$classExpectation(["'", "\""], true, false), peg$c93 = function (text) { return text; }, peg$c94 = /^[0-9]/, peg$c95 = peg$classExpectation([["0", "9"]], false, false), peg$c96 = /^[\-+]/, peg$c97 = peg$classExpectation(["-", "+"], false, false), peg$c98 = "True", peg$c99 = peg$literalExpectation("True", false), peg$c100 = function () { return true; }, peg$c101 = "False", peg$c102 = peg$literalExpectation("False", false), peg$c103 = function () { return false; }, peg$c104 = ".", peg$c105 = peg$literalExpectation(".", false), peg$c106 = /^[eE]/, peg$c107 = peg$classExpectation(["e", "E"], false, false), peg$c108 = /^["]/, peg$c109 = peg$classExpectation(["\""], false, false), peg$c110 = /^[^"]/, peg$c111 = peg$classExpectation(["\""], true, false), peg$c112 = /^[']/, peg$c113 = peg$classExpectation(["'"], false, false), peg$c114 = /^[^']/, peg$c115 = peg$classExpectation(["'"], true, false), peg$c116 = function (numberFloat) { return parseFloat(numberFloat); }, peg$c117 = function (number) { return parseInt(number, 10); }, peg$c118 = function (vmargin, name, config) {
|
|
137
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
137
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
138
138
|
||
|
|
139
139
|
isNamedBlock(name));
|
|
140
140
|
}, peg$c119 = function (vmargin, name, config, margins, ename) { return vmargin.length === margins.length && name === ename; }, peg$c120 = function (vmargin, name, config, margins, line) { return exludeVMargin(vmargin, `${margins}${line}`); }, peg$c121 = function (vmargin, name, config, content, vmargin2, ename) { return name === ename; }, peg$c122 = function (vmargin, name, config, content, vmargin2, ename) {
|
|
@@ -261,7 +261,7 @@ function peg$parse(input, options) {
|
|
|
261
261
|
location: location(),
|
|
262
262
|
};
|
|
263
263
|
}, peg$c150 = function () { return { empty: 1 }; }, peg$c151 = /^[s]/, peg$c152 = peg$classExpectation(["s"], false, false), peg$c153 = function (line) { return { text: text(), type: "ambient1" }; }, peg$c154 = function (vmargin, name) {
|
|
264
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
264
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
265
265
|
||
|
|
266
266
|
isNamedBlock(name));
|
|
267
267
|
}, peg$c155 = function (vmargin, name, content) {
|
|
@@ -320,7 +320,7 @@ function peg$parse(input, options) {
|
|
|
320
320
|
margin: vmargin
|
|
321
321
|
};
|
|
322
322
|
}, peg$c168 = function (vmargin, marker, name, config) {
|
|
323
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
323
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
324
324
|
||
|
|
325
325
|
isNamedBlock(name));
|
|
326
326
|
}, peg$c169 = function (vmargin, marker, name, config, content) {
|
|
@@ -6364,6 +6364,7 @@ function peg$parse(input, options) {
|
|
|
6364
6364
|
'nested',
|
|
6365
6365
|
'output',
|
|
6366
6366
|
'para',
|
|
6367
|
+
'picture',
|
|
6367
6368
|
'pod',
|
|
6368
6369
|
'table',
|
|
6369
6370
|
'toc',
|
package/lib/helpers/ids.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const cleanIds: (src?: {
|
|
|
7
7
|
skipChain: number;
|
|
8
8
|
podMode: number;
|
|
9
9
|
}) => (tree: any) => any;
|
|
10
|
+
export declare const slugifyText: (text: string) => string;
|
|
10
11
|
/**
|
|
11
12
|
* Add set id to 'id' to each blocks
|
|
12
13
|
*/
|
|
@@ -14,5 +15,9 @@ export declare const frozenIds: (src?: {
|
|
|
14
15
|
skipChain: number;
|
|
15
16
|
podMode: number;
|
|
16
17
|
}) => (tree: any) => any;
|
|
18
|
+
export declare const cleanLocalHrefs: (src?: {
|
|
19
|
+
skipChain: number;
|
|
20
|
+
podMode: number;
|
|
21
|
+
}) => (tree: any) => any;
|
|
17
22
|
declare const middleware: ParserPlugin;
|
|
18
23
|
export default middleware;
|
package/lib/helpers/ids.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.frozenIds = exports.cleanIds = void 0;
|
|
3
|
+
exports.cleanLocalHrefs = exports.frozenIds = exports.slugifyText = exports.cleanIds = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
5
|
const nanoid_1 = require("nanoid");
|
|
6
6
|
/**
|
|
@@ -23,25 +23,51 @@ const cleanIds = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
|
23
23
|
return transformerBlocks(tree, {});
|
|
24
24
|
};
|
|
25
25
|
exports.cleanIds = cleanIds;
|
|
26
|
+
// TODO: refactor linking for blocks
|
|
27
|
+
const slugifyText = (text) => {
|
|
28
|
+
// https://github.com/microsoft/vscode/blob/master/extensions/markdown-language-features/src/slugify.ts
|
|
29
|
+
return text.trim()
|
|
30
|
+
// .toLowerCase()
|
|
31
|
+
.replace(/\s+/g, '-')
|
|
32
|
+
.replace(/[\]\[\!\/\'\"\#\$\%\&\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, '')
|
|
33
|
+
.replace(/^\-+/, '');
|
|
34
|
+
};
|
|
35
|
+
exports.slugifyText = slugifyText;
|
|
26
36
|
/**
|
|
27
37
|
* Add set id to 'id' to each blocks
|
|
28
38
|
*/
|
|
29
39
|
const frozenIds = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
30
40
|
const transformerBlocks = (0, __1.makeTransformer)({
|
|
31
41
|
'*': (node, ctx, visiter) => {
|
|
42
|
+
if ('content' in node) {
|
|
43
|
+
node.content = visiter(node.content, ctx);
|
|
44
|
+
}
|
|
32
45
|
if ('id' in node) {
|
|
46
|
+
const { id, ...rest } = node;
|
|
47
|
+
return { ...rest, id: 'id' };
|
|
48
|
+
}
|
|
49
|
+
return node;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return transformerBlocks(tree, {});
|
|
53
|
+
};
|
|
54
|
+
exports.frozenIds = frozenIds;
|
|
55
|
+
const cleanLocalHrefs = (src = { skipChain: 0, podMode: 1 }) => tree => {
|
|
56
|
+
const transformerBlocks = (0, __1.makeTransformer)({
|
|
57
|
+
'L<>': (node, ctx, visiter) => {
|
|
58
|
+
if ('meta' in node) {
|
|
33
59
|
if ('content' in node) {
|
|
34
60
|
node.content = visiter(node.content, ctx);
|
|
35
61
|
}
|
|
36
62
|
const { id, ...rest } = node;
|
|
37
|
-
return { ...rest,
|
|
63
|
+
return { ...rest, meta: '#' };
|
|
38
64
|
}
|
|
39
65
|
return node;
|
|
40
66
|
},
|
|
41
67
|
});
|
|
42
68
|
return transformerBlocks(tree, {});
|
|
43
69
|
};
|
|
44
|
-
exports.
|
|
70
|
+
exports.cleanLocalHrefs = cleanLocalHrefs;
|
|
45
71
|
const middleware = () => tree => {
|
|
46
72
|
const transformerBlocks = (0, __1.makeTransformer)({
|
|
47
73
|
'*': (node, ctx, visiter) => {
|
|
@@ -51,7 +77,7 @@ const middleware = () => tree => {
|
|
|
51
77
|
return node;
|
|
52
78
|
}
|
|
53
79
|
else if (node.name == 'head') {
|
|
54
|
-
return { ...node, id: (0, __1.getTextContentFromNode)(node)
|
|
80
|
+
return { ...node, id: (0, exports.slugifyText)((0, __1.getTextContentFromNode)(node)) };
|
|
55
81
|
}
|
|
56
82
|
else {
|
|
57
83
|
return { ...node, id: (0, nanoid_1.nanoid)() };
|
|
@@ -50,9 +50,10 @@ const middle = () => tree => {
|
|
|
50
50
|
const isCodeBlock = 'name' in n && n.name === 'code';
|
|
51
51
|
const isDataBlock = 'name' in n && n.name === 'data';
|
|
52
52
|
const isMarkdownBlock = 'name' in n && n.name === 'markdown';
|
|
53
|
+
const isPictureBlock = 'name' in n && n.name === 'picture';
|
|
53
54
|
const allowValues = conf.getAllValues('allow');
|
|
54
55
|
// for code block not parse content by default
|
|
55
|
-
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
56
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
|
|
56
57
|
return n;
|
|
57
58
|
const allowed = allowValues.sort();
|
|
58
59
|
const transformer = (0, makeTransformer_1.default)({
|
package/lib/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface RulesStrict {
|
|
|
46
46
|
nested: RuleHandler<BlockNested>;
|
|
47
47
|
output: RuleHandler<BlockOutput>;
|
|
48
48
|
input: RuleHandler<BlockInput>;
|
|
49
|
+
picture: RuleHandler<BlockPicture>;
|
|
49
50
|
image: RuleHandler<BlockImage>;
|
|
50
51
|
':image': RuleHandler<Image>;
|
|
51
52
|
'item:block': RuleHandler<BlockItem>;
|
|
@@ -67,6 +68,7 @@ export interface RulesStrict {
|
|
|
67
68
|
':toc-item': RuleHandler<TocItem>;
|
|
68
69
|
markdown: RuleHandler<BlockMarkdown>;
|
|
69
70
|
Diagram: RuleHandler<BlockDiagram>;
|
|
71
|
+
Mermaid: RuleHandler<BlockMermaid>;
|
|
70
72
|
Image: RuleHandler<BlockNamed>;
|
|
71
73
|
}
|
|
72
74
|
export interface Rules extends RulesStrict {
|
|
@@ -107,6 +109,12 @@ export interface BlockImage extends Omit<Block, 'content'> {
|
|
|
107
109
|
link?: string;
|
|
108
110
|
content: [Image, BlockCaption];
|
|
109
111
|
}
|
|
112
|
+
export interface BlockPicture extends Omit<Block, 'content'> {
|
|
113
|
+
name: 'picture';
|
|
114
|
+
caption?: string;
|
|
115
|
+
link?: string;
|
|
116
|
+
content: [Image, BlockCaption];
|
|
117
|
+
}
|
|
110
118
|
export interface BlockCaption extends Omit<Block, 'content' | 'location' | 'margin' | 'config' | 'id'> {
|
|
111
119
|
name: 'caption';
|
|
112
120
|
content: Array<Node>;
|
|
@@ -325,7 +333,7 @@ export interface TableSeparator {
|
|
|
325
333
|
}
|
|
326
334
|
export declare type BlockAny = BlockNamed;
|
|
327
335
|
export interface BlockNamed extends Omit<Block, 'content'> {
|
|
328
|
-
name:
|
|
336
|
+
name: string;
|
|
329
337
|
content: [(Verbatim | Para | Code)?] | Array<Image | BlockCaption> | RootBlock;
|
|
330
338
|
}
|
|
331
339
|
export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
@@ -335,8 +343,15 @@ export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
|
335
343
|
location: Location;
|
|
336
344
|
};
|
|
337
345
|
}
|
|
346
|
+
export interface BlockMermaid extends Omit<BlockNamed, 'content'> {
|
|
347
|
+
name: 'Mermaid';
|
|
348
|
+
content: [Verbatim];
|
|
349
|
+
custom?: {
|
|
350
|
+
location: Location;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
338
353
|
export declare type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeI | FormattingCodeL | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
339
|
-
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
354
|
+
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockPicture | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
340
355
|
export declare type Node = PodNode;
|
|
341
356
|
export declare type AstTree = Array<PodNode>;
|
|
342
357
|
export declare type PodliteDocument = RootBlock;
|
package/package.json
CHANGED
package/schema/AstTree.json
CHANGED
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
{
|
|
112
112
|
"$ref": "#/definitions/BlockImage"
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/definitions/BlockPicture"
|
|
116
|
+
},
|
|
114
117
|
{
|
|
115
118
|
"$ref": "#/definitions/BlockCaption"
|
|
116
119
|
},
|
|
@@ -449,6 +452,71 @@
|
|
|
449
452
|
"value"
|
|
450
453
|
]
|
|
451
454
|
},
|
|
455
|
+
"BlockPicture": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"name": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"enum": [
|
|
461
|
+
"picture"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
"caption": {
|
|
465
|
+
"type": "string"
|
|
466
|
+
},
|
|
467
|
+
"link": {
|
|
468
|
+
"type": "string"
|
|
469
|
+
},
|
|
470
|
+
"content": {
|
|
471
|
+
"type": "array",
|
|
472
|
+
"items": [
|
|
473
|
+
{
|
|
474
|
+
"$ref": "#/definitions/Image"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"$ref": "#/definitions/BlockCaption"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"minItems": 2,
|
|
481
|
+
"maxItems": 2
|
|
482
|
+
},
|
|
483
|
+
"type": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"enum": [
|
|
486
|
+
"block"
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
"location": {
|
|
490
|
+
"$ref": "#/definitions/Location"
|
|
491
|
+
},
|
|
492
|
+
"margin": {
|
|
493
|
+
"type": "string"
|
|
494
|
+
},
|
|
495
|
+
"config": {
|
|
496
|
+
"type": "array",
|
|
497
|
+
"items": {
|
|
498
|
+
"anyOf": [
|
|
499
|
+
{
|
|
500
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"$ref": "#/definitions/ConfigItem"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"id": {
|
|
509
|
+
"type": "string"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"required": [
|
|
513
|
+
"content",
|
|
514
|
+
"location",
|
|
515
|
+
"margin",
|
|
516
|
+
"name",
|
|
517
|
+
"type"
|
|
518
|
+
]
|
|
519
|
+
},
|
|
452
520
|
"RootBlock": {
|
|
453
521
|
"type": "object",
|
|
454
522
|
"properties": {
|
|
@@ -1168,6 +1236,9 @@
|
|
|
1168
1236
|
{
|
|
1169
1237
|
"$ref": "#/definitions/BlockImage"
|
|
1170
1238
|
},
|
|
1239
|
+
{
|
|
1240
|
+
"$ref": "#/definitions/BlockPicture"
|
|
1241
|
+
},
|
|
1171
1242
|
{
|
|
1172
1243
|
"$ref": "#/definitions/BlockCaption"
|
|
1173
1244
|
},
|
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
{
|
|
112
112
|
"$ref": "#/definitions/BlockImage"
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/definitions/BlockPicture"
|
|
116
|
+
},
|
|
114
117
|
{
|
|
115
118
|
"$ref": "#/definitions/BlockCaption"
|
|
116
119
|
},
|
|
@@ -449,6 +452,71 @@
|
|
|
449
452
|
"value"
|
|
450
453
|
]
|
|
451
454
|
},
|
|
455
|
+
"BlockPicture": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"name": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"enum": [
|
|
461
|
+
"picture"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
"caption": {
|
|
465
|
+
"type": "string"
|
|
466
|
+
},
|
|
467
|
+
"link": {
|
|
468
|
+
"type": "string"
|
|
469
|
+
},
|
|
470
|
+
"content": {
|
|
471
|
+
"type": "array",
|
|
472
|
+
"items": [
|
|
473
|
+
{
|
|
474
|
+
"$ref": "#/definitions/Image"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"$ref": "#/definitions/BlockCaption"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"minItems": 2,
|
|
481
|
+
"maxItems": 2
|
|
482
|
+
},
|
|
483
|
+
"type": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"enum": [
|
|
486
|
+
"block"
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
"location": {
|
|
490
|
+
"$ref": "#/definitions/Location"
|
|
491
|
+
},
|
|
492
|
+
"margin": {
|
|
493
|
+
"type": "string"
|
|
494
|
+
},
|
|
495
|
+
"config": {
|
|
496
|
+
"type": "array",
|
|
497
|
+
"items": {
|
|
498
|
+
"anyOf": [
|
|
499
|
+
{
|
|
500
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"$ref": "#/definitions/ConfigItem"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"id": {
|
|
509
|
+
"type": "string"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"required": [
|
|
513
|
+
"content",
|
|
514
|
+
"location",
|
|
515
|
+
"margin",
|
|
516
|
+
"name",
|
|
517
|
+
"type"
|
|
518
|
+
]
|
|
519
|
+
},
|
|
452
520
|
"RootBlock": {
|
|
453
521
|
"type": "object",
|
|
454
522
|
"properties": {
|
|
@@ -1168,6 +1236,9 @@
|
|
|
1168
1236
|
{
|
|
1169
1237
|
"$ref": "#/definitions/BlockImage"
|
|
1170
1238
|
},
|
|
1239
|
+
{
|
|
1240
|
+
"$ref": "#/definitions/BlockPicture"
|
|
1241
|
+
},
|
|
1171
1242
|
{
|
|
1172
1243
|
"$ref": "#/definitions/BlockCaption"
|
|
1173
1244
|
},
|