@knpkv/confluence-to-markdown 0.5.0 → 0.7.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 (395) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +58 -14
  3. package/dist/AdfPlaceholders.d.ts +42 -0
  4. package/dist/AdfPlaceholders.d.ts.map +1 -0
  5. package/dist/AdfPlaceholders.js +547 -0
  6. package/dist/AdfPlaceholders.js.map +1 -0
  7. package/dist/AdfSchemaValidator.d.ts +37 -0
  8. package/dist/AdfSchemaValidator.d.ts.map +1 -0
  9. package/dist/AdfSchemaValidator.js +37 -0
  10. package/dist/AdfSchemaValidator.js.map +1 -0
  11. package/dist/AdfWalker.d.ts +39 -0
  12. package/dist/AdfWalker.d.ts.map +1 -0
  13. package/dist/AdfWalker.js +527 -0
  14. package/dist/AdfWalker.js.map +1 -0
  15. package/dist/AtlaskitTransformers.d.ts +35 -0
  16. package/dist/AtlaskitTransformers.d.ts.map +1 -0
  17. package/dist/AtlaskitTransformers.js +48 -0
  18. package/dist/AtlaskitTransformers.js.map +1 -0
  19. package/dist/Brand.d.ts +6 -6
  20. package/dist/Brand.d.ts.map +1 -1
  21. package/dist/Brand.js +8 -6
  22. package/dist/Brand.js.map +1 -1
  23. package/dist/ConfluenceAuth.d.ts +4 -4
  24. package/dist/ConfluenceAuth.d.ts.map +1 -1
  25. package/dist/ConfluenceAuth.js +15 -27
  26. package/dist/ConfluenceAuth.js.map +1 -1
  27. package/dist/ConfluenceClient.d.ts +4 -4
  28. package/dist/ConfluenceClient.d.ts.map +1 -1
  29. package/dist/ConfluenceClient.js +21 -14
  30. package/dist/ConfluenceClient.js.map +1 -1
  31. package/dist/ConfluenceConfig.d.ts +3 -3
  32. package/dist/ConfluenceConfig.d.ts.map +1 -1
  33. package/dist/ConfluenceConfig.js +13 -11
  34. package/dist/ConfluenceConfig.js.map +1 -1
  35. package/dist/ConfluenceError.d.ts +56 -4
  36. package/dist/ConfluenceError.d.ts.map +1 -1
  37. package/dist/ConfluenceError.js +30 -1
  38. package/dist/ConfluenceError.js.map +1 -1
  39. package/dist/GitService.d.ts +11 -3
  40. package/dist/GitService.d.ts.map +1 -1
  41. package/dist/GitService.js +19 -27
  42. package/dist/GitService.js.map +1 -1
  43. package/dist/LocalFileSystem.d.ts +3 -3
  44. package/dist/LocalFileSystem.d.ts.map +1 -1
  45. package/dist/LocalFileSystem.js +6 -6
  46. package/dist/LocalFileSystem.js.map +1 -1
  47. package/dist/MarkdownConverter.d.ts +16 -65
  48. package/dist/MarkdownConverter.d.ts.map +1 -1
  49. package/dist/MarkdownConverter.js +64 -85
  50. package/dist/MarkdownConverter.js.map +1 -1
  51. package/dist/Schemas.d.ts +128 -141
  52. package/dist/Schemas.d.ts.map +1 -1
  53. package/dist/Schemas.js +21 -23
  54. package/dist/Schemas.js.map +1 -1
  55. package/dist/SyncEngine.d.ts +8 -5
  56. package/dist/SyncEngine.d.ts.map +1 -1
  57. package/dist/SyncEngine.js +189 -113
  58. package/dist/SyncEngine.js.map +1 -1
  59. package/dist/bin.js +23 -35
  60. package/dist/bin.js.map +1 -1
  61. package/dist/commands/auth.d.ts +2 -14
  62. package/dist/commands/auth.d.ts.map +1 -1
  63. package/dist/commands/auth.js +11 -16
  64. package/dist/commands/auth.js.map +1 -1
  65. package/dist/commands/clone.d.ts +4 -6
  66. package/dist/commands/clone.d.ts.map +1 -1
  67. package/dist/commands/clone.js +34 -32
  68. package/dist/commands/clone.js.map +1 -1
  69. package/dist/commands/delete.d.ts +2 -10
  70. package/dist/commands/delete.d.ts.map +1 -1
  71. package/dist/commands/delete.js +5 -4
  72. package/dist/commands/delete.js.map +1 -1
  73. package/dist/commands/errorHandler.d.ts +2 -1
  74. package/dist/commands/errorHandler.d.ts.map +1 -1
  75. package/dist/commands/errorHandler.js +22 -15
  76. package/dist/commands/errorHandler.js.map +1 -1
  77. package/dist/commands/fetch.d.ts +27 -0
  78. package/dist/commands/fetch.d.ts.map +1 -0
  79. package/dist/commands/fetch.js +48 -0
  80. package/dist/commands/fetch.js.map +1 -0
  81. package/dist/commands/git.d.ts +7 -10
  82. package/dist/commands/git.d.ts.map +1 -1
  83. package/dist/commands/git.js +6 -6
  84. package/dist/commands/git.js.map +1 -1
  85. package/dist/commands/index.d.ts +1 -0
  86. package/dist/commands/index.d.ts.map +1 -1
  87. package/dist/commands/index.js +1 -0
  88. package/dist/commands/index.js.map +1 -1
  89. package/dist/commands/layers.d.ts +10 -9
  90. package/dist/commands/layers.d.ts.map +1 -1
  91. package/dist/commands/layers.js +41 -30
  92. package/dist/commands/layers.js.map +1 -1
  93. package/dist/commands/new.d.ts +2 -6
  94. package/dist/commands/new.d.ts.map +1 -1
  95. package/dist/commands/new.js +5 -4
  96. package/dist/commands/new.js.map +1 -1
  97. package/dist/commands/pageInput.d.ts +19 -0
  98. package/dist/commands/pageInput.d.ts.map +1 -0
  99. package/dist/commands/pageInput.js +68 -0
  100. package/dist/commands/pageInput.js.map +1 -0
  101. package/dist/commands/root.d.ts +8 -0
  102. package/dist/commands/root.d.ts.map +1 -0
  103. package/dist/commands/root.js +29 -0
  104. package/dist/commands/root.js.map +1 -0
  105. package/dist/commands/sync.d.ts +6 -9
  106. package/dist/commands/sync.d.ts.map +1 -1
  107. package/dist/commands/sync.js +5 -6
  108. package/dist/commands/sync.js.map +1 -1
  109. package/dist/index.d.ts +3 -8
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +2 -13
  112. package/dist/index.js.map +1 -1
  113. package/dist/internal/NodeLayers.d.ts.map +1 -1
  114. package/dist/internal/NodeLayers.js +1 -2
  115. package/dist/internal/NodeLayers.js.map +1 -1
  116. package/dist/internal/adfMetadata.d.ts +30 -0
  117. package/dist/internal/adfMetadata.d.ts.map +1 -0
  118. package/dist/internal/adfMetadata.js +126 -0
  119. package/dist/internal/adfMetadata.js.map +1 -0
  120. package/dist/internal/cleanMarkdown.d.ts +5 -0
  121. package/dist/internal/cleanMarkdown.d.ts.map +1 -0
  122. package/dist/internal/cleanMarkdown.js +13 -0
  123. package/dist/internal/cleanMarkdown.js.map +1 -0
  124. package/dist/internal/frontmatter.d.ts.map +1 -1
  125. package/dist/internal/frontmatter.js +41 -8
  126. package/dist/internal/frontmatter.js.map +1 -1
  127. package/dist/internal/gitCommands.d.ts +9 -3
  128. package/dist/internal/gitCommands.d.ts.map +1 -1
  129. package/dist/internal/gitCommands.js +18 -9
  130. package/dist/internal/gitCommands.js.map +1 -1
  131. package/dist/internal/hashUtils.d.ts +1 -1
  132. package/dist/internal/hashUtils.d.ts.map +1 -1
  133. package/dist/internal/hashUtils.js +1 -1
  134. package/dist/internal/hashUtils.js.map +1 -1
  135. package/dist/internal/oauthServer.d.ts +10 -5
  136. package/dist/internal/oauthServer.d.ts.map +1 -1
  137. package/dist/internal/oauthServer.js +19 -40
  138. package/dist/internal/oauthServer.js.map +1 -1
  139. package/dist/internal/pathUtils.d.ts +1 -1
  140. package/dist/internal/pathUtils.d.ts.map +1 -1
  141. package/dist/internal/pathUtils.js +1 -1
  142. package/dist/internal/pathUtils.js.map +1 -1
  143. package/dist/internal/process.d.ts +15 -0
  144. package/dist/internal/process.d.ts.map +1 -0
  145. package/dist/internal/process.js +10 -0
  146. package/dist/internal/process.js.map +1 -0
  147. package/dist/internal/stdio.d.ts +6 -0
  148. package/dist/internal/stdio.d.ts.map +1 -0
  149. package/dist/internal/stdio.js +15 -0
  150. package/dist/internal/stdio.js.map +1 -0
  151. package/dist/internal/tokenStorage.d.ts +3 -13
  152. package/dist/internal/tokenStorage.d.ts.map +1 -1
  153. package/dist/internal/tokenStorage.js +26 -24
  154. package/dist/internal/tokenStorage.js.map +1 -1
  155. package/dist/internal/userCache.d.ts +1 -1
  156. package/dist/internal/userCache.d.ts.map +1 -1
  157. package/dist/internal/userCache.js +1 -1
  158. package/dist/internal/userCache.js.map +1 -1
  159. package/package.json +29 -20
  160. package/skills/confluence/SKILL.md +143 -0
  161. package/skills/confluence/agents/openai.yaml +4 -0
  162. package/src/AdfPlaceholders.ts +563 -0
  163. package/src/AdfSchemaValidator.ts +65 -0
  164. package/src/AdfWalker.ts +591 -0
  165. package/src/AtlaskitTransformers.ts +70 -0
  166. package/src/Brand.ts +11 -16
  167. package/src/ConfluenceAuth.ts +22 -30
  168. package/src/ConfluenceClient.ts +28 -24
  169. package/src/ConfluenceConfig.ts +14 -14
  170. package/src/ConfluenceError.ts +65 -3
  171. package/src/GitService.ts +39 -49
  172. package/src/LocalFileSystem.ts +7 -9
  173. package/src/MarkdownConverter.ts +108 -143
  174. package/src/Schemas.ts +17 -16
  175. package/src/SyncEngine.ts +272 -127
  176. package/src/atlaskit-adf-schema.d.ts +3 -0
  177. package/src/bin.ts +30 -56
  178. package/src/commands/auth.ts +21 -18
  179. package/src/commands/clone.ts +46 -38
  180. package/src/commands/delete.ts +5 -4
  181. package/src/commands/errorHandler.ts +25 -18
  182. package/src/commands/fetch.ts +90 -0
  183. package/src/commands/git.ts +6 -6
  184. package/src/commands/index.ts +1 -0
  185. package/src/commands/layers.ts +64 -37
  186. package/src/commands/new.ts +5 -4
  187. package/src/commands/pageInput.ts +103 -0
  188. package/src/commands/root.ts +59 -0
  189. package/src/commands/sync.ts +7 -6
  190. package/src/index.ts +3 -18
  191. package/src/internal/NodeLayers.ts +1 -2
  192. package/src/internal/adfMetadata.ts +145 -0
  193. package/src/internal/cleanMarkdown.ts +15 -0
  194. package/src/internal/frontmatter.ts +45 -8
  195. package/src/internal/gitCommands.ts +23 -17
  196. package/src/internal/hashUtils.ts +2 -2
  197. package/src/internal/oauthServer.ts +84 -105
  198. package/src/internal/pathUtils.ts +1 -1
  199. package/src/internal/process.ts +15 -0
  200. package/src/internal/stdio.ts +22 -0
  201. package/src/internal/tokenStorage.ts +39 -29
  202. package/src/internal/userCache.ts +2 -2
  203. package/test/AdfPlaceholders.test.ts +508 -0
  204. package/test/AdfSchemaValidator.test.ts +34 -0
  205. package/test/AdfWalker.test.ts +676 -0
  206. package/test/AtlaskitTransformers.test.ts +25 -0
  207. package/test/Brand.test.ts +11 -11
  208. package/test/GitService.test.ts +6 -2
  209. package/test/MarkdownConverter.test.ts +121 -105
  210. package/test/RoundTrip.test.ts +521 -0
  211. package/test/Schemas.test.ts +40 -40
  212. package/test/adfMetadata.test.ts +110 -0
  213. package/test/cleanMarkdown.test.ts +36 -0
  214. package/test/commandHarness.test.ts +79 -0
  215. package/test/commandHarness.ts +147 -0
  216. package/test/fetch.test.ts +61 -0
  217. package/test/frontmatter.test.ts +41 -0
  218. package/test/integration.test.ts +569 -156
  219. package/test/layers.test.ts +12 -0
  220. package/test/oauthServer.test.ts +4 -5
  221. package/test/pageInput.test.ts +83 -0
  222. package/test/tokenStorage.test.ts +17 -17
  223. package/dist/SchemaConverterError.d.ts +0 -108
  224. package/dist/SchemaConverterError.d.ts.map +0 -1
  225. package/dist/SchemaConverterError.js +0 -84
  226. package/dist/SchemaConverterError.js.map +0 -1
  227. package/dist/ast/BlockNode.d.ts +0 -453
  228. package/dist/ast/BlockNode.d.ts.map +0 -1
  229. package/dist/ast/BlockNode.js +0 -310
  230. package/dist/ast/BlockNode.js.map +0 -1
  231. package/dist/ast/Document.d.ts +0 -216
  232. package/dist/ast/Document.d.ts.map +0 -1
  233. package/dist/ast/Document.js +0 -69
  234. package/dist/ast/Document.js.map +0 -1
  235. package/dist/ast/InlineNode.d.ts +0 -477
  236. package/dist/ast/InlineNode.d.ts.map +0 -1
  237. package/dist/ast/InlineNode.js +0 -263
  238. package/dist/ast/InlineNode.js.map +0 -1
  239. package/dist/ast/MacroNode.d.ts +0 -267
  240. package/dist/ast/MacroNode.d.ts.map +0 -1
  241. package/dist/ast/MacroNode.js +0 -164
  242. package/dist/ast/MacroNode.js.map +0 -1
  243. package/dist/ast/index.d.ts +0 -10
  244. package/dist/ast/index.d.ts.map +0 -1
  245. package/dist/ast/index.js +0 -14
  246. package/dist/ast/index.js.map +0 -1
  247. package/dist/parsers/ConfluenceParser.d.ts +0 -26
  248. package/dist/parsers/ConfluenceParser.d.ts.map +0 -1
  249. package/dist/parsers/ConfluenceParser.js +0 -797
  250. package/dist/parsers/ConfluenceParser.js.map +0 -1
  251. package/dist/parsers/MarkdownParser.d.ts +0 -26
  252. package/dist/parsers/MarkdownParser.d.ts.map +0 -1
  253. package/dist/parsers/MarkdownParser.js +0 -982
  254. package/dist/parsers/MarkdownParser.js.map +0 -1
  255. package/dist/parsers/index.d.ts +0 -8
  256. package/dist/parsers/index.d.ts.map +0 -1
  257. package/dist/parsers/index.js +0 -8
  258. package/dist/parsers/index.js.map +0 -1
  259. package/dist/schemas/ConfluenceSchema.d.ts +0 -21
  260. package/dist/schemas/ConfluenceSchema.d.ts.map +0 -1
  261. package/dist/schemas/ConfluenceSchema.js +0 -38
  262. package/dist/schemas/ConfluenceSchema.js.map +0 -1
  263. package/dist/schemas/ConversionSchema.d.ts +0 -35
  264. package/dist/schemas/ConversionSchema.d.ts.map +0 -1
  265. package/dist/schemas/ConversionSchema.js +0 -208
  266. package/dist/schemas/ConversionSchema.js.map +0 -1
  267. package/dist/schemas/MarkdownSchema.d.ts +0 -21
  268. package/dist/schemas/MarkdownSchema.d.ts.map +0 -1
  269. package/dist/schemas/MarkdownSchema.js +0 -38
  270. package/dist/schemas/MarkdownSchema.js.map +0 -1
  271. package/dist/schemas/hast/HastFromHtml.d.ts +0 -27
  272. package/dist/schemas/hast/HastFromHtml.d.ts.map +0 -1
  273. package/dist/schemas/hast/HastFromHtml.js +0 -107
  274. package/dist/schemas/hast/HastFromHtml.js.map +0 -1
  275. package/dist/schemas/hast/HastSchema.d.ts +0 -195
  276. package/dist/schemas/hast/HastSchema.d.ts.map +0 -1
  277. package/dist/schemas/hast/HastSchema.js +0 -183
  278. package/dist/schemas/hast/HastSchema.js.map +0 -1
  279. package/dist/schemas/hast/index.d.ts +0 -9
  280. package/dist/schemas/hast/index.d.ts.map +0 -1
  281. package/dist/schemas/hast/index.js +0 -3
  282. package/dist/schemas/hast/index.js.map +0 -1
  283. package/dist/schemas/index.d.ts +0 -14
  284. package/dist/schemas/index.d.ts.map +0 -1
  285. package/dist/schemas/index.js +0 -16
  286. package/dist/schemas/index.js.map +0 -1
  287. package/dist/schemas/mdast/MdastFromMarkdown.d.ts +0 -30
  288. package/dist/schemas/mdast/MdastFromMarkdown.d.ts.map +0 -1
  289. package/dist/schemas/mdast/MdastFromMarkdown.js +0 -79
  290. package/dist/schemas/mdast/MdastFromMarkdown.js.map +0 -1
  291. package/dist/schemas/mdast/MdastSchema.d.ts +0 -385
  292. package/dist/schemas/mdast/MdastSchema.d.ts.map +0 -1
  293. package/dist/schemas/mdast/MdastSchema.js +0 -266
  294. package/dist/schemas/mdast/MdastSchema.js.map +0 -1
  295. package/dist/schemas/mdast/index.d.ts +0 -10
  296. package/dist/schemas/mdast/index.d.ts.map +0 -1
  297. package/dist/schemas/mdast/index.js +0 -4
  298. package/dist/schemas/mdast/index.js.map +0 -1
  299. package/dist/schemas/mdast/mdastToString.d.ts +0 -13
  300. package/dist/schemas/mdast/mdastToString.d.ts.map +0 -1
  301. package/dist/schemas/mdast/mdastToString.js +0 -85
  302. package/dist/schemas/mdast/mdastToString.js.map +0 -1
  303. package/dist/schemas/nodes/block/BlockSchema.d.ts +0 -43
  304. package/dist/schemas/nodes/block/BlockSchema.d.ts.map +0 -1
  305. package/dist/schemas/nodes/block/BlockSchema.js +0 -634
  306. package/dist/schemas/nodes/block/BlockSchema.js.map +0 -1
  307. package/dist/schemas/nodes/block/index.d.ts +0 -7
  308. package/dist/schemas/nodes/block/index.d.ts.map +0 -1
  309. package/dist/schemas/nodes/block/index.js +0 -7
  310. package/dist/schemas/nodes/block/index.js.map +0 -1
  311. package/dist/schemas/nodes/index.d.ts +0 -9
  312. package/dist/schemas/nodes/index.d.ts.map +0 -1
  313. package/dist/schemas/nodes/index.js +0 -12
  314. package/dist/schemas/nodes/index.js.map +0 -1
  315. package/dist/schemas/nodes/inline/InlineSchema.d.ts +0 -48
  316. package/dist/schemas/nodes/inline/InlineSchema.d.ts.map +0 -1
  317. package/dist/schemas/nodes/inline/InlineSchema.js +0 -436
  318. package/dist/schemas/nodes/inline/InlineSchema.js.map +0 -1
  319. package/dist/schemas/nodes/inline/index.d.ts +0 -7
  320. package/dist/schemas/nodes/inline/index.d.ts.map +0 -1
  321. package/dist/schemas/nodes/inline/index.js +0 -7
  322. package/dist/schemas/nodes/inline/index.js.map +0 -1
  323. package/dist/schemas/nodes/macro/MacroSchema.d.ts +0 -27
  324. package/dist/schemas/nodes/macro/MacroSchema.d.ts.map +0 -1
  325. package/dist/schemas/nodes/macro/MacroSchema.js +0 -162
  326. package/dist/schemas/nodes/macro/MacroSchema.js.map +0 -1
  327. package/dist/schemas/nodes/macro/index.d.ts +0 -7
  328. package/dist/schemas/nodes/macro/index.d.ts.map +0 -1
  329. package/dist/schemas/nodes/macro/index.js +0 -7
  330. package/dist/schemas/nodes/macro/index.js.map +0 -1
  331. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts +0 -24
  332. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts.map +0 -1
  333. package/dist/schemas/preprocessing/ConfluencePreprocessor.js +0 -359
  334. package/dist/schemas/preprocessing/ConfluencePreprocessor.js.map +0 -1
  335. package/dist/schemas/preprocessing/index.d.ts +0 -8
  336. package/dist/schemas/preprocessing/index.d.ts.map +0 -1
  337. package/dist/schemas/preprocessing/index.js +0 -2
  338. package/dist/schemas/preprocessing/index.js.map +0 -1
  339. package/dist/serializers/ConfluenceSerializer.d.ts +0 -30
  340. package/dist/serializers/ConfluenceSerializer.d.ts.map +0 -1
  341. package/dist/serializers/ConfluenceSerializer.js +0 -560
  342. package/dist/serializers/ConfluenceSerializer.js.map +0 -1
  343. package/dist/serializers/MarkdownSerializer.d.ts +0 -34
  344. package/dist/serializers/MarkdownSerializer.d.ts.map +0 -1
  345. package/dist/serializers/MarkdownSerializer.js +0 -395
  346. package/dist/serializers/MarkdownSerializer.js.map +0 -1
  347. package/dist/serializers/index.d.ts +0 -8
  348. package/dist/serializers/index.d.ts.map +0 -1
  349. package/dist/serializers/index.js +0 -8
  350. package/dist/serializers/index.js.map +0 -1
  351. package/src/SchemaConverterError.ts +0 -108
  352. package/src/ast/BlockNode.ts +0 -469
  353. package/src/ast/Document.ts +0 -90
  354. package/src/ast/InlineNode.ts +0 -323
  355. package/src/ast/MacroNode.ts +0 -245
  356. package/src/ast/index.ts +0 -83
  357. package/src/parsers/ConfluenceParser.ts +0 -956
  358. package/src/parsers/MarkdownParser.ts +0 -1338
  359. package/src/parsers/index.ts +0 -8
  360. package/src/schemas/ConfluenceSchema.ts +0 -56
  361. package/src/schemas/ConversionSchema.ts +0 -318
  362. package/src/schemas/MarkdownSchema.ts +0 -56
  363. package/src/schemas/hast/HastFromHtml.ts +0 -153
  364. package/src/schemas/hast/HastSchema.ts +0 -274
  365. package/src/schemas/hast/index.ts +0 -35
  366. package/src/schemas/index.ts +0 -20
  367. package/src/schemas/mdast/MdastFromMarkdown.ts +0 -118
  368. package/src/schemas/mdast/MdastSchema.ts +0 -566
  369. package/src/schemas/mdast/index.ts +0 -59
  370. package/src/schemas/mdast/mdastToString.ts +0 -102
  371. package/src/schemas/nodes/block/BlockSchema.ts +0 -773
  372. package/src/schemas/nodes/block/index.ts +0 -13
  373. package/src/schemas/nodes/index.ts +0 -20
  374. package/src/schemas/nodes/inline/InlineSchema.ts +0 -523
  375. package/src/schemas/nodes/inline/index.ts +0 -14
  376. package/src/schemas/nodes/macro/MacroSchema.ts +0 -226
  377. package/src/schemas/nodes/macro/index.ts +0 -6
  378. package/src/schemas/preprocessing/ConfluencePreprocessor.ts +0 -455
  379. package/src/schemas/preprocessing/index.ts +0 -8
  380. package/src/serializers/ConfluenceSerializer.ts +0 -737
  381. package/src/serializers/MarkdownSerializer.ts +0 -543
  382. package/src/serializers/index.ts +0 -8
  383. package/test/ast/BlockNode.test.ts +0 -265
  384. package/test/ast/Document.test.ts +0 -126
  385. package/test/ast/InlineNode.test.ts +0 -161
  386. package/test/fixtures/integration-test.html.fixture +0 -103
  387. package/test/fixtures/integration-test.md.expected +0 -257
  388. package/test/parsers/ConfluenceParser.test.ts +0 -452
  389. package/test/schemas/ConfluencePreprocessor.test.ts +0 -180
  390. package/test/schemas/ConversionSchema.test.ts +0 -159
  391. package/test/schemas/HastSchema.test.ts +0 -138
  392. package/test/schemas/MdastSchema.test.ts +0 -145
  393. package/test/schemas/nodes/block/BlockSchema.test.ts +0 -173
  394. package/test/schemas/nodes/inline/InlineSchema.test.ts +0 -198
  395. package/test/schemas/nodes/macro/MacroSchema.test.ts +0 -142
