@knpkv/confluence-to-markdown 0.2.0 → 0.4.1

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 (336) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +282 -14
  4. package/dist/ConfluenceAuth.d.ts +76 -0
  5. package/dist/ConfluenceAuth.d.ts.map +1 -0
  6. package/dist/ConfluenceAuth.js +356 -0
  7. package/dist/ConfluenceAuth.js.map +1 -0
  8. package/dist/ConfluenceClient.d.ts +26 -2
  9. package/dist/ConfluenceClient.d.ts.map +1 -1
  10. package/dist/ConfluenceClient.js +98 -92
  11. package/dist/ConfluenceClient.js.map +1 -1
  12. package/dist/ConfluenceConfig.d.ts +4 -24
  13. package/dist/ConfluenceConfig.d.ts.map +1 -1
  14. package/dist/ConfluenceConfig.js +45 -7
  15. package/dist/ConfluenceConfig.js.map +1 -1
  16. package/dist/ConfluenceError.d.ts +89 -6
  17. package/dist/ConfluenceError.d.ts.map +1 -1
  18. package/dist/ConfluenceError.js +88 -5
  19. package/dist/ConfluenceError.js.map +1 -1
  20. package/dist/GitError.d.ts +103 -0
  21. package/dist/GitError.d.ts.map +1 -0
  22. package/dist/GitError.js +85 -0
  23. package/dist/GitError.js.map +1 -0
  24. package/dist/GitService.d.ts +175 -0
  25. package/dist/GitService.d.ts.map +1 -0
  26. package/dist/GitService.js +431 -0
  27. package/dist/GitService.js.map +1 -0
  28. package/dist/LocalFileSystem.d.ts +29 -4
  29. package/dist/LocalFileSystem.d.ts.map +1 -1
  30. package/dist/LocalFileSystem.js +80 -6
  31. package/dist/LocalFileSystem.js.map +1 -1
  32. package/dist/MarkdownConverter.d.ts +49 -2
  33. package/dist/MarkdownConverter.d.ts.map +1 -1
  34. package/dist/MarkdownConverter.js +73 -111
  35. package/dist/MarkdownConverter.js.map +1 -1
  36. package/dist/SchemaConverterError.d.ts +108 -0
  37. package/dist/SchemaConverterError.d.ts.map +1 -0
  38. package/dist/SchemaConverterError.js +84 -0
  39. package/dist/SchemaConverterError.js.map +1 -0
  40. package/dist/Schemas.d.ts +225 -1
  41. package/dist/Schemas.d.ts.map +1 -1
  42. package/dist/Schemas.js +155 -6
  43. package/dist/Schemas.js.map +1 -1
  44. package/dist/SyncEngine.d.ts +30 -20
  45. package/dist/SyncEngine.d.ts.map +1 -1
  46. package/dist/SyncEngine.js +566 -117
  47. package/dist/SyncEngine.js.map +1 -1
  48. package/dist/ast/BlockNode.d.ts +468 -0
  49. package/dist/ast/BlockNode.d.ts.map +1 -0
  50. package/dist/ast/BlockNode.js +319 -0
  51. package/dist/ast/BlockNode.js.map +1 -0
  52. package/dist/ast/Document.d.ts +244 -0
  53. package/dist/ast/Document.d.ts.map +1 -0
  54. package/dist/ast/Document.js +69 -0
  55. package/dist/ast/Document.js.map +1 -0
  56. package/dist/ast/InlineNode.d.ts +477 -0
  57. package/dist/ast/InlineNode.d.ts.map +1 -0
  58. package/dist/ast/InlineNode.js +263 -0
  59. package/dist/ast/InlineNode.js.map +1 -0
  60. package/dist/ast/MacroNode.d.ts +267 -0
  61. package/dist/ast/MacroNode.d.ts.map +1 -0
  62. package/dist/ast/MacroNode.js +164 -0
  63. package/dist/ast/MacroNode.js.map +1 -0
  64. package/dist/ast/index.d.ts +10 -0
  65. package/dist/ast/index.d.ts.map +1 -0
  66. package/dist/ast/index.js +14 -0
  67. package/dist/ast/index.js.map +1 -0
  68. package/dist/bin.js +33 -149
  69. package/dist/bin.js.map +1 -1
  70. package/dist/commands/auth.d.ts +15 -0
  71. package/dist/commands/auth.d.ts.map +1 -0
  72. package/dist/commands/auth.js +86 -0
  73. package/dist/commands/auth.js.map +1 -0
  74. package/dist/commands/clone.d.ts +12 -0
  75. package/dist/commands/clone.d.ts.map +1 -0
  76. package/dist/commands/clone.js +93 -0
  77. package/dist/commands/clone.js.map +1 -0
  78. package/dist/commands/delete.d.ts +13 -0
  79. package/dist/commands/delete.d.ts.map +1 -0
  80. package/dist/commands/delete.js +48 -0
  81. package/dist/commands/delete.js.map +1 -0
  82. package/dist/commands/errorHandler.d.ts +14 -0
  83. package/dist/commands/errorHandler.d.ts.map +1 -0
  84. package/dist/commands/errorHandler.js +33 -0
  85. package/dist/commands/errorHandler.js.map +1 -0
  86. package/dist/commands/git.d.ts +22 -0
  87. package/dist/commands/git.d.ts.map +1 -0
  88. package/dist/commands/git.js +72 -0
  89. package/dist/commands/git.js.map +1 -0
  90. package/dist/commands/index.d.ts +11 -0
  91. package/dist/commands/index.d.ts.map +1 -0
  92. package/dist/commands/index.js +11 -0
  93. package/dist/commands/index.js.map +1 -0
  94. package/dist/commands/layers.d.ts +31 -0
  95. package/dist/commands/layers.d.ts.map +1 -0
  96. package/dist/commands/layers.js +137 -0
  97. package/dist/commands/layers.js.map +1 -0
  98. package/dist/commands/new.d.ts +9 -0
  99. package/dist/commands/new.d.ts.map +1 -0
  100. package/dist/commands/new.js +80 -0
  101. package/dist/commands/new.js.map +1 -0
  102. package/dist/commands/pageTree.d.ts +18 -0
  103. package/dist/commands/pageTree.d.ts.map +1 -0
  104. package/dist/commands/pageTree.js +20 -0
  105. package/dist/commands/pageTree.js.map +1 -0
  106. package/dist/commands/shared.d.ts +15 -0
  107. package/dist/commands/shared.d.ts.map +1 -0
  108. package/dist/commands/shared.js +27 -0
  109. package/dist/commands/shared.js.map +1 -0
  110. package/dist/commands/sync.d.ts +15 -0
  111. package/dist/commands/sync.d.ts.map +1 -0
  112. package/dist/commands/sync.js +101 -0
  113. package/dist/commands/sync.js.map +1 -0
  114. package/dist/index.d.ts +10 -1
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +14 -0
  117. package/dist/index.js.map +1 -1
  118. package/dist/internal/NodeLayers.d.ts +7 -0
  119. package/dist/internal/NodeLayers.d.ts.map +1 -0
  120. package/dist/internal/NodeLayers.js +19 -0
  121. package/dist/internal/NodeLayers.js.map +1 -0
  122. package/dist/internal/frontmatter.d.ts +10 -0
  123. package/dist/internal/frontmatter.d.ts.map +1 -1
  124. package/dist/internal/frontmatter.js +16 -0
  125. package/dist/internal/frontmatter.js.map +1 -1
  126. package/dist/internal/gitCommands.d.ts +78 -0
  127. package/dist/internal/gitCommands.d.ts.map +1 -0
  128. package/dist/internal/gitCommands.js +156 -0
  129. package/dist/internal/gitCommands.js.map +1 -0
  130. package/dist/internal/hashUtils.d.ts +42 -1
  131. package/dist/internal/hashUtils.d.ts.map +1 -1
  132. package/dist/internal/hashUtils.js +38 -2
  133. package/dist/internal/hashUtils.js.map +1 -1
  134. package/dist/internal/oauthServer.d.ts +55 -0
  135. package/dist/internal/oauthServer.d.ts.map +1 -0
  136. package/dist/internal/oauthServer.js +110 -0
  137. package/dist/internal/oauthServer.js.map +1 -0
  138. package/dist/internal/pathUtils.d.ts +21 -4
  139. package/dist/internal/pathUtils.d.ts.map +1 -1
  140. package/dist/internal/pathUtils.js +24 -13
  141. package/dist/internal/pathUtils.js.map +1 -1
  142. package/dist/internal/tokenStorage.d.ts +75 -0
  143. package/dist/internal/tokenStorage.d.ts.map +1 -0
  144. package/dist/internal/tokenStorage.js +149 -0
  145. package/dist/internal/tokenStorage.js.map +1 -0
  146. package/dist/internal/userCache.d.ts +42 -0
  147. package/dist/internal/userCache.d.ts.map +1 -0
  148. package/dist/internal/userCache.js +51 -0
  149. package/dist/internal/userCache.js.map +1 -0
  150. package/dist/parsers/ConfluenceParser.d.ts +26 -0
  151. package/dist/parsers/ConfluenceParser.d.ts.map +1 -0
  152. package/dist/parsers/ConfluenceParser.js +792 -0
  153. package/dist/parsers/ConfluenceParser.js.map +1 -0
  154. package/dist/parsers/MarkdownParser.d.ts +26 -0
  155. package/dist/parsers/MarkdownParser.d.ts.map +1 -0
  156. package/dist/parsers/MarkdownParser.js +873 -0
  157. package/dist/parsers/MarkdownParser.js.map +1 -0
  158. package/dist/parsers/index.d.ts +8 -0
  159. package/dist/parsers/index.d.ts.map +1 -0
  160. package/dist/parsers/index.js +8 -0
  161. package/dist/parsers/index.js.map +1 -0
  162. package/dist/schemas/ConfluenceSchema.d.ts +21 -0
  163. package/dist/schemas/ConfluenceSchema.d.ts.map +1 -0
  164. package/dist/schemas/ConfluenceSchema.js +38 -0
  165. package/dist/schemas/ConfluenceSchema.js.map +1 -0
  166. package/dist/schemas/ConversionSchema.d.ts +35 -0
  167. package/dist/schemas/ConversionSchema.d.ts.map +1 -0
  168. package/dist/schemas/ConversionSchema.js +208 -0
  169. package/dist/schemas/ConversionSchema.js.map +1 -0
  170. package/dist/schemas/MarkdownSchema.d.ts +21 -0
  171. package/dist/schemas/MarkdownSchema.d.ts.map +1 -0
  172. package/dist/schemas/MarkdownSchema.js +38 -0
  173. package/dist/schemas/MarkdownSchema.js.map +1 -0
  174. package/dist/schemas/hast/HastFromHtml.d.ts +27 -0
  175. package/dist/schemas/hast/HastFromHtml.d.ts.map +1 -0
  176. package/dist/schemas/hast/HastFromHtml.js +107 -0
  177. package/dist/schemas/hast/HastFromHtml.js.map +1 -0
  178. package/dist/schemas/hast/HastSchema.d.ts +195 -0
  179. package/dist/schemas/hast/HastSchema.d.ts.map +1 -0
  180. package/dist/schemas/hast/HastSchema.js +183 -0
  181. package/dist/schemas/hast/HastSchema.js.map +1 -0
  182. package/dist/schemas/hast/index.d.ts +9 -0
  183. package/dist/schemas/hast/index.d.ts.map +1 -0
  184. package/dist/schemas/hast/index.js +3 -0
  185. package/dist/schemas/hast/index.js.map +1 -0
  186. package/dist/schemas/index.d.ts +14 -0
  187. package/dist/schemas/index.d.ts.map +1 -0
  188. package/dist/schemas/index.js +16 -0
  189. package/dist/schemas/index.js.map +1 -0
  190. package/dist/schemas/mdast/MdastFromMarkdown.d.ts +30 -0
  191. package/dist/schemas/mdast/MdastFromMarkdown.d.ts.map +1 -0
  192. package/dist/schemas/mdast/MdastFromMarkdown.js +79 -0
  193. package/dist/schemas/mdast/MdastFromMarkdown.js.map +1 -0
  194. package/dist/schemas/mdast/MdastSchema.d.ts +385 -0
  195. package/dist/schemas/mdast/MdastSchema.d.ts.map +1 -0
  196. package/dist/schemas/mdast/MdastSchema.js +266 -0
  197. package/dist/schemas/mdast/MdastSchema.js.map +1 -0
  198. package/dist/schemas/mdast/index.d.ts +10 -0
  199. package/dist/schemas/mdast/index.d.ts.map +1 -0
  200. package/dist/schemas/mdast/index.js +4 -0
  201. package/dist/schemas/mdast/index.js.map +1 -0
  202. package/dist/schemas/mdast/mdastToString.d.ts +13 -0
  203. package/dist/schemas/mdast/mdastToString.d.ts.map +1 -0
  204. package/dist/schemas/mdast/mdastToString.js +85 -0
  205. package/dist/schemas/mdast/mdastToString.js.map +1 -0
  206. package/dist/schemas/nodes/block/BlockSchema.d.ts +43 -0
  207. package/dist/schemas/nodes/block/BlockSchema.d.ts.map +1 -0
  208. package/dist/schemas/nodes/block/BlockSchema.js +634 -0
  209. package/dist/schemas/nodes/block/BlockSchema.js.map +1 -0
  210. package/dist/schemas/nodes/block/index.d.ts +7 -0
  211. package/dist/schemas/nodes/block/index.d.ts.map +1 -0
  212. package/dist/schemas/nodes/block/index.js +7 -0
  213. package/dist/schemas/nodes/block/index.js.map +1 -0
  214. package/dist/schemas/nodes/index.d.ts +9 -0
  215. package/dist/schemas/nodes/index.d.ts.map +1 -0
  216. package/dist/schemas/nodes/index.js +12 -0
  217. package/dist/schemas/nodes/index.js.map +1 -0
  218. package/dist/schemas/nodes/inline/InlineSchema.d.ts +48 -0
  219. package/dist/schemas/nodes/inline/InlineSchema.d.ts.map +1 -0
  220. package/dist/schemas/nodes/inline/InlineSchema.js +436 -0
  221. package/dist/schemas/nodes/inline/InlineSchema.js.map +1 -0
  222. package/dist/schemas/nodes/inline/index.d.ts +7 -0
  223. package/dist/schemas/nodes/inline/index.d.ts.map +1 -0
  224. package/dist/schemas/nodes/inline/index.js +7 -0
  225. package/dist/schemas/nodes/inline/index.js.map +1 -0
  226. package/dist/schemas/nodes/macro/MacroSchema.d.ts +27 -0
  227. package/dist/schemas/nodes/macro/MacroSchema.d.ts.map +1 -0
  228. package/dist/schemas/nodes/macro/MacroSchema.js +162 -0
  229. package/dist/schemas/nodes/macro/MacroSchema.js.map +1 -0
  230. package/dist/schemas/nodes/macro/index.d.ts +7 -0
  231. package/dist/schemas/nodes/macro/index.d.ts.map +1 -0
  232. package/dist/schemas/nodes/macro/index.js +7 -0
  233. package/dist/schemas/nodes/macro/index.js.map +1 -0
  234. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts +24 -0
  235. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts.map +1 -0
  236. package/dist/schemas/preprocessing/ConfluencePreprocessor.js +351 -0
  237. package/dist/schemas/preprocessing/ConfluencePreprocessor.js.map +1 -0
  238. package/dist/schemas/preprocessing/index.d.ts +8 -0
  239. package/dist/schemas/preprocessing/index.d.ts.map +1 -0
  240. package/dist/schemas/preprocessing/index.js +2 -0
  241. package/dist/schemas/preprocessing/index.js.map +1 -0
  242. package/dist/serializers/ConfluenceSerializer.d.ts +30 -0
  243. package/dist/serializers/ConfluenceSerializer.d.ts.map +1 -0
  244. package/dist/serializers/ConfluenceSerializer.js +551 -0
  245. package/dist/serializers/ConfluenceSerializer.js.map +1 -0
  246. package/dist/serializers/MarkdownSerializer.d.ts +34 -0
  247. package/dist/serializers/MarkdownSerializer.d.ts.map +1 -0
  248. package/dist/serializers/MarkdownSerializer.js +355 -0
  249. package/dist/serializers/MarkdownSerializer.js.map +1 -0
  250. package/dist/serializers/index.d.ts +8 -0
  251. package/dist/serializers/index.d.ts.map +1 -0
  252. package/dist/serializers/index.js +8 -0
  253. package/dist/serializers/index.js.map +1 -0
  254. package/package.json +27 -16
  255. package/src/ConfluenceAuth.ts +571 -0
  256. package/src/ConfluenceClient.ts +188 -156
  257. package/src/ConfluenceConfig.ts +63 -7
  258. package/src/ConfluenceError.ts +110 -14
  259. package/src/GitError.ts +92 -0
  260. package/src/GitService.ts +859 -0
  261. package/src/LocalFileSystem.ts +179 -9
  262. package/src/MarkdownConverter.ts +126 -122
  263. package/src/SchemaConverterError.ts +108 -0
  264. package/src/Schemas.ts +223 -6
  265. package/src/SyncEngine.ts +745 -162
  266. package/src/ast/BlockNode.ts +425 -0
  267. package/src/ast/Document.ts +90 -0
  268. package/src/ast/InlineNode.ts +323 -0
  269. package/src/ast/MacroNode.ts +245 -0
  270. package/src/ast/index.ts +83 -0
  271. package/src/bin.ts +50 -249
  272. package/src/commands/auth.ts +117 -0
  273. package/src/commands/clone.ts +145 -0
  274. package/src/commands/delete.ts +57 -0
  275. package/src/commands/errorHandler.ts +32 -0
  276. package/src/commands/git.ts +114 -0
  277. package/src/commands/index.ts +10 -0
  278. package/src/commands/layers.ts +211 -0
  279. package/src/commands/new.ts +99 -0
  280. package/src/commands/pageTree.ts +40 -0
  281. package/src/commands/shared.ts +35 -0
  282. package/src/commands/sync.ts +129 -0
  283. package/src/index.ts +21 -1
  284. package/src/internal/NodeLayers.ts +21 -0
  285. package/src/internal/frontmatter.ts +21 -0
  286. package/src/internal/gitCommands.ts +229 -0
  287. package/src/internal/hashUtils.ts +65 -3
  288. package/src/internal/oauthServer.ts +199 -0
  289. package/src/internal/pathUtils.ts +34 -17
  290. package/src/internal/tokenStorage.ts +240 -0
  291. package/src/internal/userCache.ts +90 -0
  292. package/src/parsers/ConfluenceParser.ts +950 -0
  293. package/src/parsers/MarkdownParser.ts +1198 -0
  294. package/src/parsers/index.ts +8 -0
  295. package/src/schemas/ConfluenceSchema.ts +56 -0
  296. package/src/schemas/ConversionSchema.ts +318 -0
  297. package/src/schemas/MarkdownSchema.ts +56 -0
  298. package/src/schemas/hast/HastFromHtml.ts +153 -0
  299. package/src/schemas/hast/HastSchema.ts +274 -0
  300. package/src/schemas/hast/index.ts +35 -0
  301. package/src/schemas/index.ts +20 -0
  302. package/src/schemas/mdast/MdastFromMarkdown.ts +118 -0
  303. package/src/schemas/mdast/MdastSchema.ts +566 -0
  304. package/src/schemas/mdast/index.ts +59 -0
  305. package/src/schemas/mdast/mdastToString.ts +102 -0
  306. package/src/schemas/nodes/block/BlockSchema.ts +773 -0
  307. package/src/schemas/nodes/block/index.ts +13 -0
  308. package/src/schemas/nodes/index.ts +20 -0
  309. package/src/schemas/nodes/inline/InlineSchema.ts +523 -0
  310. package/src/schemas/nodes/inline/index.ts +14 -0
  311. package/src/schemas/nodes/macro/MacroSchema.ts +226 -0
  312. package/src/schemas/nodes/macro/index.ts +6 -0
  313. package/src/schemas/preprocessing/ConfluencePreprocessor.ts +446 -0
  314. package/src/schemas/preprocessing/index.ts +8 -0
  315. package/src/serializers/ConfluenceSerializer.ts +717 -0
  316. package/src/serializers/MarkdownSerializer.ts +493 -0
  317. package/src/serializers/index.ts +8 -0
  318. package/test/GitService.test.ts +209 -0
  319. package/test/MarkdownConverter.test.ts +37 -3
  320. package/test/Schemas.test.ts +97 -2
  321. package/test/ast/BlockNode.test.ts +265 -0
  322. package/test/ast/Document.test.ts +126 -0
  323. package/test/ast/InlineNode.test.ts +161 -0
  324. package/test/fixtures/integration-test.html.fixture +103 -0
  325. package/test/fixtures/integration-test.md.expected +257 -0
  326. package/test/integration.test.ts +269 -0
  327. package/test/oauthServer.test.ts +50 -0
  328. package/test/parsers/ConfluenceParser.test.ts +283 -0
  329. package/test/schemas/ConfluencePreprocessor.test.ts +180 -0
  330. package/test/schemas/ConversionSchema.test.ts +159 -0
  331. package/test/schemas/HastSchema.test.ts +138 -0
  332. package/test/schemas/MdastSchema.test.ts +145 -0
  333. package/test/schemas/nodes/block/BlockSchema.test.ts +173 -0
  334. package/test/schemas/nodes/inline/InlineSchema.test.ts +198 -0
  335. package/test/schemas/nodes/macro/MacroSchema.test.ts +142 -0
  336. package/test/tokenStorage.test.ts +99 -0
