@podlite/schema 0.0.13 → 0.0.14
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 +7 -0
- package/lib/grammar.js +29 -21
- package/lib/grammarfc.js +1098 -243
- package/lib/plugin-formatting-codes.js +2 -1
- package/lib/types.d.ts +9 -1
- package/package.json +3 -2
- package/schema/AstTree.json +116 -0
- package/schema/PodliteDocument.json +116 -0
|
@@ -49,9 +49,10 @@ const middle = () => tree => {
|
|
|
49
49
|
const conf = (0, config_1.default)(n, ctx);
|
|
50
50
|
const isCodeBlock = 'name' in n && n.name === 'code';
|
|
51
51
|
const isDataBlock = 'name' in n && n.name === 'data';
|
|
52
|
+
const isMarkdownBlock = 'name' in n && n.name === 'markdown';
|
|
52
53
|
const allowValues = conf.getAllValues('allow');
|
|
53
54
|
// for code block not parse content by default
|
|
54
|
-
if ((isCodeBlock || isDataBlock) && allowValues.length == 0)
|
|
55
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
55
56
|
return n;
|
|
56
57
|
const allowed = allowValues.sort();
|
|
57
58
|
const transformer = (0, makeTransformer_1.default)({
|
package/lib/types.d.ts
CHANGED
|
@@ -61,9 +61,11 @@ export interface RulesStrict {
|
|
|
61
61
|
table_row: RuleHandler<TableRow>;
|
|
62
62
|
table_cell: RuleHandler<TableCell>;
|
|
63
63
|
table_head: RuleHandler<TableHead>;
|
|
64
|
+
toc: RuleHandler<BlockToc>;
|
|
64
65
|
':toc': RuleHandler<Toc>;
|
|
65
66
|
':toc-list': RuleHandler<TocList>;
|
|
66
67
|
':toc-item': RuleHandler<TocItem>;
|
|
68
|
+
markdown: RuleHandler<BlockMarkdown>;
|
|
67
69
|
Diagram: RuleHandler<BlockDiagram>;
|
|
68
70
|
Image: RuleHandler<BlockNamed>;
|
|
69
71
|
}
|
|
@@ -284,6 +286,12 @@ export interface BlockPara extends Block {
|
|
|
284
286
|
export interface BlockCode extends Block {
|
|
285
287
|
name: 'code';
|
|
286
288
|
}
|
|
289
|
+
export interface BlockToc extends Block {
|
|
290
|
+
name: 'toc';
|
|
291
|
+
}
|
|
292
|
+
export interface BlockMarkdown extends Block {
|
|
293
|
+
name: 'markdown';
|
|
294
|
+
}
|
|
287
295
|
export interface BlockNested extends Block {
|
|
288
296
|
name: 'nested';
|
|
289
297
|
}
|
|
@@ -328,7 +336,7 @@ export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
|
328
336
|
};
|
|
329
337
|
}
|
|
330
338
|
export declare type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeI | FormattingCodeL | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
331
|
-
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
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;
|
|
332
340
|
export declare type Node = PodNode;
|
|
333
341
|
export declare type AstTree = Array<PodNode>;
|
|
334
342
|
export declare type PodliteDocument = RootBlock;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/schema",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.14",
|
|
4
|
+
"description": "AST tools for Podlite markup language",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"build:esm": "yarn g:tsctest -p tsconfig.esm.json",
|
|
30
30
|
"build:pegjs": "pegjs -o src/grammar.js src/grammar.pegjs && pegjs -o src/grammarfc.js src/grammarfc.pegjs",
|
|
31
31
|
"watch": "npx nodemon -e js,ts --exec 'yarn' build",
|
|
32
|
+
"watch:pegjs": "npx nodemon -e pegjs --exec 'yarn' build:pegjs",
|
|
32
33
|
"test": "yarn g:jest --passWithNoTests"
|
|
33
34
|
},
|
|
34
35
|
"keywords": [
|
package/schema/AstTree.json
CHANGED
|
@@ -213,6 +213,12 @@
|
|
|
213
213
|
{
|
|
214
214
|
"$ref": "#/definitions/BlockCode"
|
|
215
215
|
},
|
|
216
|
+
{
|
|
217
|
+
"$ref": "#/definitions/BlockToc"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
221
|
+
},
|
|
216
222
|
{
|
|
217
223
|
"$ref": "#/definitions/BlockNested"
|
|
218
224
|
},
|
|
@@ -1264,6 +1270,12 @@
|
|
|
1264
1270
|
{
|
|
1265
1271
|
"$ref": "#/definitions/BlockCode"
|
|
1266
1272
|
},
|
|
1273
|
+
{
|
|
1274
|
+
"$ref": "#/definitions/BlockToc"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
1278
|
+
},
|
|
1267
1279
|
{
|
|
1268
1280
|
"$ref": "#/definitions/BlockNested"
|
|
1269
1281
|
},
|
|
@@ -1941,6 +1953,110 @@
|
|
|
1941
1953
|
"type"
|
|
1942
1954
|
]
|
|
1943
1955
|
},
|
|
1956
|
+
"BlockToc": {
|
|
1957
|
+
"type": "object",
|
|
1958
|
+
"properties": {
|
|
1959
|
+
"name": {
|
|
1960
|
+
"type": "string",
|
|
1961
|
+
"enum": [
|
|
1962
|
+
"toc"
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1965
|
+
"type": {
|
|
1966
|
+
"type": "string",
|
|
1967
|
+
"enum": [
|
|
1968
|
+
"block"
|
|
1969
|
+
]
|
|
1970
|
+
},
|
|
1971
|
+
"location": {
|
|
1972
|
+
"$ref": "#/definitions/Location"
|
|
1973
|
+
},
|
|
1974
|
+
"content": {
|
|
1975
|
+
"type": "array",
|
|
1976
|
+
"items": {
|
|
1977
|
+
"$ref": "#/definitions/PodNode"
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
"margin": {
|
|
1981
|
+
"type": "string"
|
|
1982
|
+
},
|
|
1983
|
+
"config": {
|
|
1984
|
+
"type": "array",
|
|
1985
|
+
"items": {
|
|
1986
|
+
"anyOf": [
|
|
1987
|
+
{
|
|
1988
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"$ref": "#/definitions/ConfigItem"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
"id": {
|
|
1997
|
+
"type": "string"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
"required": [
|
|
2001
|
+
"content",
|
|
2002
|
+
"location",
|
|
2003
|
+
"margin",
|
|
2004
|
+
"name",
|
|
2005
|
+
"type"
|
|
2006
|
+
]
|
|
2007
|
+
},
|
|
2008
|
+
"BlockMarkdown": {
|
|
2009
|
+
"type": "object",
|
|
2010
|
+
"properties": {
|
|
2011
|
+
"name": {
|
|
2012
|
+
"type": "string",
|
|
2013
|
+
"enum": [
|
|
2014
|
+
"markdown"
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"type": {
|
|
2018
|
+
"type": "string",
|
|
2019
|
+
"enum": [
|
|
2020
|
+
"block"
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
2023
|
+
"location": {
|
|
2024
|
+
"$ref": "#/definitions/Location"
|
|
2025
|
+
},
|
|
2026
|
+
"content": {
|
|
2027
|
+
"type": "array",
|
|
2028
|
+
"items": {
|
|
2029
|
+
"$ref": "#/definitions/PodNode"
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
"margin": {
|
|
2033
|
+
"type": "string"
|
|
2034
|
+
},
|
|
2035
|
+
"config": {
|
|
2036
|
+
"type": "array",
|
|
2037
|
+
"items": {
|
|
2038
|
+
"anyOf": [
|
|
2039
|
+
{
|
|
2040
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"$ref": "#/definitions/ConfigItem"
|
|
2044
|
+
}
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
},
|
|
2048
|
+
"id": {
|
|
2049
|
+
"type": "string"
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
"required": [
|
|
2053
|
+
"content",
|
|
2054
|
+
"location",
|
|
2055
|
+
"margin",
|
|
2056
|
+
"name",
|
|
2057
|
+
"type"
|
|
2058
|
+
]
|
|
2059
|
+
},
|
|
1944
2060
|
"BlockNested": {
|
|
1945
2061
|
"type": "object",
|
|
1946
2062
|
"properties": {
|
|
@@ -213,6 +213,12 @@
|
|
|
213
213
|
{
|
|
214
214
|
"$ref": "#/definitions/BlockCode"
|
|
215
215
|
},
|
|
216
|
+
{
|
|
217
|
+
"$ref": "#/definitions/BlockToc"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
221
|
+
},
|
|
216
222
|
{
|
|
217
223
|
"$ref": "#/definitions/BlockNested"
|
|
218
224
|
},
|
|
@@ -1264,6 +1270,12 @@
|
|
|
1264
1270
|
{
|
|
1265
1271
|
"$ref": "#/definitions/BlockCode"
|
|
1266
1272
|
},
|
|
1273
|
+
{
|
|
1274
|
+
"$ref": "#/definitions/BlockToc"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
1278
|
+
},
|
|
1267
1279
|
{
|
|
1268
1280
|
"$ref": "#/definitions/BlockNested"
|
|
1269
1281
|
},
|
|
@@ -1941,6 +1953,110 @@
|
|
|
1941
1953
|
"type"
|
|
1942
1954
|
]
|
|
1943
1955
|
},
|
|
1956
|
+
"BlockToc": {
|
|
1957
|
+
"type": "object",
|
|
1958
|
+
"properties": {
|
|
1959
|
+
"name": {
|
|
1960
|
+
"type": "string",
|
|
1961
|
+
"enum": [
|
|
1962
|
+
"toc"
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1965
|
+
"type": {
|
|
1966
|
+
"type": "string",
|
|
1967
|
+
"enum": [
|
|
1968
|
+
"block"
|
|
1969
|
+
]
|
|
1970
|
+
},
|
|
1971
|
+
"location": {
|
|
1972
|
+
"$ref": "#/definitions/Location"
|
|
1973
|
+
},
|
|
1974
|
+
"content": {
|
|
1975
|
+
"type": "array",
|
|
1976
|
+
"items": {
|
|
1977
|
+
"$ref": "#/definitions/PodNode"
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
"margin": {
|
|
1981
|
+
"type": "string"
|
|
1982
|
+
},
|
|
1983
|
+
"config": {
|
|
1984
|
+
"type": "array",
|
|
1985
|
+
"items": {
|
|
1986
|
+
"anyOf": [
|
|
1987
|
+
{
|
|
1988
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"$ref": "#/definitions/ConfigItem"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
"id": {
|
|
1997
|
+
"type": "string"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
"required": [
|
|
2001
|
+
"content",
|
|
2002
|
+
"location",
|
|
2003
|
+
"margin",
|
|
2004
|
+
"name",
|
|
2005
|
+
"type"
|
|
2006
|
+
]
|
|
2007
|
+
},
|
|
2008
|
+
"BlockMarkdown": {
|
|
2009
|
+
"type": "object",
|
|
2010
|
+
"properties": {
|
|
2011
|
+
"name": {
|
|
2012
|
+
"type": "string",
|
|
2013
|
+
"enum": [
|
|
2014
|
+
"markdown"
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"type": {
|
|
2018
|
+
"type": "string",
|
|
2019
|
+
"enum": [
|
|
2020
|
+
"block"
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
2023
|
+
"location": {
|
|
2024
|
+
"$ref": "#/definitions/Location"
|
|
2025
|
+
},
|
|
2026
|
+
"content": {
|
|
2027
|
+
"type": "array",
|
|
2028
|
+
"items": {
|
|
2029
|
+
"$ref": "#/definitions/PodNode"
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
"margin": {
|
|
2033
|
+
"type": "string"
|
|
2034
|
+
},
|
|
2035
|
+
"config": {
|
|
2036
|
+
"type": "array",
|
|
2037
|
+
"items": {
|
|
2038
|
+
"anyOf": [
|
|
2039
|
+
{
|
|
2040
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"$ref": "#/definitions/ConfigItem"
|
|
2044
|
+
}
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
},
|
|
2048
|
+
"id": {
|
|
2049
|
+
"type": "string"
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
"required": [
|
|
2053
|
+
"content",
|
|
2054
|
+
"location",
|
|
2055
|
+
"margin",
|
|
2056
|
+
"name",
|
|
2057
|
+
"type"
|
|
2058
|
+
]
|
|
2059
|
+
},
|
|
1944
2060
|
"BlockNested": {
|
|
1945
2061
|
"type": "object",
|
|
1946
2062
|
"properties": {
|