markdecl 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.
Files changed (63) hide show
  1. package/LICENSE +45 -0
  2. package/README.md +11 -0
  3. package/dist/index.d.ts +95 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3368 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/ast/base.d.ts +7 -0
  8. package/dist/src/ast/base.d.ts.map +1 -0
  9. package/dist/src/ast/function.d.ts +9 -0
  10. package/dist/src/ast/function.d.ts.map +1 -0
  11. package/dist/src/ast/index.d.ts +18 -0
  12. package/dist/src/ast/index.d.ts.map +1 -0
  13. package/dist/src/ast/node.d.ts +23 -0
  14. package/dist/src/ast/node.d.ts.map +1 -0
  15. package/dist/src/ast/variable.d.ts +8 -0
  16. package/dist/src/ast/variable.d.ts.map +1 -0
  17. package/dist/src/formatter.d.ts +11 -0
  18. package/dist/src/formatter.d.ts.map +1 -0
  19. package/dist/src/functions/index.d.ts +11 -0
  20. package/dist/src/functions/index.d.ts.map +1 -0
  21. package/dist/src/parser.d.ts +4 -0
  22. package/dist/src/parser.d.ts.map +1 -0
  23. package/dist/src/renderers/html.d.ts +3 -0
  24. package/dist/src/renderers/html.d.ts.map +1 -0
  25. package/dist/src/renderers/index.d.ts +6 -0
  26. package/dist/src/renderers/index.d.ts.map +1 -0
  27. package/dist/src/schema-types/conditional.d.ts +13 -0
  28. package/dist/src/schema-types/conditional.d.ts.map +1 -0
  29. package/dist/src/schema.d.ts +36 -0
  30. package/dist/src/schema.d.ts.map +1 -0
  31. package/dist/src/tag.d.ts +10 -0
  32. package/dist/src/tag.d.ts.map +1 -0
  33. package/dist/src/tags/conditional.d.ts +5 -0
  34. package/dist/src/tags/conditional.d.ts.map +1 -0
  35. package/dist/src/tags/index.d.ts +9 -0
  36. package/dist/src/tags/index.d.ts.map +1 -0
  37. package/dist/src/tags/partial.d.ts +3 -0
  38. package/dist/src/tags/partial.d.ts.map +1 -0
  39. package/dist/src/tags/slot.d.ts +3 -0
  40. package/dist/src/tags/slot.d.ts.map +1 -0
  41. package/dist/src/tags/table.d.ts +3 -0
  42. package/dist/src/tags/table.d.ts.map +1 -0
  43. package/dist/src/tokenizer/index.d.ts +11 -0
  44. package/dist/src/tokenizer/index.d.ts.map +1 -0
  45. package/dist/src/tokenizer/plugins/annotations.d.ts +3 -0
  46. package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -0
  47. package/dist/src/tokenizer/plugins/comments.d.ts +3 -0
  48. package/dist/src/tokenizer/plugins/comments.d.ts.map +1 -0
  49. package/dist/src/tokenizer/plugins/frontmatter.d.ts +3 -0
  50. package/dist/src/tokenizer/plugins/frontmatter.d.ts.map +1 -0
  51. package/dist/src/transformer.d.ts +4 -0
  52. package/dist/src/transformer.d.ts.map +1 -0
  53. package/dist/src/transforms/index.d.ts +4 -0
  54. package/dist/src/transforms/index.d.ts.map +1 -0
  55. package/dist/src/transforms/table.d.ts +3 -0
  56. package/dist/src/transforms/table.d.ts.map +1 -0
  57. package/dist/src/types.d.ts +134 -0
  58. package/dist/src/types.d.ts.map +1 -0
  59. package/dist/src/utils.d.ts +9 -0
  60. package/dist/src/utils.d.ts.map +1 -0
  61. package/dist/src/validator.d.ts +28 -0
  62. package/dist/src/validator.d.ts.map +1 -0
  63. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,45 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yuhei Yamauchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ -----------------------------------------------------------------------------