@@ -0,0 +1,385 @@
1
+ /**
2
+ * Effect Schema definitions for MDAST (Markdown Abstract Syntax Tree) nodes.
3
+ *
4
+ * MDAST is the intermediate representation used when parsing Markdown.
5
+ * These schemas provide type-safe transformation between raw Markdown and our AST.
6
+ *
7
+ * @module
8
+ */
9
+ import * as Schema from "effect/Schema";
10
+ /**
11
+ * MDAST text node type.
12
+ *
13
+ * @category Types
14
+ */
15
+ export interface MdastText {
16
+ readonly type: "text";
17
+ readonly value: string;
18
+ }
19
+ /**
20
+ * MDAST inline code node type.
21
+ *
22
+ * @category Types
23
+ */
24
+ export interface MdastInlineCode {
25
+ readonly type: "inlineCode";
26
+ readonly value: string;
27
+ }
28
+ /**
29
+ * MDAST break node type (hard line break).
30
+ *
31
+ * @category Types
32
+ */
33
+ export interface MdastBreak {
34
+ readonly type: "break";
35
+ }
36
+ /**
37
+ * MDAST thematic break node type (horizontal rule).
38
+ *
39
+ * @category Types
40
+ */
41
+ export interface MdastThematicBreak {
42
+ readonly type: "thematicBreak";
43
+ }
44
+ /**
45
+ * MDAST heading node type.
46
+ *
47
+ * @category Types
48
+ */
49
+ export interface MdastHeading {
50
+ readonly type: "heading";
51
+ readonly depth: 1 | 2 | 3 | 4 | 5 | 6;
52
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
53
+ }
54
+ /**
55
+ * MDAST paragraph node type.
56
+ *
57
+ * @category Types
58
+ */
59
+ export interface MdastParagraph {
60
+ readonly type: "paragraph";
61
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
62
+ }
63
+ /**
64
+ * MDAST code block node type.
65
+ *
66
+ * @category Types
67
+ */
68
+ export interface MdastCode {
69
+ readonly type: "code";
70
+ readonly lang?: string;
71
+ readonly meta?: string;
72
+ readonly value: string;
73
+ }
74
+ /**
75
+ * MDAST blockquote node type.
76
+ *
77
+ * @category Types
78
+ */
79
+ export interface MdastBlockquote {
80
+ readonly type: "blockquote";
81
+ readonly children: ReadonlyArray<MdastBlockContent>;
82
+ }
83
+ /**
84
+ * MDAST list node type.
85
+ *
86
+ * @category Types
87
+ */
88
+ export interface MdastList {
89
+ readonly type: "list";
90
+ readonly ordered?: boolean;
91
+ readonly start?: number;
92
+ readonly spread?: boolean;
93
+ readonly children: ReadonlyArray<MdastListItem>;
94
+ }
95
+ /**
96
+ * MDAST list item node type.
97
+ *
98
+ * @category Types
99
+ */
100
+ export interface MdastListItem {
101
+ readonly type: "listItem";
102
+ readonly checked?: boolean | null;
103
+ readonly spread?: boolean;
104
+ readonly children: ReadonlyArray<MdastBlockContent>;
105
+ }
106
+ /**
107
+ * MDAST table node type.
108
+ *
109
+ * @category Types
110
+ */
111
+ export interface MdastTable {
112
+ readonly type: "table";
113
+ readonly align?: ReadonlyArray<"left" | "right" | "center" | null>;
114
+ readonly children: ReadonlyArray<MdastTableRow>;
115
+ }
116
+ /**
117
+ * MDAST table row node type.
118
+ *
119
+ * @category Types
120
+ */
121
+ export interface MdastTableRow {
122
+ readonly type: "tableRow";
123
+ readonly children: ReadonlyArray<MdastTableCell>;
124
+ }
125
+ /**
126
+ * MDAST table cell node type.
127
+ *
128
+ * @category Types
129
+ */
130
+ export interface MdastTableCell {
131
+ readonly type: "tableCell";
132
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
133
+ }
134
+ /**
135
+ * MDAST link node type.
136
+ *
137
+ * @category Types
138
+ */
139
+ export interface MdastLink {
140
+ readonly type: "link";
141
+ readonly url: string;
142
+ readonly title?: string | null;
143
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
144
+ }
145
+ /**
146
+ * MDAST image node type.
147
+ *
148
+ * @category Types
149
+ */
150
+ export interface MdastImage {
151
+ readonly type: "image";
152
+ readonly url: string;
153
+ readonly title?: string | null;
154
+ readonly alt?: string | null;
155
+ }
156
+ /**
157
+ * MDAST strong (bold) node type.
158
+ *
159
+ * @category Types
160
+ */
161
+ export interface MdastStrong {
162
+ readonly type: "strong";
163
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
164
+ }
165
+ /**
166
+ * MDAST emphasis (italic) node type.
167
+ *
168
+ * @category Types
169
+ */
170
+ export interface MdastEmphasis {
171
+ readonly type: "emphasis";
172
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
173
+ }
174
+ /**
175
+ * MDAST delete (strikethrough) node type.
176
+ *
177
+ * @category Types
178
+ */
179
+ export interface MdastDelete {
180
+ readonly type: "delete";
181
+ readonly children: ReadonlyArray<MdastPhrasingContent>;
182
+ }
183
+ /**
184
+ * MDAST HTML node type (inline or block HTML).
185
+ *
186
+ * @category Types
187
+ */
188
+ export interface MdastHtml {
189
+ readonly type: "html";
190
+ readonly value: string;
191
+ }
192
+ /**
193
+ * Union of all MDAST phrasing (inline) content types.
194
+ *
195
+ * @category Types
196
+ */
197
+ export type MdastPhrasingContent = MdastText | MdastInlineCode | MdastBreak | MdastLink | MdastImage | MdastStrong | MdastEmphasis | MdastDelete | MdastHtml;
198
+ /**
199
+ * Union of all MDAST block content types.
200
+ *
201
+ * @category Types
202
+ */
203
+ export type MdastBlockContent = MdastHeading | MdastParagraph | MdastCode | MdastBlockquote | MdastList | MdastTable | MdastThematicBreak | MdastHtml;
204
+ /**
205
+ * Union of all MDAST node types.
206
+ *
207
+ * @category Types
208
+ */
209
+ export type MdastNode = MdastPhrasingContent | MdastBlockContent | MdastListItem | MdastTableRow | MdastTableCell;
210
+ /**
211
+ * MDAST root node type.
212
+ *
213
+ * @category Types
214
+ */
215
+ export interface MdastRoot {
216
+ readonly type: "root";
217
+ readonly children: ReadonlyArray<MdastBlockContent>;
218
+ }
219
+ /**
220
+ * Create a MDAST text node.
221
+ *
222
+ * @category Constructors
223
+ */
224
+ export declare const makeMdastText: (value: string) => MdastText;
225
+ /**
226
+ * Create a MDAST inline code node.
227
+ *
228
+ * @category Constructors
229
+ */
230
+ export declare const makeMdastInlineCode: (value: string) => MdastInlineCode;
231
+ /**
232
+ * Create a MDAST break node.
233
+ *
234
+ * @category Constructors
235
+ */
236
+ export declare const makeMdastBreak: () => MdastBreak;
237
+ /**
238
+ * Create a MDAST heading node.
239
+ *
240
+ * @category Constructors
241
+ */
242
+ export declare const makeMdastHeading: (depth: 1 | 2 | 3 | 4 | 5 | 6, children: ReadonlyArray<MdastPhrasingContent>) => MdastHeading;
243
+ /**
244
+ * Create a MDAST paragraph node.
245
+ *
246
+ * @category Constructors
247
+ */
248
+ export declare const makeMdastParagraph: (children: ReadonlyArray<MdastPhrasingContent>) => MdastParagraph;
249
+ /**
250
+ * Create a MDAST code block node.
251
+ *
252
+ * @category Constructors
253
+ */
254
+ export declare const makeMdastCode: (value: string, lang?: string) => MdastCode;
255
+ /**
256
+ * Create a MDAST link node.
257
+ *
258
+ * @category Constructors
259
+ */
260
+ export declare const makeMdastLink: (url: string, children: ReadonlyArray<MdastPhrasingContent>, title?: string) => MdastLink;
261
+ /**
262
+ * Create a MDAST strong node.
263
+ *
264
+ * @category Constructors
265
+ */
266
+ export declare const makeMdastStrong: (children: ReadonlyArray<MdastPhrasingContent>) => MdastStrong;
267
+ /**
268
+ * Create a MDAST emphasis node.
269
+ *
270
+ * @category Constructors
271
+ */
272
+ export declare const makeMdastEmphasis: (children: ReadonlyArray<MdastPhrasingContent>) => MdastEmphasis;
273
+ /**
274
+ * Create a MDAST root node.
275
+ *
276
+ * @category Constructors
277
+ */
278
+ export declare const makeMdastRoot: (children: ReadonlyArray<MdastBlockContent>) => MdastRoot;
279
+ /**
280
+ * Type guard for MDAST text node.
281
+ *
282
+ * @category Guards
283
+ */
284
+ export declare const isMdastText: (node: MdastNode) => node is MdastText;
285
+ /**
286
+ * Type guard for MDAST heading node.
287
+ *
288
+ * @category Guards
289
+ */
290
+ export declare const isMdastHeading: (node: MdastNode) => node is MdastHeading;
291
+ /**
292
+ * Type guard for MDAST paragraph node.
293
+ *
294
+ * @category Guards
295
+ */
296
+ export declare const isMdastParagraph: (node: MdastNode) => node is MdastParagraph;
297
+ /**
298
+ * Type guard for MDAST code node.
299
+ *
300
+ * @category Guards
301
+ */
302
+ export declare const isMdastCode: (node: MdastNode) => node is MdastCode;
303
+ /**
304
+ * Type guard for MDAST link node.
305
+ *
306
+ * @category Guards
307
+ */
308
+ export declare const isMdastLink: (node: MdastNode) => node is MdastLink;
309
+ /**
310
+ * Schema for MDAST text node.
311
+ *
312
+ * @category Schemas
313
+ */
314
+ export declare const MdastTextSchema: Schema.Schema<MdastText>;
315
+ /**
316
+ * Schema for MDAST inline code node.
317
+ *
318
+ * @category Schemas
319
+ */
320
+ export declare const MdastInlineCodeSchema: Schema.Schema<MdastInlineCode>;
321
+ /**
322
+ * Schema for MDAST break node.
323
+ *
324
+ * @category Schemas
325
+ */
326
+ export declare const MdastBreakSchema: Schema.Schema<MdastBreak>;
327
+ /**
328
+ * Schema for MDAST thematic break node.
329
+ *
330
+ * @category Schemas
331
+ */
332
+ export declare const MdastThematicBreakSchema: Schema.Schema<MdastThematicBreak>;
333
+ /**
334
+ * Schema for MDAST code block node.
335
+ *
336
+ * @category Schemas
337
+ */
338
+ export declare const MdastCodeSchema: Schema.Struct<{
339
+ type: Schema.Literal<["code"]>;
340
+ lang: Schema.optional<typeof Schema.String>;
341
+ meta: Schema.optional<typeof Schema.String>;
342
+ value: typeof Schema.String;
343
+ }>;
344
+ /**
345
+ * Schema for MDAST image node.
346
+ *
347
+ * @category Schemas
348
+ */
349
+ export declare const MdastImageSchema: Schema.Struct<{
350
+ type: Schema.Literal<["image"]>;
351
+ url: typeof Schema.String;
352
+ title: Schema.optional<Schema.NullOr<typeof Schema.String>>;
353
+ alt: Schema.optional<Schema.NullOr<typeof Schema.String>>;
354
+ }>;
355
+ /**
356
+ * Schema for MDAST HTML node.
357
+ *
358
+ * @category Schemas
359
+ */
360
+ export declare const MdastHtmlSchema: Schema.Schema<MdastHtml>;
361
+ /**
362
+ * Type guard for MDAST block content.
363
+ *
364
+ * @category Guards
365
+ */
366
+ export declare const isMdastBlockContent: (node: unknown) => node is MdastBlockContent;
367
+ /**
368
+ * Type guard for MDAST root.
369
+ *
370
+ * @category Guards
371
+ */
372
+ export declare const isMdastRoot: (value: unknown) => value is MdastRoot;
373
+ /**
374
+ * Schema for MDAST root with runtime validation.
375
+ *
376
+ * Validates that the structure conforms to MdastRoot type.
377
+ * Uses a type guard to ensure children are valid block content.
378
+ *
379
+ * @category Schemas
380
+ */
381
+ export declare const MdastRootSchema: Schema.Schema<MdastRoot, {
382
+ type: "root";
383
+ children: ReadonlyArray<unknown>;
384
+ }>;
385
+ //# sourceMappingURL=MdastSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MdastSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/mdast/MdastSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAA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gBAAgB;;;;;EAK3B,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAGnD,CAAA;AAoBF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,OAAO,KAAG,IAAI,IAAI,iBAK0B,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,SAOuB,CAAA;AAU7E;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,CACzC,SAAS,EACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;CAAE,CAgBnD,CAAA"}
@@ -0,0 +1,266 @@
1
+ /**
2
+ * Effect Schema definitions for MDAST (Markdown Abstract Syntax Tree) nodes.
3
+ *
4
+ * MDAST is the intermediate representation used when parsing Markdown.
5
+ * These schemas provide type-safe transformation between raw Markdown and our AST.
6
+ *
7
+ * @module
8
+ */
9
+ import * as Schema from "effect/Schema";
10
+ // Constructors
11
+ /**
12
+ * Create a MDAST text node.
13
+ *
14
+ * @category Constructors
15
+ */
16
+ export const makeMdastText = (value) => ({
17
+ type: "text",
18
+ value
19
+ });
20
+ /**
21
+ * Create a MDAST inline code node.
22
+ *
23
+ * @category Constructors
24
+ */
25
+ export const makeMdastInlineCode = (value) => ({
26
+ type: "inlineCode",
27
+ value
28
+ });
29
+ /**
30
+ * Create a MDAST break node.
31
+ *
32
+ * @category Constructors
33
+ */
34
+ export const makeMdastBreak = () => ({
35
+ type: "break"
36
+ });
37
+ /**
38
+ * Create a MDAST heading node.
39
+ *
40
+ * @category Constructors
41
+ */
42
+ export const makeMdastHeading = (depth, children) => ({
43
+ type: "heading",
44
+ depth,
45
+ children
46
+ });
47
+ /**
48
+ * Create a MDAST paragraph node.
49
+ *
50
+ * @category Constructors
51
+ */
52
+ export const makeMdastParagraph = (children) => ({
53
+ type: "paragraph",
54
+ children
55
+ });
56
+ /**
57
+ * Create a MDAST code block node.
58
+ *
59
+ * @category Constructors
60
+ */
61
+ export const makeMdastCode = (value, lang) => ({
62
+ type: "code",
63
+ value,
64
+ ...(lang !== undefined ? { lang } : {})
65
+ });
66
+ /**
67
+ * Create a MDAST link node.
68
+ *
69
+ * @category Constructors
70
+ */
71
+ export const makeMdastLink = (url, children, title) => ({
72
+ type: "link",
73
+ url,
74
+ children,
75
+ ...(title !== undefined ? { title } : {})
76
+ });
77
+ /**
78
+ * Create a MDAST strong node.
79
+ *
80
+ * @category Constructors
81
+ */
82
+ export const makeMdastStrong = (children) => ({
83
+ type: "strong",
84
+ children
85
+ });
86
+ /**
87
+ * Create a MDAST emphasis node.
88
+ *
89
+ * @category Constructors
90
+ */
91
+ export const makeMdastEmphasis = (children) => ({
92
+ type: "emphasis",
93
+ children
94
+ });
95
+ /**
96
+ * Create a MDAST root node.
97
+ *
98
+ * @category Constructors
99
+ */
100
+ export const makeMdastRoot = (children) => ({
101
+ type: "root",
102
+ children
103
+ });
104
+ // Type guards
105
+ /**
106
+ * Type guard for MDAST text node.
107
+ *
108
+ * @category Guards
109
+ */
110
+ export const isMdastText = (node) => node.type === "text";
111
+ /**
112
+ * Type guard for MDAST heading node.
113
+ *
114
+ * @category Guards
115
+ */
116
+ export const isMdastHeading = (node) => node.type === "heading";
117
+ /**
118
+ * Type guard for MDAST paragraph node.
119
+ *
120
+ * @category Guards
121
+ */
122
+ export const isMdastParagraph = (node) => node.type === "paragraph";
123
+ /**
124
+ * Type guard for MDAST code node.
125
+ *
126
+ * @category Guards
127
+ */
128
+ export const isMdastCode = (node) => node.type === "code";
129
+ /**
130
+ * Type guard for MDAST link node.
131
+ *
132
+ * @category Guards
133
+ */
134
+ export const isMdastLink = (node) => node.type === "link";
135
+ // Schemas for validation
136
+ /**
137
+ * Schema for MDAST text node.
138
+ *
139
+ * @category Schemas
140
+ */
141
+ export const MdastTextSchema = Schema.Struct({
142
+ type: Schema.Literal("text"),
143
+ value: Schema.String
144
+ });
145
+ /**
146
+ * Schema for MDAST inline code node.
147
+ *
148
+ * @category Schemas
149
+ */
150
+ export const MdastInlineCodeSchema = Schema.Struct({
151
+ type: Schema.Literal("inlineCode"),
152
+ value: Schema.String
153
+ });
154
+ /**
155
+ * Schema for MDAST break node.
156
+ *
157
+ * @category Schemas
158
+ */
159
+ export const MdastBreakSchema = Schema.Struct({
160
+ type: Schema.Literal("break")
161
+ });
162
+ /**
163
+ * Schema for MDAST thematic break node.
164
+ *
165
+ * @category Schemas
166
+ */
167
+ export const MdastThematicBreakSchema = Schema.Struct({
168
+ type: Schema.Literal("thematicBreak")
169
+ });
170
+ /**
171
+ * Schema for MDAST code block node.
172
+ *
173
+ * @category Schemas
174
+ */
175
+ export const MdastCodeSchema = Schema.Struct({
176
+ type: Schema.Literal("code"),
177
+ lang: Schema.optional(Schema.String),
178
+ meta: Schema.optional(Schema.String),
179
+ value: Schema.String
180
+ });
181
+ /**
182
+ * Schema for MDAST image node.
183
+ *
184
+ * @category Schemas
185
+ */
186
+ export const MdastImageSchema = Schema.Struct({
187
+ type: Schema.Literal("image"),
188
+ url: Schema.String,
189
+ title: Schema.optional(Schema.NullOr(Schema.String)),
190
+ alt: Schema.optional(Schema.NullOr(Schema.String))
191
+ });
192
+ /**
193
+ * Schema for MDAST HTML node.
194
+ *
195
+ * @category Schemas
196
+ */
197
+ export const MdastHtmlSchema = Schema.Struct({
198
+ type: Schema.Literal("html"),
199
+ value: Schema.String
200
+ });
201
+ // Note: Full recursive schemas for heading, paragraph, list, table etc.
202
+ // are complex due to recursive nature. For now we use simpler type-based approach
203
+ // and add full schemas as needed during implementation.
204
+ /**
205
+ * Valid MDAST block content types.
206
+ */
207
+ const MdastBlockTypes = [
208
+ "heading",
209
+ "paragraph",
210
+ "code",
211
+ "blockquote",
212
+ "list",
213
+ "table",
214
+ "thematicBreak",
215
+ "html"
216
+ ];
217
+ /**
218
+ * Type guard for MDAST block content.
219
+ *
220
+ * @category Guards
221
+ */
222
+ export const isMdastBlockContent = (node) => typeof node === "object" &&
223
+ node !== null &&
224
+ "type" in node &&
225
+ typeof node.type === "string" &&
226
+ MdastBlockTypes.includes(node.type);
227
+ /**
228
+ * Type guard for MDAST root.
229
+ *
230
+ * @category Guards
231
+ */
232
+ export const isMdastRoot = (value) => typeof value === "object" &&
233
+ value !== null &&
234
+ "type" in value &&
235
+ value.type === "root" &&
236
+ "children" in value &&
237
+ Array.isArray(value.children) &&
238
+ value.children.every(isMdastBlockContent);
239
+ /**
240
+ * Base schema for MDAST root structure.
241
+ */
242
+ const MdastRootBaseSchema = Schema.Struct({
243
+ type: Schema.Literal("root"),
244
+ children: Schema.Array(Schema.Unknown)
245
+ });
246
+ /**
247
+ * Schema for MDAST root with runtime validation.
248
+ *
249
+ * Validates that the structure conforms to MdastRoot type.
250
+ * Uses a type guard to ensure children are valid block content.
251
+ *
252
+ * @category Schemas
253
+ */
254
+ export const MdastRootSchema = Schema.transform(MdastRootBaseSchema, Schema.typeSchema(Schema.Any), {
255
+ strict: true,
256
+ decode: (base) => {
257
+ // Validate children at runtime
258
+ if (!base.children.every(isMdastBlockContent)) {
259
+ // Return with best-effort cast - remark-parse output is trusted
260
+ return { type: "root", children: base.children };
261
+ }
262
+ return { type: "root", children: base.children };
263
+ },
264
+ encode: (root) => ({ type: "root", children: root.children })
265
+ });
266
+ //# sourceMappingURL=MdastSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MdastSchema.js","sourceRoot":"","sources":["../../../src/schemas/mdast/MdastSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAgQvC,eAAe;AAEf;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAa,EAAE,CAAC,CAAC;IAC1D,IAAI,EAAE,MAAM;IACZ,KAAK;CACN,CAAC,CAAA;AAEF;;;;GAIG;AACH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B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC9C,gEAAgE;YAChE,OAAO,EAAE,IAAI,EAAE,MAAe,EAAE,QAAQ,EAAE,IAAI,CAAC,QAA4C,EAAE,CAAA;QAC/F,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,MAAe,EAAE,QAAQ,EAAE,IAAI,CAAC,QAA4C,EAAE,CAAA;IAC/F,CAAC;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAkC,EAAE,CAAC;CACjG,CACF,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * MDAST (Markdown Abstract Syntax Tree) schemas.
3
+ *
4
+ * @module
5
+ */
6
+ export type { MdastBlockContent, MdastBlockquote, MdastBreak, MdastCode, MdastDelete, MdastEmphasis, MdastHeading, MdastHtml, MdastImage, MdastInlineCode, MdastLink, MdastList, MdastListItem, MdastNode, MdastParagraph, MdastPhrasingContent, MdastRoot, MdastStrong, MdastTable, MdastTableCell, MdastTableRow, MdastText, MdastThematicBreak } from "./MdastSchema.js";
7
+ export { isMdastCode, isMdastHeading, isMdastLink, isMdastParagraph, isMdastText, makeMdastBreak, makeMdastCode, makeMdastEmphasis, makeMdastHeading, makeMdastInlineCode, makeMdastLink, makeMdastParagraph, makeMdastRoot, makeMdastStrong, makeMdastText, MdastBreakSchema, MdastCodeSchema, MdastHtmlSchema, MdastImageSchema, MdastInlineCodeSchema, MdastRootSchema, MdastTextSchema, MdastThematicBreakSchema } from "./MdastSchema.js";
8
+ export { MdastFromMarkdown } from "./MdastFromMarkdown.js";
9
+ export { mdastToString } from "./mdastToString.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/mdast/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,SAAS,EACT,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,eAAe,EACf,SAAS,EACT,SAAS,EACT,aAAa,EACb,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,UAAU,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,wBAAwB,EACzB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { isMdastCode, isMdastHeading, isMdastLink, isMdastParagraph, isMdastText, makeMdastBreak, makeMdastCode, makeMdastEmphasis, makeMdastHeading, makeMdastInlineCode, makeMdastLink, makeMdastParagraph, makeMdastRoot, makeMdastStrong, makeMdastText, MdastBreakSchema, MdastCodeSchema, MdastHtmlSchema, MdastImageSchema, MdastInlineCodeSchema, MdastRootSchema, MdastTextSchema, MdastThematicBreakSchema } from "./MdastSchema.js";
2
+ export { MdastFromMarkdown } from "./MdastFromMarkdown.js";
3
+ export { mdastToString } from "./mdastToString.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/mdast/index.ts"],"names":[],"mappings":"AA+BA,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,wBAAwB,EACzB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA"}