@markdoc/markdoc 0.1.2 → 0.1.5
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/README.md +5 -2
- package/dist/index.d.ts +48 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7040 -6593
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +6904 -6457
- package/dist/index.mjs.map +3 -3
- package/dist/src/ast/base.d.ts +2 -1
- package/dist/src/ast/base.d.ts.map +1 -1
- package/dist/src/ast/index.d.ts +1 -0
- package/dist/src/ast/index.d.ts.map +1 -1
- package/dist/src/ast/node.d.ts +5 -4
- package/dist/src/ast/node.d.ts.map +1 -1
- package/dist/src/formatter.d.ts +9 -0
- package/dist/src/formatter.d.ts.map +1 -0
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/schema.d.ts +1 -0
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/{ast/tag.d.ts → tag.d.ts} +1 -1
- package/dist/src/tag.d.ts.map +1 -0
- package/dist/src/tags/conditional.d.ts.map +1 -1
- package/dist/src/tags/partial.d.ts.map +1 -1
- package/dist/src/tokenizer/index.d.ts.map +1 -1
- package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -1
- package/dist/src/transformer.d.ts +1 -7
- package/dist/src/transformer.d.ts.map +1 -1
- package/dist/src/transforms/table.d.ts.map +1 -1
- package/dist/src/types.d.ts +12 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +2 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/validator.d.ts.map +1 -1
- package/global.d.ts +7 -0
- package/index.ts +47 -29
- package/package.json +7 -4
- package/src/ast/base.ts +5 -0
- package/src/ast/node.test.ts +73 -21
- package/src/ast/node.ts +9 -4
- package/src/formatter.test.ts +403 -0
- package/src/formatter.ts +377 -0
- package/src/parser.test.ts +42 -0
- package/src/parser.ts +33 -3
- package/src/schema.ts +3 -1
- package/src/{ast/tag.ts → tag.ts} +1 -1
- package/src/tags/conditional.ts +10 -3
- package/src/tags/partial.ts +20 -3
- package/src/tokenizer/index.ts +5 -1
- package/src/tokenizer/plugins/annotations.test.ts +60 -0
- package/src/tokenizer/plugins/annotations.ts +4 -0
- package/src/transformer.ts +15 -17
- package/src/transforms/table.ts +3 -3
- package/src/types.ts +31 -19
- package/src/utils.test.ts +15 -2
- package/src/utils.ts +14 -1
- package/src/validator.test.ts +70 -10
- package/src/validator.ts +31 -12
- package/dist/src/ast/tag.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ const content = Markdoc.transform(ast);
|
|
|
50
50
|
return Markdoc.renderers.react(content, React);
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Check out [our docs](https://markdoc.
|
|
53
|
+
Check out [our docs](https://markdoc.dev/docs) for more guidance on how to use Markdoc.
|
|
54
54
|
|
|
55
55
|
## Contributing
|
|
56
56
|
|
|
@@ -72,4 +72,7 @@ This project uses the [MIT license](LICENSE).
|
|
|
72
72
|
|
|
73
73
|
## Credits
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Special shout out to:
|
|
76
|
+
|
|
77
|
+
- [@marcioAlmada](https://github.com/marcioAlmada) for providing us with the [@markdoc](https://github.com/markdoc) GitHub org.
|
|
78
|
+
- [@koomen](https://github.com/koomen) for gifting us https://markdoc.dev.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Ast from './src/ast/index';
|
|
1
|
+
import Ast from './src/ast';
|
|
2
|
+
import __EXPERIMENTAL__format from './src/formatter';
|
|
3
|
+
import functions from './src/functions';
|
|
5
4
|
import * as nodes from './src/schema';
|
|
6
|
-
import
|
|
5
|
+
import renderers from './src/renderers';
|
|
6
|
+
import Tag from './src/tag';
|
|
7
|
+
import tags from './src/tags';
|
|
7
8
|
import { truthy } from './src/tags/conditional';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import validator from './src/validator';
|
|
9
|
+
import Tokenizer from './src/tokenizer';
|
|
10
|
+
import transformer, { globalAttributes } from './src/transformer';
|
|
11
|
+
import transforms from './src/transforms';
|
|
12
12
|
import { parseTags } from './src/utils';
|
|
13
|
-
import
|
|
13
|
+
import validator from './src/validator';
|
|
14
|
+
import type { Node } from './src/types';
|
|
14
15
|
import type Token from 'markdown-it/lib/token';
|
|
15
16
|
import type { Config, RenderableTreeNode, ValidateError } from './src/types';
|
|
16
17
|
export * from './src/types';
|
|
@@ -29,9 +30,10 @@ export declare function createElement(name: string | {
|
|
|
29
30
|
attributes: {};
|
|
30
31
|
children: any[];
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
export { nodes, tags, functions, globalAttributes, transforms, renderers, Ast, Tag, Tokenizer, parseTags, transformer, validator, truthy, __EXPERIMENTAL__format, };
|
|
34
|
+
export default class Markdoc {
|
|
35
|
+
static nodes: typeof nodes;
|
|
36
|
+
static tags: {
|
|
35
37
|
if: import("./src/types").Schema<Readonly<Partial<{
|
|
36
38
|
nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
|
|
37
39
|
tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
|
|
@@ -73,7 +75,7 @@ declare const _default: {
|
|
|
73
75
|
} | undefined;
|
|
74
76
|
}>>, string>;
|
|
75
77
|
};
|
|
76
|
-
functions: {
|
|
78
|
+
static functions: {
|
|
77
79
|
and: import("./src/types").ConfigFunction;
|
|
78
80
|
or: import("./src/types").ConfigFunction;
|
|
79
81
|
not: import("./src/types").ConfigFunction;
|
|
@@ -81,16 +83,18 @@ declare const _default: {
|
|
|
81
83
|
default: import("./src/types").ConfigFunction;
|
|
82
84
|
debug: import("./src/types").ConfigFunction;
|
|
83
85
|
};
|
|
84
|
-
|
|
86
|
+
static globalAttributes: Record<string, import("./src/types").SchemaAttribute> | undefined;
|
|
87
|
+
static renderers: {
|
|
85
88
|
html: typeof import("./src/renderers/html").default;
|
|
86
89
|
react: typeof import("./src/renderers/react/react").default;
|
|
87
90
|
reactStatic: typeof import("./src/renderers/react/static").default;
|
|
88
91
|
};
|
|
89
|
-
transforms: typeof import("./src/transforms/table").default[];
|
|
90
|
-
Ast: {
|
|
92
|
+
static transforms: typeof import("./src/transforms/table").default[];
|
|
93
|
+
static Ast: {
|
|
91
94
|
fromJSON: (text: string) => Node | Node[];
|
|
92
95
|
isAst(value?: any): value is import("./src/types").AstType;
|
|
93
96
|
isFunction(value?: any): value is import("./src/ast/function").default;
|
|
97
|
+
isVariable(value?: any): value is import("./src/types").Variable;
|
|
94
98
|
getAstValues(value: any): Generator<import("./src/types").AstType, void, unknown>;
|
|
95
99
|
resolve(value: any, config?: Readonly<Partial<{
|
|
96
100
|
nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
|
|
@@ -104,19 +108,33 @@ declare const _default: {
|
|
|
104
108
|
}>>): any;
|
|
105
109
|
Function: typeof import("./src/ast/function").default;
|
|
106
110
|
Node: typeof Node;
|
|
107
|
-
Variable: typeof import("./src/
|
|
111
|
+
Variable: typeof import("./src/types").Variable;
|
|
108
112
|
};
|
|
109
|
-
Tag: typeof Tag;
|
|
110
|
-
Tokenizer: typeof Tokenizer;
|
|
111
|
-
parseTags: typeof parseTags;
|
|
112
|
-
transformer: import("./src/
|
|
113
|
-
validator: typeof validator;
|
|
113
|
+
static Tag: typeof Tag;
|
|
114
|
+
static Tokenizer: typeof Tokenizer;
|
|
115
|
+
static parseTags: typeof parseTags;
|
|
116
|
+
static transformer: import("./src/types").Transformer;
|
|
117
|
+
static validator: typeof validator;
|
|
118
|
+
static parse: typeof parse;
|
|
119
|
+
static transform: typeof transform;
|
|
120
|
+
static validate: typeof validate;
|
|
121
|
+
static createElement: typeof createElement;
|
|
122
|
+
static truthy: typeof truthy;
|
|
123
|
+
static __EXPERIMENTAL__format: typeof __EXPERIMENTAL__format;
|
|
124
|
+
config: Readonly<Partial<{
|
|
125
|
+
nodes: Partial<Record<import("./src/types").NodeType, import("./src/types").Schema<Readonly<Partial<any>>, string>>>;
|
|
126
|
+
tags: Record<string, import("./src/types").Schema<Readonly<Partial<any>>, string>>;
|
|
127
|
+
variables: Record<string, any>;
|
|
128
|
+
functions: Record<string, import("./src/types").ConfigFunction>;
|
|
129
|
+
partials: Record<string, any>;
|
|
130
|
+
validation?: {
|
|
131
|
+
validateFunctions?: boolean | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
}>>;
|
|
134
|
+
constructor(config: Config);
|
|
114
135
|
parse: typeof parse;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
export default _default;
|
|
121
|
-
export { nodes, tags, functions, transforms, renderers, Ast, Tag, Tokenizer, parseTags, transformer, validator, truthy, };
|
|
136
|
+
resolve: (content: Parameters<typeof resolve>[0]) => Node[];
|
|
137
|
+
transform: (content: Parameters<typeof transform>[0]) => RenderableTreeNode[];
|
|
138
|
+
validate: (content: Parameters<typeof validate>[0]) => ValidateError[];
|
|
139
|
+
}
|
|
122
140
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,sBAAsB,MAAM,iBAAiB,CAAC;AACrD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,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