@@ -1,310 +0,0 @@
1
- /**
2
- * Block-level AST node types for structural content.
3
- *
4
- * @module
5
- */
6
- import * as Schema from "effect/Schema";
7
- import { InlineNode } from "./InlineNode.js";
8
- /**
9
- * Schema version for migration support.
10
- *
11
- * @category Version
12
- */
13
- export const SchemaVersion = Schema.Number.pipe(Schema.int(), Schema.positive(), Schema.optionalWith({ default: () => 1 }));
14
- /**
15
- * Optional raw Confluence HTML for exact roundtrip preservation.
16
- * When present, the Confluence serializer will output this instead of reconstructing.
17
- *
18
- * @category BlockNode
19
- */
20
- export const RawConfluence = Schema.optional(Schema.String);
21
- /**
22
- * Heading element (h1-h6).
23
- *
24
- * @example
25
- * ```typescript
26
- * import { Heading, Text } from "@knpkv/confluence-to-markdown/ast"
27
- *
28
- * const h1 = new Heading({
29
- * level: 1,
30
- * children: [new Text({ value: "Introduction" })]
31
- * })
32
- * ```
33
- *
34
- * @category BlockNode
35
- */
36
- export class Heading extends Schema.TaggedClass()("Heading", {
37
- version: SchemaVersion,
38
- level: Schema.Literal(1, 2, 3, 4, 5, 6),
39
- children: Schema.Array(InlineNode),
40
- rawConfluence: RawConfluence
41
- }) {
42
- }
43
- /**
44
- * Text alignment options.
45
- *
46
- * @category BlockNode
47
- */
48
- export const TextAlignment = Schema.Literal("left", "center", "right");
49
- /**
50
- * Paragraph element with optional alignment and indentation.
51
- *
52
- * @example
53
- * ```typescript
54
- * import { Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
55
- *
56
- * const para = new Paragraph({
57
- * children: [new Text({ value: "Hello world" })]
58
- * })
59
- *
60
- * // With alignment
61
- * const centered = new Paragraph({
62
- * alignment: "center",
63
- * children: [new Text({ value: "Centered text" })]
64
- * })
65
- *
66
- * // With indentation (in pixels)
67
- * const indented = new Paragraph({
68
- * indent: 30,
69
- * children: [new Text({ value: "Indented text" })]
70
- * })
71
- * ```
72
- *
73
- * @category BlockNode
74
- */
75
- export class Paragraph extends Schema.TaggedClass()("Paragraph", {
76
- version: SchemaVersion,
77
- alignment: Schema.optional(TextAlignment),
78
- indent: Schema.optional(Schema.Number),
79
- children: Schema.Array(InlineNode),
80
- rawConfluence: RawConfluence
81
- }) {
82
- }
83
- /**
84
- * Code block with optional language.
85
- *
86
- * @example
87
- * ```typescript
88
- * import { CodeBlock } from "@knpkv/confluence-to-markdown/ast"
89
- *
90
- * const code = new CodeBlock({
91
- * language: "typescript",
92
- * code: "const x = 1"
93
- * })
94
- * ```
95
- *
96
- * @category BlockNode
97
- */
98
- export class CodeBlock extends Schema.TaggedClass()("CodeBlock", {
99
- version: SchemaVersion,
100
- language: Schema.optional(Schema.String),
101
- code: Schema.String,
102
- rawConfluence: RawConfluence
103
- }) {
104
- }
105
- /**
106
- * Thematic break / horizontal rule.
107
- *
108
- * @example
109
- * ```typescript
110
- * import { ThematicBreak } from "@knpkv/confluence-to-markdown/ast"
111
- *
112
- * const hr = new ThematicBreak({})
113
- * ```
114
- *
115
- * @category BlockNode
116
- */
117
- export class ThematicBreak extends Schema.TaggedClass()("ThematicBreak", {
118
- rawConfluence: RawConfluence
119
- }) {
120
- }
121
- /**
122
- * Attachment reference for images stored in Confluence.
123
- *
124
- * @category BlockNode
125
- */
126
- export const ImageAttachment = Schema.Struct({
127
- filename: Schema.String,
128
- version: Schema.optional(Schema.Number)
129
- });
130
- /**
131
- * Image element with support for both URL and Confluence attachments.
132
- *
133
- * @example
134
- * ```typescript
135
- * import { Image } from "@knpkv/confluence-to-markdown/ast"
136
- *
137
- * // URL-based image
138
- * const img = new Image({
139
- * src: "https://example.com/image.png",
140
- * alt: "Example image"
141
- * })
142
- *
143
- * // Confluence attachment
144
- * const attachment = new Image({
145
- * attachment: { filename: "logo.svg" },
146
- * align: "center",
147
- * width: 250
148
- * })
149
- * ```
150
- *
151
- * @category BlockNode
152
- */
153
- export class Image extends Schema.TaggedClass()("Image", {
154
- version: SchemaVersion,
155
- src: Schema.optional(Schema.String),
156
- attachment: Schema.optional(ImageAttachment),
157
- alt: Schema.optional(Schema.String),
158
- title: Schema.optional(Schema.String),
159
- align: Schema.optional(Schema.String),
160
- width: Schema.optional(Schema.Number),
161
- rawConfluence: RawConfluence
162
- }) {
163
- }
164
- /**
165
- * Table cell element.
166
- *
167
- * @example
168
- * ```typescript
169
- * import { TableCell, Text } from "@knpkv/confluence-to-markdown/ast"
170
- *
171
- * const cell = new TableCell({
172
- * isHeader: true,
173
- * children: [new Text({ value: "Header" })]
174
- * })
175
- * ```
176
- *
177
- * @category BlockNode
178
- */
179
- export class TableCell extends Schema.TaggedClass()("TableCell", {
180
- isHeader: Schema.optionalWith(Schema.Boolean, { default: () => false }),
181
- children: Schema.Array(InlineNode),
182
- rawConfluence: RawConfluence
183
- }) {
184
- }
185
- /**
186
- * Table row element.
187
- *
188
- * @example
189
- * ```typescript
190
- * import { TableRow, TableCell, Text } from "@knpkv/confluence-to-markdown/ast"
191
- *
192
- * const row = new TableRow({
193
- * cells: [
194
- * new TableCell({ children: [new Text({ value: "A" })] }),
195
- * new TableCell({ children: [new Text({ value: "B" })] })
196
- * ]
197
- * })
198
- * ```
199
- *
200
- * @category BlockNode
201
- */
202
- export class TableRow extends Schema.TaggedClass()("TableRow", {
203
- cells: Schema.Array(TableCell),
204
- rawConfluence: RawConfluence
205
- }) {
206
- }
207
- /**
208
- * Table element with optional header row.
209
- *
210
- * @example
211
- * ```typescript
212
- * import { Table, TableRow, TableCell, Text } from "@knpkv/confluence-to-markdown/ast"
213
- *
214
- * const table = new Table({
215
- * header: new TableRow({
216
- * cells: [new TableCell({ isHeader: true, children: [new Text({ value: "Col" })] })]
217
- * }),
218
- * rows: []
219
- * })
220
- * ```
221
- *
222
- * @category BlockNode
223
- */
224
- export class Table extends Schema.TaggedClass()("Table", {
225
- version: SchemaVersion,
226
- header: Schema.optional(TableRow),
227
- rows: Schema.Array(TableRow),
228
- rawConfluence: RawConfluence
229
- }) {
230
- }
231
- /**
232
- * Unsupported block element - preserves raw content for round-tripping.
233
- *
234
- * @example
235
- * ```typescript
236
- * import { UnsupportedBlock } from "@knpkv/confluence-to-markdown/ast"
237
- *
238
- * const unknown = new UnsupportedBlock({
239
- * rawHtml: "<custom-block>content</custom-block>",
240
- * source: "confluence"
241
- * })
242
- * ```
243
- *
244
- * @category BlockNode
245
- */
246
- export class UnsupportedBlock extends Schema.TaggedClass()("UnsupportedBlock", {
247
- rawHtml: Schema.optional(Schema.String),
248
- rawMarkdown: Schema.optional(Schema.String),
249
- source: Schema.Literal("confluence", "markdown")
250
- }) {
251
- }
252
- // Non-recursive block nodes
253
- const SimpleBlockNode = Schema.Union(Heading, Paragraph, CodeBlock, ThematicBreak, Image, Table, UnsupportedBlock);
254
- /**
255
- * Block quote element with nested block content.
256
- *
257
- * @category BlockNode
258
- */
259
- export const BlockQuote = Schema.Struct({
260
- _tag: Schema.Literal("BlockQuote"),
261
- version: SchemaVersion,
262
- children: Schema.Array(SimpleBlockNode),
263
- rawConfluence: RawConfluence
264
- });
265
- const ListItemChild = Schema.Union(Heading, Paragraph, CodeBlock, ThematicBreak, Image, Table, UnsupportedBlock, Schema.suspend(() => List));
266
- export const ListItem = Schema.Struct({
267
- _tag: Schema.Literal("ListItem"),
268
- checked: Schema.optional(Schema.Boolean),
269
- children: Schema.Array(ListItemChild),
270
- rawConfluence: RawConfluence
271
- });
272
- export const List = Schema.Struct({
273
- _tag: Schema.Literal("List"),
274
- version: SchemaVersion,
275
- ordered: Schema.Boolean,
276
- start: Schema.optional(Schema.Number),
277
- children: Schema.Array(ListItem),
278
- rawConfluence: RawConfluence
279
- });
280
- /**
281
- * Task item with status for Confluence task lists.
282
- *
283
- * @category BlockNode
284
- */
285
- export const TaskItem = Schema.Struct({
286
- _tag: Schema.Literal("TaskItem"),
287
- id: Schema.String,
288
- uuid: Schema.String,
289
- status: Schema.Literal("incomplete", "complete"),
290
- body: Schema.Array(InlineNode),
291
- rawConfluence: RawConfluence
292
- });
293
- /**
294
- * Task list (Confluence action items).
295
- *
296
- * @category BlockNode
297
- */
298
- export const TaskList = Schema.Struct({
299
- _tag: Schema.Literal("TaskList"),
300
- version: SchemaVersion,
301
- children: Schema.Array(TaskItem),
302
- rawConfluence: RawConfluence
303
- });
304
- /**
305
- * Union of all block node types.
306
- *
307
- * @category BlockNode
308
- */
309
- export const BlockNode = Schema.Union(Heading, Paragraph, CodeBlock, ThematicBreak, BlockQuote, Image, Table, List, TaskList, UnsupportedBlock);
310
- //# sourceMappingURL=BlockNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockNode.js","sourceRoot":"","sources":["../../src/ast/BlockNode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAqC,MAAM,iBAAiB,CAAA;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC7C,MAAM,CAAC,GAAG,EAAE,EACZ,MAAM,CAAC,QAAQ,EAAE,EACjB,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAC1C,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAE3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,OAAQ,SAA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;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CACnC,OAAO,EACP,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,CACjB,CAAA"}
@@ -1,216 +0,0 @@
1
- /**
2
- * Document AST node - the root of the AST tree.
3
- *
4
- * @module
5
- */
6
- import * as Schema from "effect/Schema";
7
- import { type BlockNode as BlockNodeType } from "./BlockNode.js";
8
- import { type MacroNode as MacroNodeType } from "./MacroNode.js";
9
- /**
10
- * Document node - represents a Block or Macro node.
11
- *
12
- * @category Document
13
- */
14
- export declare const DocumentNode: Schema.Union<[Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, Schema.Struct<{
15
- _tag: Schema.Literal<["BlockQuote"]>;
16
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
17
- default: () => number;
18
- }>;
19
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
20
- rawConfluence: Schema.optional<typeof Schema.String>;
21
- }>, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, Schema.Schema<import("./BlockNode.js").List, import("./BlockNode.js").ListEncoded, never>, Schema.Struct<{
22
- _tag: Schema.Literal<["TaskList"]>;
23
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
24
- default: () => number;
25
- }>;
26
- children: Schema.Array$<Schema.Struct<{
27
- _tag: Schema.Literal<["TaskItem"]>;
28
- id: typeof Schema.String;
29
- uuid: typeof Schema.String;
30
- status: Schema.Literal<["incomplete", "complete"]>;
31
- body: Schema.Array$<Schema.Union<[typeof import("./InlineNode.js").Text, typeof import("./InlineNode.js").Strong, typeof import("./InlineNode.js").Emphasis, typeof import("./InlineNode.js").InlineCode, typeof import("./InlineNode.js").Link, typeof import("./InlineNode.js").LineBreak, typeof import("./InlineNode.js").Emoticon, typeof import("./InlineNode.js").UserMention, typeof import("./InlineNode.js").DateTime, typeof import("./InlineNode.js").Underline, typeof import("./InlineNode.js").Subscript, typeof import("./InlineNode.js").Superscript, typeof import("./InlineNode.js").Strikethrough, typeof import("./InlineNode.js").ColoredText, typeof import("./InlineNode.js").Highlight, typeof import("./InlineNode.js").UnsupportedInline]>>;
32
- rawConfluence: Schema.optional<typeof Schema.String>;
33
- }>>;
34
- rawConfluence: Schema.optional<typeof Schema.String>;
35
- }>, typeof import("./BlockNode.js").UnsupportedBlock]>, Schema.Union<[Schema.Struct<{
36
- _tag: Schema.Literal<["InfoPanel"]>;
37
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
38
- default: () => number;
39
- }>;
40
- panelType: Schema.Literal<["info", "warning", "note", "tip", "error", "panel"]>;
41
- title: Schema.optional<typeof Schema.String>;
42
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
43
- rawConfluence: Schema.optional<typeof Schema.String>;
44
- }>, Schema.Struct<{
45
- _tag: Schema.Literal<["ExpandMacro"]>;
46
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
47
- default: () => number;
48
- }>;
49
- title: Schema.optional<typeof Schema.String>;
50
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
51
- rawConfluence: Schema.optional<typeof Schema.String>;
52
- }>, Schema.Struct<{
53
- _tag: Schema.Literal<["TocMacro"]>;
54
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
55
- default: () => number;
56
- }>;
57
- minLevel: Schema.optional<typeof Schema.Number>;
58
- maxLevel: Schema.optional<typeof Schema.Number>;
59
- rawConfluence: Schema.optional<typeof Schema.String>;
60
- }>, Schema.Struct<{
61
- _tag: Schema.Literal<["CodeMacro"]>;
62
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
63
- default: () => number;
64
- }>;
65
- language: Schema.optional<typeof Schema.String>;
66
- title: Schema.optional<typeof Schema.String>;
67
- code: typeof Schema.String;
68
- lineNumbers: Schema.optionalWith<typeof Schema.Boolean, {
69
- default: () => false;
70
- }>;
71
- collapse: Schema.optionalWith<typeof Schema.Boolean, {
72
- default: () => false;
73
- }>;
74
- firstLine: Schema.optional<typeof Schema.Number>;
75
- rawConfluence: Schema.optional<typeof Schema.String>;
76
- }>, Schema.Struct<{
77
- _tag: Schema.Literal<["StatusMacro"]>;
78
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
79
- default: () => number;
80
- }>;
81
- text: typeof Schema.String;
82
- color: Schema.Literal<["Grey", "Red", "Yellow", "Green", "Blue"]>;
83
- rawConfluence: Schema.optional<typeof Schema.String>;
84
- }>]>]>;
85
- /**
86
- * Type for document nodes.
87
- *
88
- * @category Types
89
- */
90
- export type DocumentNode = BlockNodeType | MacroNodeType;
91
- /**
92
- * Document schema - the root AST node.
93
- *
94
- * @example
95
- * ```typescript
96
- * import { Document, Heading, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
97
- * import * as Schema from "effect/Schema"
98
- *
99
- * const doc = {
100
- * version: 1,
101
- * children: [
102
- * new Heading({ level: 1, children: [new Text({ value: "Title" })] }),
103
- * new Paragraph({ children: [new Text({ value: "Content" })] })
104
- * ]
105
- * }
106
- *
107
- * const validated = Schema.decodeUnknownSync(Document)(doc)
108
- * ```
109
- *
110
- * @category Document
111
- */
112
- export declare const Document: Schema.Struct<{
113
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
114
- default: () => number;
115
- }>;
116
- children: Schema.Array$<Schema.Union<[Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, Schema.Struct<{
117
- _tag: Schema.Literal<["BlockQuote"]>;
118
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
119
- default: () => number;
120
- }>;
121
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
122
- rawConfluence: Schema.optional<typeof Schema.String>;
123
- }>, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, Schema.Schema<import("./BlockNode.js").List, import("./BlockNode.js").ListEncoded, never>, Schema.Struct<{
124
- _tag: Schema.Literal<["TaskList"]>;
125
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
126
- default: () => number;
127
- }>;
128
- children: Schema.Array$<Schema.Struct<{
129
- _tag: Schema.Literal<["TaskItem"]>;
130
- id: typeof Schema.String;
131
- uuid: typeof Schema.String;
132
- status: Schema.Literal<["incomplete", "complete"]>;
133
- body: Schema.Array$<Schema.Union<[typeof import("./InlineNode.js").Text, typeof import("./InlineNode.js").Strong, typeof import("./InlineNode.js").Emphasis, typeof import("./InlineNode.js").InlineCode, typeof import("./InlineNode.js").Link, typeof import("./InlineNode.js").LineBreak, typeof import("./InlineNode.js").Emoticon, typeof import("./InlineNode.js").UserMention, typeof import("./InlineNode.js").DateTime, typeof import("./InlineNode.js").Underline, typeof import("./InlineNode.js").Subscript, typeof import("./InlineNode.js").Superscript, typeof import("./InlineNode.js").Strikethrough, typeof import("./InlineNode.js").ColoredText, typeof import("./InlineNode.js").Highlight, typeof import("./InlineNode.js").UnsupportedInline]>>;
134
- rawConfluence: Schema.optional<typeof Schema.String>;
135
- }>>;
136
- rawConfluence: Schema.optional<typeof Schema.String>;
137
- }>, typeof import("./BlockNode.js").UnsupportedBlock]>, Schema.Union<[Schema.Struct<{
138
- _tag: Schema.Literal<["InfoPanel"]>;
139
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
140
- default: () => number;
141
- }>;
142
- panelType: Schema.Literal<["info", "warning", "note", "tip", "error", "panel"]>;
143
- title: Schema.optional<typeof Schema.String>;
144
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
145
- rawConfluence: Schema.optional<typeof Schema.String>;
146
- }>, Schema.Struct<{
147
- _tag: Schema.Literal<["ExpandMacro"]>;
148
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
149
- default: () => number;
150
- }>;
151
- title: Schema.optional<typeof Schema.String>;
152
- children: Schema.Array$<Schema.Union<[typeof import("./BlockNode.js").Heading, typeof import("./BlockNode.js").Paragraph, typeof import("./BlockNode.js").CodeBlock, typeof import("./BlockNode.js").ThematicBreak, typeof import("./BlockNode.js").Image, typeof import("./BlockNode.js").Table, typeof import("./BlockNode.js").UnsupportedBlock]>>;
153
- rawConfluence: Schema.optional<typeof Schema.String>;
154
- }>, Schema.Struct<{
155
- _tag: Schema.Literal<["TocMacro"]>;
156
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
157
- default: () => number;
158
- }>;
159
- minLevel: Schema.optional<typeof Schema.Number>;
160
- maxLevel: Schema.optional<typeof Schema.Number>;
161
- rawConfluence: Schema.optional<typeof Schema.String>;
162
- }>, Schema.Struct<{
163
- _tag: Schema.Literal<["CodeMacro"]>;
164
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
165
- default: () => number;
166
- }>;
167
- language: Schema.optional<typeof Schema.String>;
168
- title: Schema.optional<typeof Schema.String>;
169
- code: typeof Schema.String;
170
- lineNumbers: Schema.optionalWith<typeof Schema.Boolean, {
171
- default: () => false;
172
- }>;
173
- collapse: Schema.optionalWith<typeof Schema.Boolean, {
174
- default: () => false;
175
- }>;
176
- firstLine: Schema.optional<typeof Schema.Number>;
177
- rawConfluence: Schema.optional<typeof Schema.String>;
178
- }>, Schema.Struct<{
179
- _tag: Schema.Literal<["StatusMacro"]>;
180
- version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
181
- default: () => number;
182
- }>;
183
- text: typeof Schema.String;
184
- color: Schema.Literal<["Grey", "Red", "Yellow", "Green", "Blue"]>;
185
- rawConfluence: Schema.optional<typeof Schema.String>;
186
- }>]>]>>;
187
- rawConfluence: Schema.optional<typeof Schema.String>;
188
- }>;
189
- /**
190
- * Type for Document.
191
- *
192
- * @category Types
193
- */
194
- export type Document = Schema.Schema.Type<typeof Document>;
195
- /**
196
- * Create a new Document with default version.
197
- *
198
- * @example
199
- * ```typescript
200
- * import { makeDocument, Heading, Text } from "@knpkv/confluence-to-markdown/ast"
201
- *
202
- * const doc = makeDocument([
203
- * new Heading({ level: 1, children: [new Text({ value: "Hello" })] })
204
- * ])
205
- * ```
206
- *
207
- * @category Constructors
208
- */
209
- export declare const makeDocument: (children: ReadonlyArray<DocumentNode>, rawConfluence?: string) => Document;
210
- /**
211
- * Check if a node is a Document.
212
- *
213
- * @category Guards
214
- */
215
- export declare const isDocument: (value: unknown) => value is Document;
216
- //# sourceMappingURL=Document.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../src/ast/Document.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAa,KAAK,SAAS,IAAI,aAAa,EAAgC,MAAM,gBAAgB,CAAA;AACzG,OAAO,EAAa,KAAK,SAAS,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAqC,CAAA;AAE9D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,aAAa,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,aAAa,CAAC,YAAY,CAAC,EACrC,gBAAgB,MAAM,KACrB,QAID,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,QAIR,CAAA"}
@@ -1,69 +0,0 @@
1
- /**
2
- * Document AST node - the root of the AST tree.
3
- *
4
- * @module
5
- */
6
- import * as Schema from "effect/Schema";
7
- import { BlockNode, RawConfluence, SchemaVersion } from "./BlockNode.js";
8
- import { MacroNode } from "./MacroNode.js";
9
- /**
10
- * Document node - represents a Block or Macro node.
11
- *
12
- * @category Document
13
- */
14
- export const DocumentNode = Schema.Union(BlockNode, MacroNode);
15
- /**
16
- * Document schema - the root AST node.
17
- *
18
- * @example
19
- * ```typescript
20
- * import { Document, Heading, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
21
- * import * as Schema from "effect/Schema"
22
- *
23
- * const doc = {
24
- * version: 1,
25
- * children: [
26
- * new Heading({ level: 1, children: [new Text({ value: "Title" })] }),
27
- * new Paragraph({ children: [new Text({ value: "Content" })] })
28
- * ]
29
- * }
30
- *
31
- * const validated = Schema.decodeUnknownSync(Document)(doc)
32
- * ```
33
- *
34
- * @category Document
35
- */
36
- export const Document = Schema.Struct({
37
- version: SchemaVersion,
38
- children: Schema.Array(DocumentNode),
39
- rawConfluence: RawConfluence
40
- });
41
- /**
42
- * Create a new Document with default version.
43
- *
44
- * @example
45
- * ```typescript
46
- * import { makeDocument, Heading, Text } from "@knpkv/confluence-to-markdown/ast"
47
- *
48
- * const doc = makeDocument([
49
- * new Heading({ level: 1, children: [new Text({ value: "Hello" })] })
50
- * ])
51
- * ```
52
- *
53
- * @category Constructors
54
- */
55
- export const makeDocument = (children, rawConfluence) => ({
56
- version: 1,
57
- children,
58
- ...(rawConfluence !== undefined ? { rawConfluence } : {})
59
- });
60
- /**
61
- * Check if a node is a Document.
62
- *
63
- * @category Guards
64
- */
65
- export const isDocument = (value) => typeof value === "object" &&
66
- value !== null &&
67
- "children" in value &&
68
- Array.isArray(value.children);
69
- //# sourceMappingURL=Document.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../src/ast/Document.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAmC,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACzG,OAAO,EAAE,SAAS,EAAmC,MAAM,gBAAgB,CAAA;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAS9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;IACpC,aAAa,EAAE,aAAa;CAC7B,CAAC,CAAA;AASF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,QAAqC,EACrC,aAAsB,EACZ,EAAE,CAAC,CAAC;IACd,OAAO,EAAE,CAAC;IACV,QAAQ;IACR,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAC1D,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAqB,EAAE,CAC9D,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,UAAU,IAAI,KAAK;IACnB,KAAK,CAAC,OAAO,CAAE,KAAkB,CAAC,QAAQ,CAAC,CAAA"}