@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.
- package/CHANGELOG.md +60 -0
- package/LICENSE +21 -0
- package/README.md +282 -14
- package/dist/ConfluenceAuth.d.ts +76 -0
- package/dist/ConfluenceAuth.d.ts.map +1 -0
- package/dist/ConfluenceAuth.js +356 -0
- package/dist/ConfluenceAuth.js.map +1 -0
- package/dist/ConfluenceClient.d.ts +26 -2
- package/dist/ConfluenceClient.d.ts.map +1 -1
- package/dist/ConfluenceClient.js +98 -92
- package/dist/ConfluenceClient.js.map +1 -1
- package/dist/ConfluenceConfig.d.ts +4 -24
- package/dist/ConfluenceConfig.d.ts.map +1 -1
- package/dist/ConfluenceConfig.js +45 -7
- package/dist/ConfluenceConfig.js.map +1 -1
- package/dist/ConfluenceError.d.ts +89 -6
- package/dist/ConfluenceError.d.ts.map +1 -1
- package/dist/ConfluenceError.js +88 -5
- package/dist/ConfluenceError.js.map +1 -1
- package/dist/GitError.d.ts +103 -0
- package/dist/GitError.d.ts.map +1 -0
- package/dist/GitError.js +85 -0
- package/dist/GitError.js.map +1 -0
- package/dist/GitService.d.ts +175 -0
- package/dist/GitService.d.ts.map +1 -0
- package/dist/GitService.js +431 -0
- package/dist/GitService.js.map +1 -0
- package/dist/LocalFileSystem.d.ts +29 -4
- package/dist/LocalFileSystem.d.ts.map +1 -1
- package/dist/LocalFileSystem.js +80 -6
- package/dist/LocalFileSystem.js.map +1 -1
- package/dist/MarkdownConverter.d.ts +49 -2
- package/dist/MarkdownConverter.d.ts.map +1 -1
- package/dist/MarkdownConverter.js +73 -111
- package/dist/MarkdownConverter.js.map +1 -1
- package/dist/SchemaConverterError.d.ts +108 -0
- package/dist/SchemaConverterError.d.ts.map +1 -0
- package/dist/SchemaConverterError.js +84 -0
- package/dist/SchemaConverterError.js.map +1 -0
- package/dist/Schemas.d.ts +225 -1
- package/dist/Schemas.d.ts.map +1 -1
- package/dist/Schemas.js +155 -6
- package/dist/Schemas.js.map +1 -1
- package/dist/SyncEngine.d.ts +30 -20
- package/dist/SyncEngine.d.ts.map +1 -1
- package/dist/SyncEngine.js +566 -117
- package/dist/SyncEngine.js.map +1 -1
- package/dist/ast/BlockNode.d.ts +468 -0
- package/dist/ast/BlockNode.d.ts.map +1 -0
- package/dist/ast/BlockNode.js +319 -0
- package/dist/ast/BlockNode.js.map +1 -0
- package/dist/ast/Document.d.ts +244 -0
- package/dist/ast/Document.d.ts.map +1 -0
- package/dist/ast/Document.js +69 -0
- package/dist/ast/Document.js.map +1 -0
- package/dist/ast/InlineNode.d.ts +477 -0
- package/dist/ast/InlineNode.d.ts.map +1 -0
- package/dist/ast/InlineNode.js +263 -0
- package/dist/ast/InlineNode.js.map +1 -0
- package/dist/ast/MacroNode.d.ts +267 -0
- package/dist/ast/MacroNode.d.ts.map +1 -0
- package/dist/ast/MacroNode.js +164 -0
- package/dist/ast/MacroNode.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +14 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/bin.js +33 -149
- package/dist/bin.js.map +1 -1
- package/dist/commands/auth.d.ts +15 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +86 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/clone.d.ts +12 -0
- package/dist/commands/clone.d.ts.map +1 -0
- package/dist/commands/clone.js +93 -0
- package/dist/commands/clone.js.map +1 -0
- package/dist/commands/delete.d.ts +13 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +48 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/errorHandler.d.ts +14 -0
- package/dist/commands/errorHandler.d.ts.map +1 -0
- package/dist/commands/errorHandler.js +33 -0
- package/dist/commands/errorHandler.js.map +1 -0
- package/dist/commands/git.d.ts +22 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +72 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/index.d.ts +11 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +11 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/layers.d.ts +31 -0
- package/dist/commands/layers.d.ts.map +1 -0
- package/dist/commands/layers.js +137 -0
- package/dist/commands/layers.js.map +1 -0
- package/dist/commands/new.d.ts +9 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +80 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/pageTree.d.ts +18 -0
- package/dist/commands/pageTree.d.ts.map +1 -0
- package/dist/commands/pageTree.js +20 -0
- package/dist/commands/pageTree.js.map +1 -0
- package/dist/commands/shared.d.ts +15 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +27 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/sync.d.ts +15 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +101 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/NodeLayers.d.ts +7 -0
- package/dist/internal/NodeLayers.d.ts.map +1 -0
- package/dist/internal/NodeLayers.js +19 -0
- package/dist/internal/NodeLayers.js.map +1 -0
- package/dist/internal/frontmatter.d.ts +10 -0
- package/dist/internal/frontmatter.d.ts.map +1 -1
- package/dist/internal/frontmatter.js +16 -0
- package/dist/internal/frontmatter.js.map +1 -1
- package/dist/internal/gitCommands.d.ts +78 -0
- package/dist/internal/gitCommands.d.ts.map +1 -0
- package/dist/internal/gitCommands.js +156 -0
- package/dist/internal/gitCommands.js.map +1 -0
- package/dist/internal/hashUtils.d.ts +42 -1
- package/dist/internal/hashUtils.d.ts.map +1 -1
- package/dist/internal/hashUtils.js +38 -2
- package/dist/internal/hashUtils.js.map +1 -1
- package/dist/internal/oauthServer.d.ts +55 -0
- package/dist/internal/oauthServer.d.ts.map +1 -0
- package/dist/internal/oauthServer.js +110 -0
- package/dist/internal/oauthServer.js.map +1 -0
- package/dist/internal/pathUtils.d.ts +21 -4
- package/dist/internal/pathUtils.d.ts.map +1 -1
- package/dist/internal/pathUtils.js +24 -13
- package/dist/internal/pathUtils.js.map +1 -1
- package/dist/internal/tokenStorage.d.ts +75 -0
- package/dist/internal/tokenStorage.d.ts.map +1 -0
- package/dist/internal/tokenStorage.js +149 -0
- package/dist/internal/tokenStorage.js.map +1 -0
- package/dist/internal/userCache.d.ts +42 -0
- package/dist/internal/userCache.d.ts.map +1 -0
- package/dist/internal/userCache.js +51 -0
- package/dist/internal/userCache.js.map +1 -0
- package/dist/parsers/ConfluenceParser.d.ts +26 -0
- package/dist/parsers/ConfluenceParser.d.ts.map +1 -0
- package/dist/parsers/ConfluenceParser.js +792 -0
- package/dist/parsers/ConfluenceParser.js.map +1 -0
- package/dist/parsers/MarkdownParser.d.ts +26 -0
- package/dist/parsers/MarkdownParser.d.ts.map +1 -0
- package/dist/parsers/MarkdownParser.js +873 -0
- package/dist/parsers/MarkdownParser.js.map +1 -0
- package/dist/parsers/index.d.ts +8 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +8 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/schemas/ConfluenceSchema.d.ts +21 -0
- package/dist/schemas/ConfluenceSchema.d.ts.map +1 -0
- package/dist/schemas/ConfluenceSchema.js +38 -0
- package/dist/schemas/ConfluenceSchema.js.map +1 -0
- package/dist/schemas/ConversionSchema.d.ts +35 -0
- package/dist/schemas/ConversionSchema.d.ts.map +1 -0
- package/dist/schemas/ConversionSchema.js +208 -0
- package/dist/schemas/ConversionSchema.js.map +1 -0
- package/dist/schemas/MarkdownSchema.d.ts +21 -0
- package/dist/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/schemas/MarkdownSchema.js +38 -0
- package/dist/schemas/MarkdownSchema.js.map +1 -0
- package/dist/schemas/hast/HastFromHtml.d.ts +27 -0
- package/dist/schemas/hast/HastFromHtml.d.ts.map +1 -0
- package/dist/schemas/hast/HastFromHtml.js +107 -0
- package/dist/schemas/hast/HastFromHtml.js.map +1 -0
- package/dist/schemas/hast/HastSchema.d.ts +195 -0
- package/dist/schemas/hast/HastSchema.d.ts.map +1 -0
- package/dist/schemas/hast/HastSchema.js +183 -0
- package/dist/schemas/hast/HastSchema.js.map +1 -0
- package/dist/schemas/hast/index.d.ts +9 -0
- package/dist/schemas/hast/index.d.ts.map +1 -0
- package/dist/schemas/hast/index.js +3 -0
- package/dist/schemas/hast/index.js.map +1 -0
- package/dist/schemas/index.d.ts +14 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +16 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/mdast/MdastFromMarkdown.d.ts +30 -0
- package/dist/schemas/mdast/MdastFromMarkdown.d.ts.map +1 -0
- package/dist/schemas/mdast/MdastFromMarkdown.js +79 -0
- package/dist/schemas/mdast/MdastFromMarkdown.js.map +1 -0
- package/dist/schemas/mdast/MdastSchema.d.ts +385 -0
- package/dist/schemas/mdast/MdastSchema.d.ts.map +1 -0
- package/dist/schemas/mdast/MdastSchema.js +266 -0
- package/dist/schemas/mdast/MdastSchema.js.map +1 -0
- package/dist/schemas/mdast/index.d.ts +10 -0
- package/dist/schemas/mdast/index.d.ts.map +1 -0
- package/dist/schemas/mdast/index.js +4 -0
- package/dist/schemas/mdast/index.js.map +1 -0
- package/dist/schemas/mdast/mdastToString.d.ts +13 -0
- package/dist/schemas/mdast/mdastToString.d.ts.map +1 -0
- package/dist/schemas/mdast/mdastToString.js +85 -0
- package/dist/schemas/mdast/mdastToString.js.map +1 -0
- package/dist/schemas/nodes/block/BlockSchema.d.ts +43 -0
- package/dist/schemas/nodes/block/BlockSchema.d.ts.map +1 -0
- package/dist/schemas/nodes/block/BlockSchema.js +634 -0
- package/dist/schemas/nodes/block/BlockSchema.js.map +1 -0
- package/dist/schemas/nodes/block/index.d.ts +7 -0
- package/dist/schemas/nodes/block/index.d.ts.map +1 -0
- package/dist/schemas/nodes/block/index.js +7 -0
- package/dist/schemas/nodes/block/index.js.map +1 -0
- package/dist/schemas/nodes/index.d.ts +9 -0
- package/dist/schemas/nodes/index.d.ts.map +1 -0
- package/dist/schemas/nodes/index.js +12 -0
- package/dist/schemas/nodes/index.js.map +1 -0
- package/dist/schemas/nodes/inline/InlineSchema.d.ts +48 -0
- package/dist/schemas/nodes/inline/InlineSchema.d.ts.map +1 -0
- package/dist/schemas/nodes/inline/InlineSchema.js +436 -0
- package/dist/schemas/nodes/inline/InlineSchema.js.map +1 -0
- package/dist/schemas/nodes/inline/index.d.ts +7 -0
- package/dist/schemas/nodes/inline/index.d.ts.map +1 -0
- package/dist/schemas/nodes/inline/index.js +7 -0
- package/dist/schemas/nodes/inline/index.js.map +1 -0
- package/dist/schemas/nodes/macro/MacroSchema.d.ts +27 -0
- package/dist/schemas/nodes/macro/MacroSchema.d.ts.map +1 -0
- package/dist/schemas/nodes/macro/MacroSchema.js +162 -0
- package/dist/schemas/nodes/macro/MacroSchema.js.map +1 -0
- package/dist/schemas/nodes/macro/index.d.ts +7 -0
- package/dist/schemas/nodes/macro/index.d.ts.map +1 -0
- package/dist/schemas/nodes/macro/index.js +7 -0
- package/dist/schemas/nodes/macro/index.js.map +1 -0
- package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts +24 -0
- package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts.map +1 -0
- package/dist/schemas/preprocessing/ConfluencePreprocessor.js +351 -0
- package/dist/schemas/preprocessing/ConfluencePreprocessor.js.map +1 -0
- package/dist/schemas/preprocessing/index.d.ts +8 -0
- package/dist/schemas/preprocessing/index.d.ts.map +1 -0
- package/dist/schemas/preprocessing/index.js +2 -0
- package/dist/schemas/preprocessing/index.js.map +1 -0
- package/dist/serializers/ConfluenceSerializer.d.ts +30 -0
- package/dist/serializers/ConfluenceSerializer.d.ts.map +1 -0
- package/dist/serializers/ConfluenceSerializer.js +551 -0
- package/dist/serializers/ConfluenceSerializer.js.map +1 -0
- package/dist/serializers/MarkdownSerializer.d.ts +34 -0
- package/dist/serializers/MarkdownSerializer.d.ts.map +1 -0
- package/dist/serializers/MarkdownSerializer.js +355 -0
- package/dist/serializers/MarkdownSerializer.js.map +1 -0
- package/dist/serializers/index.d.ts +8 -0
- package/dist/serializers/index.d.ts.map +1 -0
- package/dist/serializers/index.js +8 -0
- package/dist/serializers/index.js.map +1 -0
- package/package.json +27 -16
- package/src/ConfluenceAuth.ts +571 -0
- package/src/ConfluenceClient.ts +188 -156
- package/src/ConfluenceConfig.ts +63 -7
- package/src/ConfluenceError.ts +110 -14
- package/src/GitError.ts +92 -0
- package/src/GitService.ts +859 -0
- package/src/LocalFileSystem.ts +179 -9
- package/src/MarkdownConverter.ts +126 -122
- package/src/SchemaConverterError.ts +108 -0
- package/src/Schemas.ts +223 -6
- package/src/SyncEngine.ts +745 -162
- package/src/ast/BlockNode.ts +425 -0
- package/src/ast/Document.ts +90 -0
- package/src/ast/InlineNode.ts +323 -0
- package/src/ast/MacroNode.ts +245 -0
- package/src/ast/index.ts +83 -0
- package/src/bin.ts +50 -249
- package/src/commands/auth.ts +117 -0
- package/src/commands/clone.ts +145 -0
- package/src/commands/delete.ts +57 -0
- package/src/commands/errorHandler.ts +32 -0
- package/src/commands/git.ts +114 -0
- package/src/commands/index.ts +10 -0
- package/src/commands/layers.ts +211 -0
- package/src/commands/new.ts +99 -0
- package/src/commands/pageTree.ts +40 -0
- package/src/commands/shared.ts +35 -0
- package/src/commands/sync.ts +129 -0
- package/src/index.ts +21 -1
- package/src/internal/NodeLayers.ts +21 -0
- package/src/internal/frontmatter.ts +21 -0
- package/src/internal/gitCommands.ts +229 -0
- package/src/internal/hashUtils.ts +65 -3
- package/src/internal/oauthServer.ts +199 -0
- package/src/internal/pathUtils.ts +34 -17
- package/src/internal/tokenStorage.ts +240 -0
- package/src/internal/userCache.ts +90 -0
- package/src/parsers/ConfluenceParser.ts +950 -0
- package/src/parsers/MarkdownParser.ts +1198 -0
- package/src/parsers/index.ts +8 -0
- package/src/schemas/ConfluenceSchema.ts +56 -0
- package/src/schemas/ConversionSchema.ts +318 -0
- package/src/schemas/MarkdownSchema.ts +56 -0
- package/src/schemas/hast/HastFromHtml.ts +153 -0
- package/src/schemas/hast/HastSchema.ts +274 -0
- package/src/schemas/hast/index.ts +35 -0
- package/src/schemas/index.ts +20 -0
- package/src/schemas/mdast/MdastFromMarkdown.ts +118 -0
- package/src/schemas/mdast/MdastSchema.ts +566 -0
- package/src/schemas/mdast/index.ts +59 -0
- package/src/schemas/mdast/mdastToString.ts +102 -0
- package/src/schemas/nodes/block/BlockSchema.ts +773 -0
- package/src/schemas/nodes/block/index.ts +13 -0
- package/src/schemas/nodes/index.ts +20 -0
- package/src/schemas/nodes/inline/InlineSchema.ts +523 -0
- package/src/schemas/nodes/inline/index.ts +14 -0
- package/src/schemas/nodes/macro/MacroSchema.ts +226 -0
- package/src/schemas/nodes/macro/index.ts +6 -0
- package/src/schemas/preprocessing/ConfluencePreprocessor.ts +446 -0
- package/src/schemas/preprocessing/index.ts +8 -0
- package/src/serializers/ConfluenceSerializer.ts +717 -0
- package/src/serializers/MarkdownSerializer.ts +493 -0
- package/src/serializers/index.ts +8 -0
- package/test/GitService.test.ts +209 -0
- package/test/MarkdownConverter.test.ts +37 -3
- package/test/Schemas.test.ts +97 -2
- package/test/ast/BlockNode.test.ts +265 -0
- package/test/ast/Document.test.ts +126 -0
- package/test/ast/InlineNode.test.ts +161 -0
- package/test/fixtures/integration-test.html.fixture +103 -0
- package/test/fixtures/integration-test.md.expected +257 -0
- package/test/integration.test.ts +269 -0
- package/test/oauthServer.test.ts +50 -0
- package/test/parsers/ConfluenceParser.test.ts +283 -0
- package/test/schemas/ConfluencePreprocessor.test.ts +180 -0
- package/test/schemas/ConversionSchema.test.ts +159 -0
- package/test/schemas/HastSchema.test.ts +138 -0
- package/test/schemas/MdastSchema.test.ts +145 -0
- package/test/schemas/nodes/block/BlockSchema.test.ts +173 -0
- package/test/schemas/nodes/inline/InlineSchema.test.ts +198 -0
- package/test/schemas/nodes/macro/MacroSchema.test.ts +142 -0
- package/test/tokenStorage.test.ts +99 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline AST node types for text-level content.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
/**
|
|
8
|
+
* Optional raw Confluence HTML for exact roundtrip preservation.
|
|
9
|
+
* When present, the Confluence serializer will output this instead of reconstructing.
|
|
10
|
+
*
|
|
11
|
+
* @category InlineNode
|
|
12
|
+
*/
|
|
13
|
+
export const RawConfluence = Schema.optional(Schema.String);
|
|
14
|
+
/**
|
|
15
|
+
* Plain text content.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { Text } from "@knpkv/confluence-to-markdown/ast"
|
|
20
|
+
*
|
|
21
|
+
* const text = new Text({ value: "Hello world" })
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category InlineNode
|
|
25
|
+
*/
|
|
26
|
+
export class Text extends Schema.TaggedClass()("Text", {
|
|
27
|
+
value: Schema.String
|
|
28
|
+
}) {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Inline code span.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { InlineCode } from "@knpkv/confluence-to-markdown/ast"
|
|
36
|
+
*
|
|
37
|
+
* const code = new InlineCode({ value: "const x = 1" })
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @category InlineNode
|
|
41
|
+
*/
|
|
42
|
+
export class InlineCode extends Schema.TaggedClass()("InlineCode", {
|
|
43
|
+
value: Schema.String
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Line break element.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { LineBreak } from "@knpkv/confluence-to-markdown/ast"
|
|
52
|
+
*
|
|
53
|
+
* const br = new LineBreak({})
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @category InlineNode
|
|
57
|
+
*/
|
|
58
|
+
export class LineBreak extends Schema.TaggedClass()("LineBreak", {}) {
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Unsupported inline element - preserves raw content for round-tripping.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { UnsupportedInline } from "@knpkv/confluence-to-markdown/ast"
|
|
66
|
+
*
|
|
67
|
+
* const unknown = new UnsupportedInline({
|
|
68
|
+
* raw: "<custom-tag>content</custom-tag>",
|
|
69
|
+
* source: "confluence"
|
|
70
|
+
* })
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @category InlineNode
|
|
74
|
+
*/
|
|
75
|
+
export class UnsupportedInline extends Schema.TaggedClass()("UnsupportedInline", {
|
|
76
|
+
raw: Schema.String,
|
|
77
|
+
source: Schema.Literal("confluence", "markdown")
|
|
78
|
+
}) {
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Emoticon/emoji element.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* import { Emoticon } from "@knpkv/confluence-to-markdown/ast"
|
|
86
|
+
*
|
|
87
|
+
* const emoji = new Emoticon({
|
|
88
|
+
* shortname: ":grinning:",
|
|
89
|
+
* emojiId: "1f600",
|
|
90
|
+
* fallback: "😀"
|
|
91
|
+
* })
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @category InlineNode
|
|
95
|
+
*/
|
|
96
|
+
export class Emoticon extends Schema.TaggedClass()("Emoticon", {
|
|
97
|
+
shortname: Schema.String,
|
|
98
|
+
emojiId: Schema.String,
|
|
99
|
+
fallback: Schema.String,
|
|
100
|
+
rawConfluence: RawConfluence
|
|
101
|
+
}) {
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* User mention element.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* import { UserMention } from "@knpkv/confluence-to-markdown/ast"
|
|
109
|
+
*
|
|
110
|
+
* const mention = new UserMention({ accountId: "557058:..." })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @category InlineNode
|
|
114
|
+
*/
|
|
115
|
+
export class UserMention extends Schema.TaggedClass()("UserMention", {
|
|
116
|
+
accountId: Schema.String,
|
|
117
|
+
rawConfluence: RawConfluence
|
|
118
|
+
}) {
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Date/time element.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* import { DateTime } from "@knpkv/confluence-to-markdown/ast"
|
|
126
|
+
*
|
|
127
|
+
* const date = new DateTime({ datetime: "2026-01-01" })
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @category InlineNode
|
|
131
|
+
*/
|
|
132
|
+
export class DateTime extends Schema.TaggedClass()("DateTime", {
|
|
133
|
+
datetime: Schema.String,
|
|
134
|
+
rawConfluence: RawConfluence
|
|
135
|
+
}) {
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Underlined text.
|
|
139
|
+
*
|
|
140
|
+
* @category InlineNode
|
|
141
|
+
*/
|
|
142
|
+
export class Underline extends Schema.TaggedClass()("Underline", {
|
|
143
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
144
|
+
}) {
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Subscript text.
|
|
148
|
+
*
|
|
149
|
+
* @category InlineNode
|
|
150
|
+
*/
|
|
151
|
+
export class Subscript extends Schema.TaggedClass()("Subscript", {
|
|
152
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
153
|
+
}) {
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Superscript text.
|
|
157
|
+
*
|
|
158
|
+
* @category InlineNode
|
|
159
|
+
*/
|
|
160
|
+
export class Superscript extends Schema.TaggedClass()("Superscript", {
|
|
161
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
162
|
+
}) {
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Strikethrough text.
|
|
166
|
+
*
|
|
167
|
+
* @category InlineNode
|
|
168
|
+
*/
|
|
169
|
+
export class Strikethrough extends Schema.TaggedClass()("Strikethrough", {
|
|
170
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
171
|
+
}) {
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Colored text with CSS color value.
|
|
175
|
+
*
|
|
176
|
+
* @category InlineNode
|
|
177
|
+
*/
|
|
178
|
+
export class ColoredText extends Schema.TaggedClass()("ColoredText", {
|
|
179
|
+
color: Schema.String,
|
|
180
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
181
|
+
}) {
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Highlighted text with background color.
|
|
185
|
+
*
|
|
186
|
+
* @category InlineNode
|
|
187
|
+
*/
|
|
188
|
+
export class Highlight extends Schema.TaggedClass()("Highlight", {
|
|
189
|
+
backgroundColor: Schema.String,
|
|
190
|
+
children: Schema.suspend(() => Schema.Array(InlineNodeBase))
|
|
191
|
+
}) {
|
|
192
|
+
}
|
|
193
|
+
// Forward declaration for recursive types
|
|
194
|
+
// Define InlineNode union schema first (without recursive types)
|
|
195
|
+
const InlineNodeBase = Schema.Union(Text, InlineCode, LineBreak, Emoticon, UserMention, DateTime, UnsupportedInline);
|
|
196
|
+
/**
|
|
197
|
+
* Inline node children schema - use this for recursive inline content.
|
|
198
|
+
*
|
|
199
|
+
* @category InlineNode
|
|
200
|
+
*/
|
|
201
|
+
export const InlineNodeChildren = Schema.suspend(() => Schema.Array(InlineNode));
|
|
202
|
+
/**
|
|
203
|
+
* Strong/bold text.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* import { Strong, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
208
|
+
*
|
|
209
|
+
* const bold = new Strong({ children: [new Text({ value: "important" })] })
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @category InlineNode
|
|
213
|
+
*/
|
|
214
|
+
export class Strong extends Schema.TaggedClass()("Strong", {
|
|
215
|
+
children: Schema.Array(InlineNodeBase)
|
|
216
|
+
}) {
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Emphasized/italic text.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* import { Emphasis, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
224
|
+
*
|
|
225
|
+
* const italic = new Emphasis({ children: [new Text({ value: "emphasized" })] })
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @category InlineNode
|
|
229
|
+
*/
|
|
230
|
+
export class Emphasis extends Schema.TaggedClass()("Emphasis", {
|
|
231
|
+
children: Schema.Array(InlineNodeBase)
|
|
232
|
+
}) {
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Hyperlink with optional title.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* import { Link, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
240
|
+
*
|
|
241
|
+
* const link = new Link({
|
|
242
|
+
* href: "https://example.com",
|
|
243
|
+
* title: "Example",
|
|
244
|
+
* children: [new Text({ value: "Click here" })]
|
|
245
|
+
* })
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @category InlineNode
|
|
249
|
+
*/
|
|
250
|
+
export class Link extends Schema.TaggedClass()("Link", {
|
|
251
|
+
href: Schema.String,
|
|
252
|
+
title: Schema.optional(Schema.String),
|
|
253
|
+
children: Schema.Array(InlineNodeBase),
|
|
254
|
+
rawConfluence: RawConfluence
|
|
255
|
+
}) {
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Union of all inline node types.
|
|
259
|
+
*
|
|
260
|
+
* @category InlineNode
|
|
261
|
+
*/
|
|
262
|
+
export const InlineNode = Schema.Union(Text, Strong, Emphasis, InlineCode, Link, LineBreak, Emoticon, UserMention, DateTime, Underline, Subscript, Superscript, Strikethrough, ColoredText, Highlight, UnsupportedInline);
|
|
263
|
+
//# sourceMappingURL=InlineNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineNode.js","sourceRoot":"","sources":["../../src/ast/InlineNode.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confluence macro AST node types.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { CodeBlock, Heading, Image, Paragraph, Table, ThematicBreak, UnsupportedBlock } from "./BlockNode.js";
|
|
8
|
+
/**
|
|
9
|
+
* Supported panel type names.
|
|
10
|
+
* Single source of truth for all panel macros.
|
|
11
|
+
*
|
|
12
|
+
* @category MacroNode
|
|
13
|
+
*/
|
|
14
|
+
export declare const PanelTypes: readonly ["info", "warning", "note", "tip", "error", "panel"];
|
|
15
|
+
/**
|
|
16
|
+
* Panel type for info/warning/note macros.
|
|
17
|
+
*
|
|
18
|
+
* @category MacroNode
|
|
19
|
+
*/
|
|
20
|
+
export declare const PanelType: Schema.Literal<["info", "warning", "note", "tip", "error", "panel"]>;
|
|
21
|
+
/**
|
|
22
|
+
* Type for panel type.
|
|
23
|
+
*
|
|
24
|
+
* @category Types
|
|
25
|
+
*/
|
|
26
|
+
export type PanelType = Schema.Schema.Type<typeof PanelType>;
|
|
27
|
+
/**
|
|
28
|
+
* Info/Warning/Note panel macro.
|
|
29
|
+
*
|
|
30
|
+
* Represents Confluence info, warning, note, tip, and error panels.
|
|
31
|
+
* In Markdown, rendered as `:::info`, `:::warning`, etc. container syntax.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { InfoPanel, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
36
|
+
*
|
|
37
|
+
* const panel = {
|
|
38
|
+
* _tag: "InfoPanel" as const,
|
|
39
|
+
* panelType: "warning" as const,
|
|
40
|
+
* title: "Important",
|
|
41
|
+
* children: [new Paragraph({ children: [new Text({ value: "Be careful!" })] })]
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @category MacroNode
|
|
46
|
+
*/
|
|
47
|
+
export declare const InfoPanel: Schema.Struct<{
|
|
48
|
+
_tag: Schema.Literal<["InfoPanel"]>;
|
|
49
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
50
|
+
default: () => number;
|
|
51
|
+
}>;
|
|
52
|
+
panelType: Schema.Literal<["info", "warning", "note", "tip", "error", "panel"]>;
|
|
53
|
+
title: Schema.optional<typeof Schema.String>;
|
|
54
|
+
children: Schema.Array$<Schema.Union<[typeof Heading, typeof Paragraph, typeof CodeBlock, typeof ThematicBreak, typeof Image, typeof Table, typeof UnsupportedBlock]>>;
|
|
55
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Type for InfoPanel.
|
|
59
|
+
*
|
|
60
|
+
* @category Types
|
|
61
|
+
*/
|
|
62
|
+
export type InfoPanel = Schema.Schema.Type<typeof InfoPanel>;
|
|
63
|
+
/**
|
|
64
|
+
* Expand/collapse macro.
|
|
65
|
+
*
|
|
66
|
+
* Represents Confluence expand macro for collapsible content.
|
|
67
|
+
* In Markdown, rendered as `:::details` container syntax.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* import { ExpandMacro, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
72
|
+
*
|
|
73
|
+
* const expand = {
|
|
74
|
+
* _tag: "ExpandMacro" as const,
|
|
75
|
+
* title: "Click to expand",
|
|
76
|
+
* children: [new Paragraph({ children: [new Text({ value: "Hidden content" })] })]
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @category MacroNode
|
|
81
|
+
*/
|
|
82
|
+
export declare const ExpandMacro: Schema.Struct<{
|
|
83
|
+
_tag: Schema.Literal<["ExpandMacro"]>;
|
|
84
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
85
|
+
default: () => number;
|
|
86
|
+
}>;
|
|
87
|
+
title: Schema.optional<typeof Schema.String>;
|
|
88
|
+
children: Schema.Array$<Schema.Union<[typeof Heading, typeof Paragraph, typeof CodeBlock, typeof ThematicBreak, typeof Image, typeof Table, typeof UnsupportedBlock]>>;
|
|
89
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Type for ExpandMacro.
|
|
93
|
+
*
|
|
94
|
+
* @category Types
|
|
95
|
+
*/
|
|
96
|
+
export type ExpandMacro = Schema.Schema.Type<typeof ExpandMacro>;
|
|
97
|
+
/**
|
|
98
|
+
* Table of contents macro.
|
|
99
|
+
*
|
|
100
|
+
* Represents Confluence TOC macro for auto-generated table of contents.
|
|
101
|
+
* In Markdown, rendered as `[[toc]]` or similar marker.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import { TocMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
106
|
+
*
|
|
107
|
+
* const toc = {
|
|
108
|
+
* _tag: "TocMacro" as const,
|
|
109
|
+
* minLevel: 2,
|
|
110
|
+
* maxLevel: 4
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @category MacroNode
|
|
115
|
+
*/
|
|
116
|
+
export declare const TocMacro: Schema.Struct<{
|
|
117
|
+
_tag: Schema.Literal<["TocMacro"]>;
|
|
118
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
119
|
+
default: () => number;
|
|
120
|
+
}>;
|
|
121
|
+
minLevel: Schema.optional<typeof Schema.Number>;
|
|
122
|
+
maxLevel: Schema.optional<typeof Schema.Number>;
|
|
123
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Type for TocMacro.
|
|
127
|
+
*
|
|
128
|
+
* @category Types
|
|
129
|
+
*/
|
|
130
|
+
export type TocMacro = Schema.Schema.Type<typeof TocMacro>;
|
|
131
|
+
/**
|
|
132
|
+
* Code macro with syntax highlighting.
|
|
133
|
+
*
|
|
134
|
+
* Represents Confluence code macro with language and options.
|
|
135
|
+
* Different from CodeBlock in that it preserves Confluence-specific options.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* import { CodeMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
140
|
+
*
|
|
141
|
+
* const code = {
|
|
142
|
+
* _tag: "CodeMacro" as const,
|
|
143
|
+
* language: "typescript",
|
|
144
|
+
* title: "Example",
|
|
145
|
+
* code: "const x = 1",
|
|
146
|
+
* lineNumbers: true
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @category MacroNode
|
|
151
|
+
*/
|
|
152
|
+
export declare const CodeMacro: Schema.Struct<{
|
|
153
|
+
_tag: Schema.Literal<["CodeMacro"]>;
|
|
154
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
155
|
+
default: () => number;
|
|
156
|
+
}>;
|
|
157
|
+
language: Schema.optional<typeof Schema.String>;
|
|
158
|
+
title: Schema.optional<typeof Schema.String>;
|
|
159
|
+
code: typeof Schema.String;
|
|
160
|
+
lineNumbers: Schema.optionalWith<typeof Schema.Boolean, {
|
|
161
|
+
default: () => false;
|
|
162
|
+
}>;
|
|
163
|
+
collapse: Schema.optionalWith<typeof Schema.Boolean, {
|
|
164
|
+
default: () => false;
|
|
165
|
+
}>;
|
|
166
|
+
firstLine: Schema.optional<typeof Schema.Number>;
|
|
167
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* Type for CodeMacro.
|
|
171
|
+
*
|
|
172
|
+
* @category Types
|
|
173
|
+
*/
|
|
174
|
+
export type CodeMacro = Schema.Schema.Type<typeof CodeMacro>;
|
|
175
|
+
/**
|
|
176
|
+
* Status macro (colored label).
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* import { StatusMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
181
|
+
*
|
|
182
|
+
* const status = {
|
|
183
|
+
* _tag: "StatusMacro" as const,
|
|
184
|
+
* text: "In Progress",
|
|
185
|
+
* color: "Blue"
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @category MacroNode
|
|
190
|
+
*/
|
|
191
|
+
export declare const StatusMacro: Schema.Struct<{
|
|
192
|
+
_tag: Schema.Literal<["StatusMacro"]>;
|
|
193
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
194
|
+
default: () => number;
|
|
195
|
+
}>;
|
|
196
|
+
text: typeof Schema.String;
|
|
197
|
+
color: Schema.Literal<["Grey", "Red", "Yellow", "Green", "Blue"]>;
|
|
198
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
199
|
+
}>;
|
|
200
|
+
/**
|
|
201
|
+
* Type for StatusMacro.
|
|
202
|
+
*
|
|
203
|
+
* @category Types
|
|
204
|
+
*/
|
|
205
|
+
export type StatusMacro = Schema.Schema.Type<typeof StatusMacro>;
|
|
206
|
+
/**
|
|
207
|
+
* Union of all macro node types.
|
|
208
|
+
*
|
|
209
|
+
* @category MacroNode
|
|
210
|
+
*/
|
|
211
|
+
export declare const MacroNode: Schema.Union<[Schema.Struct<{
|
|
212
|
+
_tag: Schema.Literal<["InfoPanel"]>;
|
|
213
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
214
|
+
default: () => number;
|
|
215
|
+
}>;
|
|
216
|
+
panelType: Schema.Literal<["info", "warning", "note", "tip", "error", "panel"]>;
|
|
217
|
+
title: Schema.optional<typeof Schema.String>;
|
|
218
|
+
children: Schema.Array$<Schema.Union<[typeof Heading, typeof Paragraph, typeof CodeBlock, typeof ThematicBreak, typeof Image, typeof Table, typeof UnsupportedBlock]>>;
|
|
219
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
220
|
+
}>, Schema.Struct<{
|
|
221
|
+
_tag: Schema.Literal<["ExpandMacro"]>;
|
|
222
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
223
|
+
default: () => number;
|
|
224
|
+
}>;
|
|
225
|
+
title: Schema.optional<typeof Schema.String>;
|
|
226
|
+
children: Schema.Array$<Schema.Union<[typeof Heading, typeof Paragraph, typeof CodeBlock, typeof ThematicBreak, typeof Image, typeof Table, typeof UnsupportedBlock]>>;
|
|
227
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
228
|
+
}>, Schema.Struct<{
|
|
229
|
+
_tag: Schema.Literal<["TocMacro"]>;
|
|
230
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
231
|
+
default: () => number;
|
|
232
|
+
}>;
|
|
233
|
+
minLevel: Schema.optional<typeof Schema.Number>;
|
|
234
|
+
maxLevel: Schema.optional<typeof Schema.Number>;
|
|
235
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
236
|
+
}>, Schema.Struct<{
|
|
237
|
+
_tag: Schema.Literal<["CodeMacro"]>;
|
|
238
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
239
|
+
default: () => number;
|
|
240
|
+
}>;
|
|
241
|
+
language: Schema.optional<typeof Schema.String>;
|
|
242
|
+
title: Schema.optional<typeof Schema.String>;
|
|
243
|
+
code: typeof Schema.String;
|
|
244
|
+
lineNumbers: Schema.optionalWith<typeof Schema.Boolean, {
|
|
245
|
+
default: () => false;
|
|
246
|
+
}>;
|
|
247
|
+
collapse: Schema.optionalWith<typeof Schema.Boolean, {
|
|
248
|
+
default: () => false;
|
|
249
|
+
}>;
|
|
250
|
+
firstLine: Schema.optional<typeof Schema.Number>;
|
|
251
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
252
|
+
}>, Schema.Struct<{
|
|
253
|
+
_tag: Schema.Literal<["StatusMacro"]>;
|
|
254
|
+
version: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
255
|
+
default: () => number;
|
|
256
|
+
}>;
|
|
257
|
+
text: typeof Schema.String;
|
|
258
|
+
color: Schema.Literal<["Grey", "Red", "Yellow", "Green", "Blue"]>;
|
|
259
|
+
rawConfluence: Schema.optional<typeof Schema.String>;
|
|
260
|
+
}>]>;
|
|
261
|
+
/**
|
|
262
|
+
* Type for macro nodes.
|
|
263
|
+
*
|
|
264
|
+
* @category Types
|
|
265
|
+
*/
|
|
266
|
+
export type MacroNode = InfoPanel | ExpandMacro | TocMacro | CodeMacro | StatusMacro;
|
|
267
|
+
//# sourceMappingURL=MacroNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MacroNode.d.ts","sourceRoot":"","sources":["../../src/ast/MacroNode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EACL,SAAS,EAGT,KAAK,EACL,aAAa,EACb,gBAAgB,EACjB,MAAM,gBAAgB,CAAA;AAavB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+DAAgE,CAAA;AAEvF;;;;GAIG;AACH,eAAO,MAAM,SAAS,sEAAgC,CAAA;AAEtD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;EAOpB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAA;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW;;;;;;;;EAMtB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ;;;;;;;;EAMnB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;EAUpB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAA;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW;;;;;;;;EAMtB,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confluence macro AST node types.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { CodeBlock, Heading, Image, Paragraph, RawConfluence, SchemaVersion, Table, ThematicBreak, UnsupportedBlock } from "./BlockNode.js";
|
|
8
|
+
// Reuse SimpleBlockNode for macro children
|
|
9
|
+
const SimpleBlockNode = Schema.Union(Heading, Paragraph, CodeBlock, ThematicBreak, Image, Table, UnsupportedBlock);
|
|
10
|
+
/**
|
|
11
|
+
* Supported panel type names.
|
|
12
|
+
* Single source of truth for all panel macros.
|
|
13
|
+
*
|
|
14
|
+
* @category MacroNode
|
|
15
|
+
*/
|
|
16
|
+
export const PanelTypes = ["info", "warning", "note", "tip", "error", "panel"];
|
|
17
|
+
/**
|
|
18
|
+
* Panel type for info/warning/note macros.
|
|
19
|
+
*
|
|
20
|
+
* @category MacroNode
|
|
21
|
+
*/
|
|
22
|
+
export const PanelType = Schema.Literal(...PanelTypes);
|
|
23
|
+
/**
|
|
24
|
+
* Info/Warning/Note panel macro.
|
|
25
|
+
*
|
|
26
|
+
* Represents Confluence info, warning, note, tip, and error panels.
|
|
27
|
+
* In Markdown, rendered as `:::info`, `:::warning`, etc. container syntax.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { InfoPanel, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
32
|
+
*
|
|
33
|
+
* const panel = {
|
|
34
|
+
* _tag: "InfoPanel" as const,
|
|
35
|
+
* panelType: "warning" as const,
|
|
36
|
+
* title: "Important",
|
|
37
|
+
* children: [new Paragraph({ children: [new Text({ value: "Be careful!" })] })]
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @category MacroNode
|
|
42
|
+
*/
|
|
43
|
+
export const InfoPanel = Schema.Struct({
|
|
44
|
+
_tag: Schema.Literal("InfoPanel"),
|
|
45
|
+
version: SchemaVersion,
|
|
46
|
+
panelType: PanelType,
|
|
47
|
+
title: Schema.optional(Schema.String),
|
|
48
|
+
children: Schema.Array(SimpleBlockNode),
|
|
49
|
+
rawConfluence: RawConfluence
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Expand/collapse macro.
|
|
53
|
+
*
|
|
54
|
+
* Represents Confluence expand macro for collapsible content.
|
|
55
|
+
* In Markdown, rendered as `:::details` container syntax.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { ExpandMacro, Paragraph, Text } from "@knpkv/confluence-to-markdown/ast"
|
|
60
|
+
*
|
|
61
|
+
* const expand = {
|
|
62
|
+
* _tag: "ExpandMacro" as const,
|
|
63
|
+
* title: "Click to expand",
|
|
64
|
+
* children: [new Paragraph({ children: [new Text({ value: "Hidden content" })] })]
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @category MacroNode
|
|
69
|
+
*/
|
|
70
|
+
export const ExpandMacro = Schema.Struct({
|
|
71
|
+
_tag: Schema.Literal("ExpandMacro"),
|
|
72
|
+
version: SchemaVersion,
|
|
73
|
+
title: Schema.optional(Schema.String),
|
|
74
|
+
children: Schema.Array(SimpleBlockNode),
|
|
75
|
+
rawConfluence: RawConfluence
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Table of contents macro.
|
|
79
|
+
*
|
|
80
|
+
* Represents Confluence TOC macro for auto-generated table of contents.
|
|
81
|
+
* In Markdown, rendered as `[[toc]]` or similar marker.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* import { TocMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
86
|
+
*
|
|
87
|
+
* const toc = {
|
|
88
|
+
* _tag: "TocMacro" as const,
|
|
89
|
+
* minLevel: 2,
|
|
90
|
+
* maxLevel: 4
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @category MacroNode
|
|
95
|
+
*/
|
|
96
|
+
export const TocMacro = Schema.Struct({
|
|
97
|
+
_tag: Schema.Literal("TocMacro"),
|
|
98
|
+
version: SchemaVersion,
|
|
99
|
+
minLevel: Schema.optional(Schema.Number),
|
|
100
|
+
maxLevel: Schema.optional(Schema.Number),
|
|
101
|
+
rawConfluence: RawConfluence
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Code macro with syntax highlighting.
|
|
105
|
+
*
|
|
106
|
+
* Represents Confluence code macro with language and options.
|
|
107
|
+
* Different from CodeBlock in that it preserves Confluence-specific options.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* import { CodeMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
112
|
+
*
|
|
113
|
+
* const code = {
|
|
114
|
+
* _tag: "CodeMacro" as const,
|
|
115
|
+
* language: "typescript",
|
|
116
|
+
* title: "Example",
|
|
117
|
+
* code: "const x = 1",
|
|
118
|
+
* lineNumbers: true
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @category MacroNode
|
|
123
|
+
*/
|
|
124
|
+
export const CodeMacro = Schema.Struct({
|
|
125
|
+
_tag: Schema.Literal("CodeMacro"),
|
|
126
|
+
version: SchemaVersion,
|
|
127
|
+
language: Schema.optional(Schema.String),
|
|
128
|
+
title: Schema.optional(Schema.String),
|
|
129
|
+
code: Schema.String,
|
|
130
|
+
lineNumbers: Schema.optionalWith(Schema.Boolean, { default: () => false }),
|
|
131
|
+
collapse: Schema.optionalWith(Schema.Boolean, { default: () => false }),
|
|
132
|
+
firstLine: Schema.optional(Schema.Number),
|
|
133
|
+
rawConfluence: RawConfluence
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Status macro (colored label).
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* import { StatusMacro } from "@knpkv/confluence-to-markdown/ast"
|
|
141
|
+
*
|
|
142
|
+
* const status = {
|
|
143
|
+
* _tag: "StatusMacro" as const,
|
|
144
|
+
* text: "In Progress",
|
|
145
|
+
* color: "Blue"
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @category MacroNode
|
|
150
|
+
*/
|
|
151
|
+
export const StatusMacro = Schema.Struct({
|
|
152
|
+
_tag: Schema.Literal("StatusMacro"),
|
|
153
|
+
version: SchemaVersion,
|
|
154
|
+
text: Schema.String,
|
|
155
|
+
color: Schema.Literal("Grey", "Red", "Yellow", "Green", "Blue"),
|
|
156
|
+
rawConfluence: RawConfluence
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Union of all macro node types.
|
|
160
|
+
*
|
|
161
|
+
* @category MacroNode
|
|
162
|
+
*/
|
|
163
|
+
export const MacroNode = Schema.Union(InfoPanel, ExpandMacro, TocMacro, CodeMacro, StatusMacro);
|
|
164
|
+
//# sourceMappingURL=MacroNode.js.map
|