24
+
25
+ The MIT License
26
+
27
+ Copyright (c) 2021- Stripe, Inc. (https://stripe.com)
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining a copy
30
+ of this software and associated documentation files (the "Software"), to deal
31
+ in the Software without restriction, including without limitation the rights
32
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33
+ copies of the Software, and to permit persons to whom the Software is
34
+ furnished to do so, subject to the following conditions:
35
+
36
+ The above copyright notice and this permission notice shall be included in
37
+ all copies or substantial portions of the Software.
38
+
39
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
45
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Markdecl
2
+
3
+ [markdoc](https://github.com/markdoc/markdoc)のフォーク.
4
+
5
+ オリジナルは若干制限が緩いという側面があったので制限をより厳しくする目的で作成された.
6
+
7
+ - [x] Reactサポートの廃止
8
+ - [ ] 生成物がarticleで囲まれるのを設定で変えられるようにする
9
+ - [x] classやidなどの自動挿入を消す、ショートハンド構文も消す
10
+ - [ ] functionのサポートを消す
11
+ - [ ] frontmatterのサポートをyamlだけにする
@@ -0,0 +1,95 @@
1
+ import { default as Ast } from './src/ast';
2
+ import { default as Node } from './src/ast/node';
3
+ import { default as format } from './src/formatter';
4
+ import { default as functions } from './src/functions';
5
+ import { default as renderers } from './src/renderers';
6
+ import { default as Tag } from './src/tag';
7
+ import { default as tags } from './src/tags';
8
+ import { truthy } from './src/tags/conditional';
9
+ import { default as Tokenizer } from './src/tokenizer';
10
+ import { default as transformer } from './src/transformer';
11
+ import { default as transforms } from './src/transforms';
12
+ import { parseTags } from './src/utils';
13
+ import { default as validator } from './src/validator';
14
+ import { ParserArgs, Config, RenderableTreeNode, ValidateError } from './src/types';
15
+ import { default as Token } from 'markdown-it/lib/token.mjs';
16
+ import * as nodes from './src/schema';
17
+ export * from './src/types';
18
+ export declare function parse(content: string | Token[], args?: string | ParserArgs): Node;
19
+ export declare function resolve<C extends Config = Config>(content: Node, config: C): Node;
20
+ export declare function resolve<C extends Config = Config>(content: Node[], config: C): Node[];
21
+ export declare function transform<C extends Config = Config>(node: Node, config?: C): RenderableTreeNode;
22
+ export declare function transform<C extends Config = Config>(nodes: Node[], config?: C): RenderableTreeNode[];
23
+ export declare function validate<C extends Config = Config>(node: Node, options?: C): ValidateError[];
24
+ export declare function createElement(name: string | {
25
+ key?: string | number;
26
+ }, attributes?: {}, ...children: any[]): {
27
+ name: string | {
28
+ key?: string | number;
29
+ };
30
+ attributes: {};
31
+ children: any[];
32
+ };
33
+ export { nodes, tags, functions, transforms, renderers, Ast, Node, Tag, Tokenizer, parseTags, transformer, validator, truthy, format, };
34
+ export default class Markdoc {
35
+ static nodes: typeof nodes;
36
+ static tags: {
37
+ else: import('./src/types').Schema;
38
+ if: import('./src/types').Schema;
39
+ partial: import('./src/types').Schema;
40
+ slot: import('./src/types').Schema;
41
+ table: import('./src/types').Schema;
42
+ };
43
+ static functions: {
44
+ and: import('./src/types').ConfigFunction;
45
+ or: import('./src/types').ConfigFunction;
46
+ not: import('./src/types').ConfigFunction;
47
+ equals: import('./src/types').ConfigFunction;
48
+ default: import('./src/types').ConfigFunction;
49
+ debug: import('./src/types').ConfigFunction;
50
+ };
51
+ static renderers: {
52
+ html: typeof import('./src/renderers/html').default;
53
+ };
54
+ static transforms: typeof import('./src/transforms/table').default[];
55
+ static Ast: {
56
+ fromJSON: (text: string) => Node | Node[];
57
+ isAst(value?: any): value is import('./src/types').AstType;
58
+ isFunction(value?: any): value is import('./src/types').Function;
59
+ isVariable(value?: any): value is import('./src/types').Variable;
60
+ getAstValues(value: any): Generator<import('./src/types').AstType, void, unknown>;
61
+ resolve(value: any, config?: Config): any;
62
+ Function: typeof import('./src/ast/function').default;
63
+ Node: typeof Node;
64
+ Variable: typeof import('./src/ast/variable').default;
65
+ };
66
+ static Tag: typeof Tag;
67
+ static Tokenizer: typeof Tokenizer;
68
+ static parseTags: typeof parseTags;
69
+ static transformer: import('./src/types').Transformer;
70
+ static validator: typeof validator;
71
+ static parse: typeof parse;
72
+ static transform: typeof transform;
73
+ static validate: typeof validate;
74
+ static createElement: typeof createElement;
75
+ static truthy: typeof truthy;
76
+ static format: typeof format;
77
+ config: Readonly<Partial<{
78
+ nodes: Partial<Record<import('./src/types').NodeType, import('./src/types').Schema<Partial</*elided*/ any>, string>>>;
79
+ tags: Record<string, import('./src/types').Schema>;
80
+ variables: Record<string, any>;
81
+ functions: Record<string, import('./src/types').ConfigFunction>;
82
+ partials: Record<string, any>;
83
+ validation?: {
84
+ parents?: Node[];
85
+ validateFunctions?: boolean;
86
+ environment?: string;
87
+ };
88
+ }>>;
89
+ constructor(config: Config);
90
+ parse: typeof parse;
91
+ resolve: (content: Parameters<typeof resolve>[0]) => Node[];
92
+ transform: (content: Parameters<typeof transform>[0]) => RenderableTreeNode[];
93
+ validate: (content: Parameters<typeof validate>[0]) => ValidateError[];
94
+ }
95
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,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,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,SAA2B,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7E,cAAc,aAAa,CAAC;AAsB5B,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGjF;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;AACnF,wBAAgB,OAAO,CAAC,CAA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