@markdoc/markdoc 0.1.0
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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7961 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +7959 -0
- package/dist/index.mjs.map +7 -0
- package/dist/react.js +40 -0
- package/dist/react.js.map +7 -0
- package/dist/src/ast/base.d.ts +6 -0
- package/dist/src/ast/base.d.ts.map +1 -0
- package/dist/src/ast/function.d.ts +9 -0
- package/dist/src/ast/function.d.ts.map +1 -0
- package/dist/src/ast/index.d.ts +26 -0
- package/dist/src/ast/index.d.ts.map +1 -0
- package/dist/src/ast/node.d.ts +21 -0
- package/dist/src/ast/node.d.ts.map +1 -0
- package/dist/src/ast/tag.d.ts +9 -0
- package/dist/src/ast/tag.d.ts.map +1 -0
- package/dist/src/ast/variable.d.ts +8 -0
- package/dist/src/ast/variable.d.ts.map +1 -0
- package/dist/src/functions/index.d.ts +11 -0
- package/dist/src/functions/index.d.ts.map +1 -0
- package/dist/src/parser.d.ts +4 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/renderers/html.d.ts +3 -0
- package/dist/src/renderers/html.d.ts.map +1 -0
- package/dist/src/renderers/index.d.ts +10 -0
- package/dist/src/renderers/index.d.ts.map +1 -0
- package/dist/src/renderers/react/react.d.ts +11 -0
- package/dist/src/renderers/react/react.d.ts.map +1 -0
- package/dist/src/renderers/react/shared.d.ts +5 -0
- package/dist/src/renderers/react/shared.d.ts.map +1 -0
- package/dist/src/renderers/react/static.d.ts +3 -0
- package/dist/src/renderers/react/static.d.ts.map +1 -0
- package/dist/src/schema-types/class.d.ts +6 -0
- package/dist/src/schema-types/class.d.ts.map +1 -0
- package/dist/src/schema.d.ts +27 -0
- package/dist/src/schema.d.ts.map +1 -0
- package/dist/src/tags/conditional.d.ts +5 -0
- package/dist/src/tags/conditional.d.ts.map +1 -0
- package/dist/src/tags/index.d.ts +44 -0
- package/dist/src/tags/index.d.ts.map +1 -0
- package/dist/src/tags/partial.d.ts +3 -0
- package/dist/src/tags/partial.d.ts.map +1 -0
- package/dist/src/tags/table.d.ts +3 -0
- package/dist/src/tags/table.d.ts.map +1 -0
- package/dist/src/tokenizer/index.d.ts +10 -0
- package/dist/src/tokenizer/index.d.ts.map +1 -0
- package/dist/src/tokenizer/plugins/annotations.d.ts +3 -0
- package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -0
- package/dist/src/tokenizer/plugins/frontmatter.d.ts +3 -0
- package/dist/src/tokenizer/plugins/frontmatter.d.ts.map +1 -0
- package/dist/src/transformer.d.ts +12 -0
- package/dist/src/transformer.d.ts.map +1 -0
- package/dist/src/transforms/index.d.ts +4 -0
- package/dist/src/transforms/index.d.ts.map +1 -0
- package/dist/src/transforms/table.d.ts +3 -0
- package/dist/src/transforms/table.d.ts.map +1 -0
- package/dist/src/types.d.ts +88 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/validator.d.ts +6 -0
- package/dist/src/validator.d.ts.map +1 -0
- package/global.d.ts +11 -0
- package/index.ts +138 -0
- package/package.json +63 -0
- package/spec/support/matchers.d.ts +6 -0
- package/src/ast/base.ts +41 -0
- package/src/ast/function.ts +22 -0
- package/src/ast/index.ts +28 -0
- package/src/ast/node.test.ts +307 -0
- package/src/ast/node.ts +71 -0
- package/src/ast/tag.ts +19 -0
- package/src/ast/variable.test.ts +35 -0
- package/src/ast/variable.ts +17 -0
- package/src/functions/index.test.ts +34 -0
- package/src/functions/index.ts +45 -0
- package/src/grammar/tag.d.ts +23 -0
- package/src/grammar/tag.js +1836 -0
- package/src/grammar/tag.pegjs +170 -0
- package/src/grammar/tag.test.ts +364 -0
- package/src/parser.test.ts +597 -0
- package/src/parser.ts +158 -0
- package/src/renderers/html.test.ts +62 -0
- package/src/renderers/html.ts +46 -0
- package/src/renderers/index.ts +5 -0
- package/src/renderers/react/react.test.ts +204 -0
- package/src/renderers/react/react.ts +51 -0
- package/src/renderers/react/shared.ts +16 -0
- package/src/renderers/react/static.ts +52 -0
- package/src/schema-types/class.ts +23 -0
- package/src/schema.ts +233 -0
- package/src/tags/conditional.ts +45 -0
- package/src/tags/index.ts +10 -0
- package/src/tags/partial.ts +33 -0
- package/src/tags/table.ts +5 -0
- package/src/tokenizer/index.ts +21 -0
- package/src/tokenizer/plugins/annotations.test.ts +337 -0
- package/src/tokenizer/plugins/annotations.ts +133 -0
- package/src/tokenizer/plugins/frontmatter.test.ts +86 -0
- package/src/tokenizer/plugins/frontmatter.ts +39 -0
- package/src/transformer.ts +72 -0
- package/src/transforms/index.ts +2 -0
- package/src/transforms/table.ts +51 -0
- package/src/types.ts +142 -0
- package/src/utils.test.ts +173 -0
- package/src/utils.ts +116 -0
- package/src/validator.test.ts +298 -0
- package/src/validator.ts +233 -0
package/dist/react.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/renderers/react/shared.ts
|
|
2
|
+
function tagName(name, components) {
|
|
3
|
+
return typeof name !== "string" ? "Fragment" : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/renderers/react/react.ts
|
|
7
|
+
function dynamic(node, React, { components = {} } = {}) {
|
|
8
|
+
function deepRender(value) {
|
|
9
|
+
if (value == null || typeof value !== "object")
|
|
10
|
+
return value;
|
|
11
|
+
if (Array.isArray(value))
|
|
12
|
+
return value.map((item) => deepRender(item));
|
|
13
|
+
if (value.$$mdtype === "Tag")
|
|
14
|
+
return render(value);
|
|
15
|
+
if (typeof value !== "object")
|
|
16
|
+
return value;
|
|
17
|
+
const output = {};
|
|
18
|
+
for (const [k, v] of Object.entries(value))
|
|
19
|
+
output[k] = deepRender(v);
|
|
20
|
+
return output;
|
|
21
|
+
}
|
|
22
|
+
function render(node2) {
|
|
23
|
+
if (Array.isArray(node2))
|
|
24
|
+
return React.createElement(React.Fragment, null, ...node2.map(render));
|
|
25
|
+
if (node2 === null || typeof node2 !== "object")
|
|
26
|
+
return node2;
|
|
27
|
+
const {
|
|
28
|
+
name,
|
|
29
|
+
attributes: { class: className, ...attrs } = {},
|
|
30
|
+
children = []
|
|
31
|
+
} = node2;
|
|
32
|
+
if (className)
|
|
33
|
+
attrs.className = className;
|
|
34
|
+
return React.createElement(tagName(name, components), Object.keys(attrs).length == 0 ? null : deepRender(attrs), ...children.map(render));
|
|
35
|
+
}
|
|
36
|
+
return render(node);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
dynamic as default
|
|
40
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/renderers/react/shared.ts", "../src/renderers/react/react.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ComponentType } from 'react';\n\ntype Component = ComponentType<unknown>;\n\nexport function tagName(\n name: string,\n components: Record<string, Component> | ((string: string) => Component)\n): string | Component {\n return typeof name !== 'string'\n ? 'Fragment'\n : name[0] !== name[0].toUpperCase()\n ? name\n : components instanceof Function\n ? components(name)\n : components[name];\n}\n", "import { tagName } from './shared';\nimport type { createElement, Fragment, ReactNode } from 'react';\nimport type { RenderableTreeNodes, Scalar } from '../../types';\n\ntype ReactShape = Readonly<{\n createElement: typeof createElement;\n Fragment: typeof Fragment;\n}>;\n\nexport default function dynamic(\n node: RenderableTreeNodes,\n React: ReactShape,\n { components = {} } = {}\n) {\n function deepRender(value: any): any {\n if (value == null || typeof value !== 'object') return value;\n\n if (Array.isArray(value)) return value.map((item) => deepRender(item));\n\n if (value.$$mdtype === 'Tag') return render(value);\n\n if (typeof value !== 'object') return value;\n\n const output: Record<string, Scalar> = {};\n for (const [k, v] of Object.entries(value)) output[k] = deepRender(v);\n return output;\n }\n\n function render(node: RenderableTreeNodes): ReactNode {\n if (Array.isArray(node))\n return React.createElement(React.Fragment, null, ...node.map(render));\n\n if (node === null || typeof node !== 'object') return node;\n\n const {\n name,\n attributes: { class: className, ...attrs } = {},\n children = [],\n } = node;\n\n if (className) attrs.className = className;\n\n return React.createElement(\n tagName(name, components),\n Object.keys(attrs).length == 0 ? null : deepRender(attrs),\n ...children.map(render)\n );\n }\n\n return render(node);\n}\n"],
|
|
5
|
+
"mappings": ";AAIO,iBACL,MACA,YACoB;AACpB,SAAO,OAAO,SAAS,WACnB,aACA,KAAK,OAAO,KAAK,GAAG,gBACpB,OACA,sBAAsB,WACtB,WAAW,QACX,WAAW;AAAA;;;ACLF,iBACb,MACA,OACA,EAAE,aAAa,OAAO,IACtB;AACA,sBAAoB,OAAiB;AACnC,QAAI,SAAS,QAAQ,OAAO,UAAU;AAAU,aAAO;AAEvD,QAAI,MAAM,QAAQ;AAAQ,aAAO,MAAM,IAAI,CAAC,SAAS,WAAW;AAEhE,QAAI,MAAM,aAAa;AAAO,aAAO,OAAO;AAE5C,QAAI,OAAO,UAAU;AAAU,aAAO;AAEtC,UAAM,SAAiC;AACvC,eAAW,CAAC,GAAG,MAAM,OAAO,QAAQ;AAAQ,aAAO,KAAK,WAAW;AACnE,WAAO;AAAA;AAGT,kBAAgB,OAAsC;AACpD,QAAI,MAAM,QAAQ;AAChB,aAAO,MAAM,cAAc,MAAM,UAAU,MAAM,GAAG,MAAK,IAAI;AAE/D,QAAI,UAAS,QAAQ,OAAO,UAAS;AAAU,aAAO;AAEtD,UAAM;AAAA,MACJ;AAAA,MACA,YAAY,EAAE,OAAO,cAAc,UAAU;AAAA,MAC7C,WAAW;AAAA,QACT;AAEJ,QAAI;AAAW,YAAM,YAAY;AAEjC,WAAO,MAAM,cACX,QAAQ,MAAM,aACd,OAAO,KAAK,OAAO,UAAU,IAAI,OAAO,WAAW,QACnD,GAAG,SAAS,IAAI;AAAA;AAIpB,SAAO,OAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AstType, Config, Function as AstFunction } from '../types';
|
|
2
|
+
export declare function isAst(value?: any): value is AstType;
|
|
3
|
+
export declare function isFunction(value?: any): value is AstFunction;
|
|
4
|
+
export declare function getAstValues(value: any): Generator<AstType, void, unknown>;
|
|
5
|
+
export declare function resolve(value: any, config?: Config): any;
|
|
6
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/ast/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,QAAQ,IAAI,WAAW,EAExB,MAAM,UAAU,CAAC;AAElB,wBAAgB,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAEnD;AAED,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE5D;AAED,wBAAiB,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAU3E;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,GAAE,MAAW,GAAG,GAAG,CAa5D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Config, AstType } from '../types';
|
|
2
|
+
export default class Function implements AstType {
|
|
3
|
+
readonly $$mdtype = "Function";
|
|
4
|
+
name: string;
|
|
5
|
+
parameters: Record<string, any>;
|
|
6
|
+
constructor(name: string, parameters: Record<string, any>);
|
|
7
|
+
resolve(config?: Config): any;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/ast/function.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,QAAS,YAAW,OAAO;IAC9C,QAAQ,CAAC,QAAQ,cAAc;IAE/B,IAAI,SAAC;IACL,UAAU,sBAAC;gBAEC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKzD,OAAO,CAAC,MAAM,GAAE,MAAW;CAO5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Node from './node';
|
|
2
|
+
import Function from './function';
|
|
3
|
+
import Variable from './variable';
|
|
4
|
+
import type { AstType } from '../types';
|
|
5
|
+
declare function fromJSON(text: string): Node | Node[];
|
|
6
|
+
declare const _default: {
|
|
7
|
+
fromJSON: typeof fromJSON;
|
|
8
|
+
isAst(value?: any): value is AstType;
|
|
9
|
+
isFunction(value?: any): value is Function;
|
|
10
|
+
getAstValues(value: any): Generator<AstType, void, unknown>;
|
|
11
|
+
resolve(value: any, config?: Readonly<Partial<{
|
|
12
|
+
nodes: Partial<Record<import("../types").NodeType, import("../types").Schema<Readonly<Partial<any>>, string>>>;
|
|
13
|
+
tags: Record<string, import("../types").Schema<Readonly<Partial<any>>, string>>;
|
|
14
|
+
variables: Record<string, any>;
|
|
15
|
+
functions: Record<string, import("../types").ConfigFunction>;
|
|
16
|
+
partials: Record<string, any>;
|
|
17
|
+
validation?: {
|
|
18
|
+
validateFunctions?: boolean | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}>>): any;
|
|
21
|
+
Function: typeof Function;
|
|
22
|
+
Node: typeof Node;
|
|
23
|
+
Variable: typeof Variable;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ast/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAcxC,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE,CAE7C;;;;;;;;;;;;;;;;;;;;AAED,wBAIE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AstType, Location, Config, RenderableTreeNode, RenderableTreeNodes, Schema, ValidationError } from '../types';
|
|
2
|
+
export default class Node implements AstType {
|
|
3
|
+
readonly $$mdtype = "Node";
|
|
4
|
+
attributes: Record<string, any>;
|
|
5
|
+
children: Node[];
|
|
6
|
+
errors: ValidationError[];
|
|
7
|
+
lines: number[];
|
|
8
|
+
type: string;
|
|
9
|
+
tag?: string;
|
|
10
|
+
inline: boolean;
|
|
11
|
+
location?: Location;
|
|
12
|
+
constructor(type?: string, attributes?: Record<string, any>, children?: Node[], tag?: string);
|
|
13
|
+
walk(): Generator<Node, void, unknown>;
|
|
14
|
+
push(node: Node): void;
|
|
15
|
+
resolve(config?: Config): Node;
|
|
16
|
+
findSchema(config?: Config): Schema | undefined;
|
|
17
|
+
transformAttributes(config?: Config): Record<string, any>;
|
|
18
|
+
transformChildren(config: Config): RenderableTreeNode[];
|
|
19
|
+
transform(config: Config): RenderableTreeNodes;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ast/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACN,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,OAAO,OAAO,IAAK,YAAW,OAAO;IAC1C,QAAQ,CAAC,QAAQ,UAAU;IAE3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjB,MAAM,EAAE,eAAe,EAAE,CAAM;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,MAAM,UAAS;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;gBAGlB,IAAI,SAAS,EACb,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,QAAQ,GAAE,IAAI,EAAO,EACrB,GAAG,CAAC,EAAE,MAAM;IAQb,IAAI,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC;IAOvC,IAAI,CAAC,IAAI,EAAE,IAAI;IAIf,OAAO,CAAC,MAAM,GAAE,MAAW,GAAG,IAAI;IAOlC,UAAU,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,GAAG,SAAS;IAInD,mBAAmB,CAAC,MAAM,GAAE,MAAW;IAIvC,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAIvD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;CAG/C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RenderableTreeNode } from '../types';
|
|
2
|
+
export default class Tag {
|
|
3
|
+
readonly $$mdtype: "Tag";
|
|
4
|
+
name: string;
|
|
5
|
+
attributes: Record<string, any>;
|
|
6
|
+
children: RenderableTreeNode[];
|
|
7
|
+
constructor(name?: string, attributes?: {}, children?: RenderableTreeNode[]);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/ast/tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,QAAQ,CAAC,QAAQ,QAAkB;IAEnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;gBAG7B,IAAI,SAAQ,EACZ,UAAU,KAAK,EACf,QAAQ,GAAE,kBAAkB,EAAO;CAMtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Config, AstType } from '../types';
|
|
2
|
+
export default class Variable implements AstType {
|
|
3
|
+
readonly $$mdtype = "Variable";
|
|
4
|
+
path: (string | number)[];
|
|
5
|
+
constructor(path?: (string | number)[]);
|
|
6
|
+
resolve({ variables }?: Config): any;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../../src/ast/variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,QAAS,YAAW,OAAO;IAC9C,QAAQ,CAAC,QAAQ,cAAc;IAE/B,IAAI,sBAAC;gBAEO,IAAI,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI1C,OAAO,CAAC,EAAE,SAAS,EAAE,GAAE,MAAW;CAKnC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfigFunction } from '../types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
and: ConfigFunction;
|
|
4
|
+
or: ConfigFunction;
|
|
5
|
+
not: ConfigFunction;
|
|
6
|
+
equals: ConfigFunction;
|
|
7
|
+
default: ConfigFunction;
|
|
8
|
+
debug: ConfigFunction;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;;;;;;;;;AA4C/C,wBAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,YAAY,CAAC;AAK9B,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAuI/C,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,QAiB5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/renderers/html.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsBpD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAsBhE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import html from './html';
|
|
2
|
+
import react from './react/react';
|
|
3
|
+
import reactStatic from './react/static';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
html: typeof html;
|
|
6
|
+
react: typeof react;
|
|
7
|
+
reactStatic: typeof reactStatic;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderers/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,eAAe,CAAC;AAClC,OAAO,WAAW,MAAM,gBAAgB,CAAC;;;;;;AAEzC,wBAA4C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { createElement, Fragment, ReactNode } from 'react';
|
|
2
|
+
import type { RenderableTreeNodes } from '../../types';
|
|
3
|
+
declare type ReactShape = Readonly<{
|
|
4
|
+
createElement: typeof createElement;
|
|
5
|
+
Fragment: typeof Fragment;
|
|
6
|
+
}>;
|
|
7
|
+
export default function dynamic(node: RenderableTreeNodes, React: ReactShape, { components }?: {
|
|
8
|
+
components?: {} | undefined;
|
|
9
|
+
}): ReactNode;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/renderers/react/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAU,MAAM,aAAa,CAAC;AAE/D,aAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,QAAQ,EAAE,OAAO,QAAQ,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,UAAU,EACjB,EAAE,UAAe,EAAE;;CAAK,aAsCzB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
declare type Component = ComponentType<unknown>;
|
|
3
|
+
export declare function tagName(name: string, components: Record<string, Component> | ((string: string) => Component)): string | Component;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/renderers/react/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,aAAK,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAExC,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,CAAC,GACtE,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../../../src/renderers/react/static.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA2C3E,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAOrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../../src/schema-types/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEzE,qBAAa,KAAM,YAAW,4BAA4B;IACxD,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,eAAe,EAAE;IAYvC,SAAS,CAAC,KAAK,EAAE,GAAG;CAOrB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Schema } from './types';
|
|
2
|
+
export declare const document: Schema;
|
|
3
|
+
export declare const heading: Schema;
|
|
4
|
+
export declare const paragraph: Schema;
|
|
5
|
+
export declare const image: Schema;
|
|
6
|
+
export declare const fence: Schema;
|
|
7
|
+
export declare const blockquote: Schema;
|
|
8
|
+
export declare const item: Schema;
|
|
9
|
+
export declare const list: Schema;
|
|
10
|
+
export declare const hr: Schema;
|
|
11
|
+
export declare const table: Schema;
|
|
12
|
+
export declare const td: Schema;
|
|
13
|
+
export declare const th: Schema;
|
|
14
|
+
export declare const tr: Schema;
|
|
15
|
+
export declare const tbody: Schema;
|
|
16
|
+
export declare const thead: Schema;
|
|
17
|
+
export declare const strong: Schema;
|
|
18
|
+
export declare const em: Schema;
|
|
19
|
+
export declare const s: Schema;
|
|
20
|
+
export declare const inline: Schema;
|
|
21
|
+
export declare const link: Schema;
|
|
22
|
+
export declare const code: Schema;
|
|
23
|
+
export declare const text: Schema;
|
|
24
|
+
export declare const hardbreak: Schema;
|
|
25
|
+
export declare const softbreak: Schema;
|
|
26
|
+
export declare const error: {};
|
|
27
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGtC,eAAO,MAAM,QAAQ,EAAE,MAgBtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAYrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAGvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAOnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAenB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAaxB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MAclB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MAYlB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,MAEhB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAEnB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,MAmBhB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,MAMhB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,MAGhB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAGnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAGnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAGpB,CAAC;AAEF,eAAO,MAAM,EAAE,EAAE,MAGhB,CAAC;AAEF,eAAO,MAAM,CAAC,EAAE,MAGf,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAapB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MAOlB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MASlB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MAOlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAEvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAIvB,CAAC;AAEF,eAAO,MAAM,KAAK,IAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../../src/tags/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,MAAM,EAAS,MAAM,UAAU,CAAC;AAIpD,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,WAEhC;AAmBD,eAAO,MAAM,KAAK,EAAE,MAYnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAKrB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
if: import("../types").Schema<Readonly<Partial<{
|
|
3
|
+
nodes: Partial<Record<import("../types").NodeType, import("../types").Schema<Readonly<Partial<any>>, string>>>;
|
|
4
|
+
tags: Record<string, import("../types").Schema<Readonly<Partial<any>>, string>>;
|
|
5
|
+
variables: Record<string, any>;
|
|
6
|
+
functions: Record<string, import("../types").ConfigFunction>;
|
|
7
|
+
partials: Record<string, any>;
|
|
8
|
+
validation?: {
|
|
9
|
+
validateFunctions?: boolean | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
}>>, string>;
|
|
12
|
+
else: import("../types").Schema<Readonly<Partial<{
|
|
13
|
+
nodes: Partial<Record<import("../types").NodeType, import("../types").Schema<Readonly<Partial<any>>, string>>>;
|
|
14
|
+
tags: Record<string, import("../types").Schema<Readonly<Partial<any>>, string>>;
|
|
15
|
+
variables: Record<string, any>;
|
|
16
|
+
functions: Record<string, import("../types").ConfigFunction>;
|
|
17
|
+
partials: Record<string, any>;
|
|
18
|
+
validation?: {
|
|
19
|
+
validateFunctions?: boolean | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}>>, string>;
|
|
22
|
+
partial: import("../types").Schema<Readonly<Partial<{
|
|
23
|
+
nodes: Partial<Record<import("../types").NodeType, import("../types").Schema<Readonly<Partial<any>>, string>>>;
|
|
24
|
+
tags: Record<string, import("../types").Schema<Readonly<Partial<any>>, string>>;
|
|
25
|
+
variables: Record<string, any>;
|
|
26
|
+
functions: Record<string, import("../types").ConfigFunction>;
|
|
27
|
+
partials: Record<string, any>;
|
|
28
|
+
validation?: {
|
|
29
|
+
validateFunctions?: boolean | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}>>, string>;
|
|
32
|
+
table: import("../types").Schema<Readonly<Partial<{
|
|
33
|
+
nodes: Partial<Record<import("../types").NodeType, import("../types").Schema<Readonly<Partial<any>>, string>>>;
|
|
34
|
+
tags: Record<string, import("../types").Schema<Readonly<Partial<any>>, string>>;
|
|
35
|
+
variables: Record<string, any>;
|
|
36
|
+
functions: Record<string, import("../types").ConfigFunction>;
|
|
37
|
+
partials: Record<string, any>;
|
|
38
|
+
validation?: {
|
|
39
|
+
validateFunctions?: boolean | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
}>>, string>;
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tags/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../../../src/tags/partial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,OAAO,EAAE,MA8BrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/tags/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,KAAK,EAAE,MAEnB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it/lib';
|
|
2
|
+
import type Token from 'markdown-it/lib/token';
|
|
3
|
+
export default class Tokenizer {
|
|
4
|
+
private parser;
|
|
5
|
+
constructor(config?: MarkdownIt.Options & {
|
|
6
|
+
allowIndentation?: boolean;
|
|
7
|
+
});
|
|
8
|
+
tokenize(content: string): Token[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokenizer/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAGzC,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,OAAO,CAAC,MAAM,CAAa;gBAGzB,MAAM,GAAE,UAAU,CAAC,OAAO,GAAG;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAO;IAQlE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE;CAGnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../../src/tokenizer/plugins/annotations.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAwH9C,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,EAAE,UAAU,QAM5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../../src/tokenizer/plugins/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAoC9C,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,EAAE,UAAU,QAE5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Config, Node, Schema, RenderableTreeNode, RenderableTreeNodes } from './types';
|
|
2
|
+
declare type AttributesSchema = Schema['attributes'];
|
|
3
|
+
export declare const globalAttributes: AttributesSchema;
|
|
4
|
+
export interface Transformer {
|
|
5
|
+
findSchema(node: Node, config: Config): Schema | undefined;
|
|
6
|
+
node(node: Node, config: Config): RenderableTreeNodes;
|
|
7
|
+
attributes(node: Node, config: Config): Record<string, any>;
|
|
8
|
+
children(node: Node, config: Config): RenderableTreeNode[];
|
|
9
|
+
}
|
|
10
|
+
declare const _default: Transformer;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/transformer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,IAAI,EAEJ,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,aAAK,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,gBAG9B,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3D,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAAC;IACtD,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5D,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;CAC5D;;AAED,wBA8CiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;;AAC5B,wBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/transforms/table.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAWrC,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,QAAQ,EAAE,IAAI,QAqC/C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type Node from './ast/node';
|
|
2
|
+
import type Function from './ast/function';
|
|
3
|
+
import type Tag from './ast/tag';
|
|
4
|
+
export type { default as Function } from './ast/function';
|
|
5
|
+
export type { default as Node } from './ast/node';
|
|
6
|
+
export type { default as Tag } from './ast/tag';
|
|
7
|
+
export interface AstType {
|
|
8
|
+
readonly $$mdtype: 'Function' | 'Node' | 'Variable';
|
|
9
|
+
resolve(config: Config): any;
|
|
10
|
+
}
|
|
11
|
+
export declare type AttributeValue = {
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
value: any;
|
|
15
|
+
};
|
|
16
|
+
export declare type Config = Readonly<ConfigType>;
|
|
17
|
+
export declare type ConfigType = Partial<{
|
|
18
|
+
nodes: Partial<Record<NodeType, Schema>>;
|
|
19
|
+
tags: Record<string, Schema>;
|
|
20
|
+
variables: Record<string, any>;
|
|
21
|
+
functions: Record<string, ConfigFunction>;
|
|
22
|
+
partials: Record<string, any>;
|
|
23
|
+
validation?: {
|
|
24
|
+
validateFunctions?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
export declare type ConfigFunction = {
|
|
28
|
+
returns?: ValidationType | ValidationType[];
|
|
29
|
+
parameters?: Record<string, SchemaAttribute>;
|
|
30
|
+
transform?(parameters: Record<string, any>, config: Config): any;
|
|
31
|
+
validate?(fn: Function, config: Config): ValidationError[];
|
|
32
|
+
};
|
|
33
|
+
export interface CustomAttributeTypeInterface {
|
|
34
|
+
transform?(value: any, config: Config): Scalar;
|
|
35
|
+
validate?(value: any, config: Config): ValidationError[];
|
|
36
|
+
}
|
|
37
|
+
export interface CustomAttributeType {
|
|
38
|
+
new (): CustomAttributeTypeInterface;
|
|
39
|
+
readonly prototype: CustomAttributeTypeInterface;
|
|
40
|
+
}
|
|
41
|
+
export declare type Location = {
|
|
42
|
+
file?: string;
|
|
43
|
+
start: LocationEdge;
|
|
44
|
+
end: LocationEdge;
|
|
45
|
+
};
|
|
46
|
+
export declare type LocationEdge = {
|
|
47
|
+
line: number;
|
|
48
|
+
character?: number;
|
|
49
|
+
};
|
|
50
|
+
export declare type NodeType = 'document' | 'heading' | 'paragraph' | 'blockquote' | 'hr' | 'image' | 'fence' | 'tag' | 'list' | 'item' | 'table' | 'thead' | 'tbody' | 'tr' | 'td' | 'th' | 'inline' | 'strong' | 'em' | 's' | 'link' | 'code' | 'text' | 'hardbreak' | 'softbreak';
|
|
51
|
+
export declare type Primitive = null | boolean | number | string;
|
|
52
|
+
export declare type RenderableTreeNode = Tag | string | null;
|
|
53
|
+
export declare type RenderableTreeNodes = RenderableTreeNode | RenderableTreeNode[];
|
|
54
|
+
export declare type Scalar = Primitive | Scalar[] | {
|
|
55
|
+
[key: string]: Scalar;
|
|
56
|
+
};
|
|
57
|
+
export declare type Schema<C extends Config = Config, R = string> = {
|
|
58
|
+
render?: R;
|
|
59
|
+
children?: string[];
|
|
60
|
+
attributes?: Record<string, SchemaAttribute>;
|
|
61
|
+
selfClosing?: boolean;
|
|
62
|
+
transform?(node: Node, config: C): RenderableTreeNodes;
|
|
63
|
+
validate?(node: Node, config: C): ValidationError[];
|
|
64
|
+
};
|
|
65
|
+
export declare type SchemaAttribute = {
|
|
66
|
+
type?: ValidationType | ValidationType[];
|
|
67
|
+
render?: boolean | string;
|
|
68
|
+
default?: any;
|
|
69
|
+
required?: boolean;
|
|
70
|
+
matches?: SchemaMatches | ((config: Config) => SchemaMatches);
|
|
71
|
+
errorLevel?: ValidationError['level'];
|
|
72
|
+
};
|
|
73
|
+
export declare type SchemaMatches = RegExp | string[] | null;
|
|
74
|
+
export declare type ValidationError = {
|
|
75
|
+
id: string;
|
|
76
|
+
level: 'debug' | 'info' | 'warning' | 'error' | 'critical';
|
|
77
|
+
message: string;
|
|
78
|
+
location?: Location;
|
|
79
|
+
};
|
|
80
|
+
export declare type ValidateError = {
|
|
81
|
+
type: string;
|
|
82
|
+
lines: number[];
|
|
83
|
+
location?: Location;
|
|
84
|
+
error: ValidationError;
|
|
85
|
+
};
|
|
86
|
+
export declare type ValidationType = CustomAttributeType | typeof String | typeof Number | typeof Boolean | typeof Object | typeof Array | 'String' | 'Number' | 'Boolean' | 'Object' | 'Array';
|
|
87
|
+
export declare type Value = AstType | Scalar;
|
|
88
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1D,YAAY,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAA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,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ,oBAAY,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type Token from 'markdown-it/lib/token';
|
|
2
|
+
export declare const OPEN = "{%";
|
|
3
|
+
export declare const CLOSE = "%}";
|
|
4
|
+
export declare function findTagEnd(content: string, start?: number): number | undefined;
|
|
5
|
+
export declare function parseTags(content: string, firstLine?: number): Token[];
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAQ/C,eAAO,MAAM,IAAI,OAAO,CAAC;AACzB,eAAO,MAAM,KAAK,OAAO,CAAC;AAE1B,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAI,sBAwBpD;AAoBD,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,KAAK,EAAE,CAwDjE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Node, Config, SchemaAttribute, ValidationError, Value } from './types';
|
|
2
|
+
declare type TypeParam = NonNullable<SchemaAttribute['type']>;
|
|
3
|
+
export declare function validateType(type: TypeParam, value: Value, config: Config): boolean | ValidationError[];
|
|
4
|
+
export default function validate(node: Node, config: Config): ValidationError[];
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,IAAI,EAEJ,MAAM,EACN,eAAe,EACf,eAAe,EACf,KAAK,EACN,MAAM,SAAS,CAAC;AAUjB,aAAK,SAAS,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;AAEtD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,GAAG,eAAe,EAAE,CA2B7B;AAqED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBA8G1D"}
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ValidationError } from './src/types';
|
|
2
|
+
|
|
3
|
+
declare module 'markdown-it/lib/token' {
|
|
4
|
+
export default class Token extends require('markdown-it/lib/token') {
|
|
5
|
+
errors?: ValidationError[];
|
|
6
|
+
position?: {
|
|
7
|
+
start?: number;
|
|
8
|
+
end?: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|