@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,323 +0,0 @@
1
- /**
2
- * Inline AST node types for text-level content.
3
- *
4
- * @module
5
- */
6
- import * as Schema from "effect/Schema"
7
-
8
- /**
9
- * Optional raw Confluence HTML for exact roundtrip preservation.
10
- * When present, the Confluence serializer will output this instead of reconstructing.
11
- *
12
- * @category InlineNode
13
- */
14
- export const RawConfluence = Schema.optional(Schema.String)
15
-
16
- /**
17
- * Plain text content.
18
- *
19
- * @example
20
- * ```typescript
21
- * import { Text } from "@knpkv/confluence-to-markdown/ast"
22
- *
23
- * const text = new Text({ value: "Hello world" })
24
- * ```
25
- *
26
- * @category InlineNode
27
- */
28
- export class Text extends Schema.TaggedClass<Text>()("Text", {
29
- value: Schema.String
30
- }) {}
31
-
32
- /**
33
- * Inline code span.
34
- *
35
- * @example
36
- * ```typescript
37
- * import { InlineCode } from "@knpkv/confluence-to-markdown/ast"
38
- *
39
- * const code = new InlineCode({ value: "const x = 1" })
40
- * ```
41
- *
42
- * @category InlineNode
43
- */
44
- export class InlineCode extends Schema.TaggedClass<InlineCode>()("InlineCode", {
45
- value: Schema.String
46
- }) {}
47
-
48
- /**
49
- * Line break element.
50
- *
51
- * @example
52
- * ```typescript
53
- * import { LineBreak } from "@knpkv/confluence-to-markdown/ast"
54
- *
55
- * const br = new LineBreak({})
56
- * ```
57
- *
58
- * @category InlineNode
59
- */
60
- export class LineBreak extends Schema.TaggedClass<LineBreak>()("LineBreak", {}) {}
61
-
62
- /**
63
- * Unsupported inline element - preserves raw content for round-tripping.
64
- *
65
- * @example
66
- * ```typescript
67
- * import { UnsupportedInline } from "@knpkv/confluence-to-markdown/ast"
68
- *
69
- * const unknown = new UnsupportedInline({
70
- * raw: "<custom-tag>content</custom-tag>",
71
- * source: "confluence"
72
- * })
73
- * ```
74
- *
75
- * @category InlineNode
76
- */
77
- export class UnsupportedInline extends Schema.TaggedClass<UnsupportedInline>()("UnsupportedInline", {
78
- raw: Schema.String,
79
- source: Schema.Literal("confluence", "markdown")
80
- }) {}
81
-
82
- /**
83
- * Emoticon/emoji element.
84
- *
85
- * @example
86
- * ```typescript
87
- * import { Emoticon } from "@knpkv/confluence-to-markdown/ast"
88
- *
89
- * const emoji = new Emoticon({
90
- * shortname: ":grinning:",
91
- * emojiId: "1f600",
92
- * fallback: "😀"
93
- * })
94
- * ```
95
- *
96
- * @category InlineNode
97
- */
98
- export class Emoticon extends Schema.TaggedClass<Emoticon>()("Emoticon", {
99
- shortname: Schema.String,
100
- emojiId: Schema.String,
101
- fallback: Schema.String,
102
- rawConfluence: RawConfluence
103
- }) {}
104
-
105
- /**
106
- * User mention element.
107
- *
108
- * @example
109
- * ```typescript
110
- * import { UserMention } from "@knpkv/confluence-to-markdown/ast"
111
- *
112
- * const mention = new UserMention({ accountId: "557058:..." })
113
- * ```
114
- *
115
- * @category InlineNode
116
- */
117
- export class UserMention extends Schema.TaggedClass<UserMention>()("UserMention", {
118
- accountId: Schema.String,
119
- rawConfluence: RawConfluence
120
- }) {}
121
-
122
- /**
123
- * Date/time element.
124
- *
125
- * @example
126
- * ```typescript
127
- * import { DateTime } from "@knpkv/confluence-to-markdown/ast"
128
- *
129
- * const date = new DateTime({ datetime: "2026-01-01" })
130
- * ```
131
- *
132
- * @category InlineNode
133
- */
134
- export class DateTime extends Schema.TaggedClass<DateTime>()("DateTime", {
135
- datetime: Schema.String,
136
- rawConfluence: RawConfluence
137
- }) {}
138
-
139
- /**
140
- * Underlined text.
141
- *
142
- * @category InlineNode
143
- */
144
- export class Underline extends Schema.TaggedClass<Underline>()("Underline", {
145
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
146
- }) {}
147
-
148
- /**
149
- * Subscript text.
150
- *
151
- * @category InlineNode
152
- */
153
- export class Subscript extends Schema.TaggedClass<Subscript>()("Subscript", {
154
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
155
- }) {}
156
-
157
- /**
158
- * Superscript text.
159
- *
160
- * @category InlineNode
161
- */
162
- export class Superscript extends Schema.TaggedClass<Superscript>()("Superscript", {
163
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
164
- }) {}
165
-
166
- /**
167
- * Strikethrough text.
168
- *
169
- * @category InlineNode
170
- */
171
- export class Strikethrough extends Schema.TaggedClass<Strikethrough>()("Strikethrough", {
172
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
173
- }) {}
174
-
175
- /**
176
- * Colored text with CSS color value.
177
- *
178
- * @category InlineNode
179
- */
180
- export class ColoredText extends Schema.TaggedClass<ColoredText>()("ColoredText", {
181
- color: Schema.String,
182
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
183
- }) {}
184
-
185
- /**
186
- * Highlighted text with background color.
187
- *
188
- * @category InlineNode
189
- */
190
- export class Highlight extends Schema.TaggedClass<Highlight>()("Highlight", {
191
- backgroundColor: Schema.String,
192
- children: Schema.suspend(() => Schema.Array(InlineNodeBase))
193
- }) {}
194
-
195
- // Forward declaration for recursive types
196
- // Define InlineNode union schema first (without recursive types)
197
- const InlineNodeBase = Schema.Union(
198
- Text,
199
- InlineCode,
200
- LineBreak,
201
- Emoticon,
202
- UserMention,
203
- DateTime,
204
- UnsupportedInline
205
- )
206
-
207
- /**
208
- * Inline node children schema - use this for recursive inline content.
209
- *
210
- * @category InlineNode
211
- */
212
- export const InlineNodeChildren: Schema.Schema<ReadonlyArray<InlineNode>> = Schema.suspend(
213
- () => Schema.Array(InlineNode)
214
- )
215
-
216
- /**
217
- * Strong/bold text.
218
- *
219
- * @example
220
- * ```typescript
221
- * import { Strong, Text } from "@knpkv/confluence-to-markdown/ast"
222
- *
223
- * const bold = new Strong({ children: [new Text({ value: "important" })] })
224
- * ```
225
- *
226
- * @category InlineNode
227
- */
228
- export class Strong extends Schema.TaggedClass<Strong>()("Strong", {
229
- children: Schema.Array(InlineNodeBase)
230
- }) {}
231
-
232
- /**
233
- * Emphasized/italic text.
234
- *
235
- * @example
236
- * ```typescript
237
- * import { Emphasis, Text } from "@knpkv/confluence-to-markdown/ast"
238
- *
239
- * const italic = new Emphasis({ children: [new Text({ value: "emphasized" })] })
240
- * ```
241
- *
242
- * @category InlineNode
243
- */
244
- export class Emphasis extends Schema.TaggedClass<Emphasis>()("Emphasis", {
245
- children: Schema.Array(InlineNodeBase)
246
- }) {}
247
-
248
- /**
249
- * Hyperlink with optional title.
250
- *
251
- * @example
252
- * ```typescript
253
- * import { Link, Text } from "@knpkv/confluence-to-markdown/ast"
254
- *
255
- * const link = new Link({
256
- * href: "https://example.com",
257
- * title: "Example",
258
- * children: [new Text({ value: "Click here" })]
259
- * })
260
- * ```
261
- *
262
- * @category InlineNode
263
- */
264
- export class Link extends Schema.TaggedClass<Link>()("Link", {
265
- href: Schema.String,
266
- title: Schema.optional(Schema.String),
267
- children: Schema.Array(InlineNodeBase),
268
- rawConfluence: RawConfluence
269
- }) {}
270
-
271
- /**
272
- * Union of all inline node types.
273
- *
274
- * @category InlineNode
275
- */
276
- export const InlineNode = Schema.Union(
277
- Text,
278
- Strong,
279
- Emphasis,
280
- InlineCode,
281
- Link,
282
- LineBreak,
283
- Emoticon,
284
- UserMention,
285
- DateTime,
286
- Underline,
287
- Subscript,
288
- Superscript,
289
- Strikethrough,
290
- ColoredText,
291
- Highlight,
292
- UnsupportedInline
293
- )
294
-
295
- /**
296
- * Type for inline nodes.
297
- *
298
- * @category Types
299
- */
300
- export type InlineNode =
301
- | Text
302
- | Strong
303
- | Emphasis
304
- | InlineCode
305
- | Link
306
- | LineBreak
307
- | Emoticon
308
- | UserMention
309
- | DateTime
310
- | Underline
311
- | Subscript
312
- | Superscript
313
- | Strikethrough
314
- | ColoredText
315
- | Highlight
316
- | UnsupportedInline
317
-
318
- /**
319
- * Schema type helper for InlineNode.
320
- *
321
- * @category Types
322
- */
323
- export type InlineNodeSchema = typeof InlineNode
@@ -1,245 +0,0 @@
1
- /**
2
- * Confluence macro AST node types.
3
- *
4
- * @module
5
- */
6
- import * as Schema from "effect/Schema"
7
- import {
8
- CodeBlock,
9
- Heading,
10
- Image,
11
- Paragraph,
12
- RawConfluence,
13
- SchemaVersion,
14
- Table,
15
- ThematicBreak,
16
- UnsupportedBlock
17
- } from "./BlockNode.js"
18
-
19
- // Reuse SimpleBlockNode for macro children
20
- const SimpleBlockNode = Schema.Union(
21
- Heading,
22
- Paragraph,
23
- CodeBlock,
24
- ThematicBreak,
25
- Image,
26
- Table,
27
- UnsupportedBlock
28
- )
29
-
30
- /**
31
- * Supported panel type names.
32
- * Single source of truth for all panel macros.
33
- *
34
- * @category MacroNode
35
- */
36
- export const PanelTypes = ["info", "warning", "note", "tip", "error", "panel"] as const
37
-
38
- /**
39
- * Panel type for info/warning/note macros.
40
- *
41
- * @category MacroNode
42
- */
43
- export const PanelType = Schema.Literal(...PanelTypes)
44
-
45
- /**
46
- * Type for panel type.
47
- *
48
- * @category Types
49
- */
50
- export type PanelType = Schema.Schema.Type<typeof PanelType>
51
-
52
- /**
53
- * Info/Warning/Note panel macro.
54
- *
55
- * Represents Confluence info, warning, note, tip, and error panels.
56
- * In Markdown, rendered as `:::info`, `:::warning`, etc. container syntax.
57
- *
58
- * @example
59
- * ```typescript
60
- * import { InfoPanel, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
61
- *
62
- * const panel = {
63
- * _tag: "InfoPanel" as const,
64
- * panelType: "warning" as const,
65
- * title: "Important",
66
- * children: [new Paragraph({ children: [new Text({ value: "Be careful!" })] })]
67
- * }
68
- * ```
69
- *
70
- * @category MacroNode
71
- */
72
- export const InfoPanel = Schema.Struct({
73
- _tag: Schema.Literal("InfoPanel"),
74
- version: SchemaVersion,
75
- panelType: PanelType,
76
- title: Schema.optional(Schema.String),
77
- children: Schema.Array(SimpleBlockNode),
78
- rawConfluence: RawConfluence
79
- })
80
-
81
- /**
82
- * Type for InfoPanel.
83
- *
84
- * @category Types
85
- */
86
- export type InfoPanel = Schema.Schema.Type<typeof InfoPanel>
87
-
88
- /**
89
- * Expand/collapse macro.
90
- *
91
- * Represents Confluence expand macro for collapsible content.
92
- * In Markdown, rendered as `:::details` container syntax.
93
- *
94
- * @example
95
- * ```typescript
96
- * import { ExpandMacro, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
97
- *
98
- * const expand = {
99
- * _tag: "ExpandMacro" as const,
100
- * title: "Click to expand",
101
- * children: [new Paragraph({ children: [new Text({ value: "Hidden content" })] })]
102
- * }
103
- * ```
104
- *
105
- * @category MacroNode
106
- */
107
- export const ExpandMacro = Schema.Struct({
108
- _tag: Schema.Literal("ExpandMacro"),
109
- version: SchemaVersion,
110
- title: Schema.optional(Schema.String),
111
- children: Schema.Array(SimpleBlockNode),
112
- rawConfluence: RawConfluence
113
- })
114
-
115
- /**
116
- * Type for ExpandMacro.
117
- *
118
- * @category Types
119
- */
120
- export type ExpandMacro = Schema.Schema.Type<typeof ExpandMacro>
121
-
122
- /**
123
- * Table of contents macro.
124
- *
125
- * Represents Confluence TOC macro for auto-generated table of contents.
126
- * In Markdown, rendered as `[[toc]]` or similar marker.
127
- *
128
- * @example
129
- * ```typescript
130
- * import { TocMacro } from "@knpkv/confluence-to-markdown/ast"
131
- *
132
- * const toc = {
133
- * _tag: "TocMacro" as const,
134
- * minLevel: 2,
135
- * maxLevel: 4
136
- * }
137
- * ```
138
- *
139
- * @category MacroNode
140
- */
141
- export const TocMacro = Schema.Struct({
142
- _tag: Schema.Literal("TocMacro"),
143
- version: SchemaVersion,
144
- minLevel: Schema.optional(Schema.Number),
145
- maxLevel: Schema.optional(Schema.Number),
146
- rawConfluence: RawConfluence
147
- })
148
-
149
- /**
150
- * Type for TocMacro.
151
- *
152
- * @category Types
153
- */
154
- export type TocMacro = Schema.Schema.Type<typeof TocMacro>
155
-
156
- /**
157
- * Code macro with syntax highlighting.
158
- *
159
- * Represents Confluence code macro with language and options.
160
- * Different from CodeBlock in that it preserves Confluence-specific options.
161
- *
162
- * @example
163
- * ```typescript
164
- * import { CodeMacro } from "@knpkv/confluence-to-markdown/ast"
165
- *
166
- * const code = {
167
- * _tag: "CodeMacro" as const,
168
- * language: "typescript",
169
- * title: "Example",
170
- * code: "const x = 1",
171
- * lineNumbers: true
172
- * }
173
- * ```
174
- *
175
- * @category MacroNode
176
- */
177
- export const CodeMacro = Schema.Struct({
178
- _tag: Schema.Literal("CodeMacro"),
179
- version: SchemaVersion,
180
- language: Schema.optional(Schema.String),
181
- title: Schema.optional(Schema.String),
182
- code: Schema.String,
183
- lineNumbers: Schema.optionalWith(Schema.Boolean, { default: () => false }),
184
- collapse: Schema.optionalWith(Schema.Boolean, { default: () => false }),
185
- firstLine: Schema.optional(Schema.Number),
186
- rawConfluence: RawConfluence
187
- })
188
-
189
- /**
190
- * Type for CodeMacro.
191
- *
192
- * @category Types
193
- */
194
- export type CodeMacro = Schema.Schema.Type<typeof CodeMacro>
195
-
196
- /**
197
- * Status macro (colored label).
198
- *
199
- * @example
200
- * ```typescript
201
- * import { StatusMacro } from "@knpkv/confluence-to-markdown/ast"
202
- *
203
- * const status = {
204
- * _tag: "StatusMacro" as const,
205
- * text: "In Progress",
206
- * color: "Blue"
207
- * }
208
- * ```
209
- *
210
- * @category MacroNode
211
- */
212
- export const StatusMacro = Schema.Struct({
213
- _tag: Schema.Literal("StatusMacro"),
214
- version: SchemaVersion,
215
- text: Schema.String,
216
- color: Schema.Literal("Grey", "Red", "Yellow", "Green", "Blue"),
217
- rawConfluence: RawConfluence
218
- })
219
-
220
- /**
221
- * Type for StatusMacro.
222
- *
223
- * @category Types
224
- */
225
- export type StatusMacro = Schema.Schema.Type<typeof StatusMacro>
226
-
227
- /**
228
- * Union of all macro node types.
229
- *
230
- * @category MacroNode
231
- */
232
- export const MacroNode = Schema.Union(
233
- InfoPanel,
234
- ExpandMacro,
235
- TocMacro,
236
- CodeMacro,
237
- StatusMacro
238
- )
239
-
240
- /**
241
- * Type for macro nodes.
242
- *
243
- * @category Types
244
- */
245
- export type MacroNode = InfoPanel | ExpandMacro | TocMacro | CodeMacro | StatusMacro
package/src/ast/index.ts DELETED
@@ -1,83 +0,0 @@
1
- /**
2
- * AST node types for Confluence <-> Markdown conversion.
3
- *
4
- * @module
5
- */
6
-
7
- // Inline nodes
8
- export {
9
- ColoredText,
10
- DateTime,
11
- Emoticon,
12
- Emphasis,
13
- Highlight,
14
- InlineCode,
15
- InlineNode,
16
- type InlineNode as InlineNodeType,
17
- LineBreak,
18
- Link,
19
- Strikethrough,
20
- Strong,
21
- Subscript,
22
- Superscript,
23
- Text,
24
- Underline,
25
- UnsupportedInline,
26
- UserMention
27
- } from "./InlineNode.js"
28
-
29
- // Block nodes
30
- export {
31
- BlockNode,
32
- type BlockNode as BlockNodeType,
33
- BlockQuote,
34
- CodeBlock,
35
- Heading,
36
- Image,
37
- ImageAttachment,
38
- type ImageAttachment as ImageAttachmentType,
39
- List,
40
- ListItem,
41
- Paragraph,
42
- SchemaVersion,
43
- Table,
44
- TableCell,
45
- TableRow,
46
- TaskItem,
47
- type TaskItem as TaskItemType,
48
- TaskList,
49
- type TaskList as TaskListType,
50
- TextAlignment,
51
- type TextAlignment as TextAlignmentValue,
52
- ThematicBreak,
53
- UnsupportedBlock
54
- } from "./BlockNode.js"
55
-
56
- // Macro nodes
57
- export {
58
- CodeMacro,
59
- type CodeMacro as CodeMacroType,
60
- ExpandMacro,
61
- type ExpandMacro as ExpandMacroType,
62
- InfoPanel,
63
- type InfoPanel as InfoPanelType,
64
- MacroNode,
65
- type MacroNode as MacroNodeType,
66
- PanelType,
67
- type PanelType as PanelTypeValue,
68
- PanelTypes,
69
- StatusMacro,
70
- type StatusMacro as StatusMacroType,
71
- TocMacro,
72
- type TocMacro as TocMacroType
73
- } from "./MacroNode.js"
74
-
75
- // Document
76
- export {
77
- Document,
78
- type Document as DocumentType,
79
- DocumentNode,
80
- type DocumentNode as DocumentNodeType,
81
- isDocument,
82
- makeDocument
83
- } from "./Document.js"