@redocly/realm-plugin-asciidoc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts ADDED
@@ -0,0 +1,171 @@
1
+ export type AsciidocFrontmatter = {
2
+ title: string;
3
+ description?: string;
4
+ keywords?: string[];
5
+ excludeFromSearch?: boolean;
6
+ seo?: {
7
+ title?: string;
8
+ description?: string;
9
+ };
10
+ };
11
+
12
+ // ─── Serializable AST content node types ────────────────────────────────────
13
+
14
+ export type ContentNode =
15
+ | ParagraphNode
16
+ | HeadingNode
17
+ | CodeBlockNode
18
+ | AdmonitionNode
19
+ | ListNode
20
+ | DescriptionListNode
21
+ | TableNode
22
+ | ImageNode
23
+ | QuoteNode
24
+ | SidebarNode
25
+ | ExampleNode
26
+ | CollapsibleNode
27
+ | ThematicBreakNode
28
+ | HtmlPassthroughNode
29
+ | SectionNode;
30
+
31
+ export type ParagraphNode = {
32
+ type: 'paragraph';
33
+ contentHtml: string;
34
+ icons: InlineIcon[];
35
+ role?: string;
36
+ };
37
+
38
+ export type HeadingNode = {
39
+ type: 'heading';
40
+ level: number;
41
+ id: string;
42
+ contentHtml: string;
43
+ };
44
+
45
+ export type CodeBlockCallout = {
46
+ line: number;
47
+ number: number;
48
+ };
49
+
50
+ export type CodeBlockNode = {
51
+ type: 'codeBlock';
52
+ lang: string;
53
+ source: string;
54
+ title?: string;
55
+ callouts?: CodeBlockCallout[];
56
+ calloutDescriptions?: string[];
57
+ };
58
+
59
+ export type AdmonitionNode = {
60
+ type: 'admonition';
61
+ admonitionType: 'info' | 'warning' | 'success' | 'danger';
62
+ name: string;
63
+ children: ContentNode[];
64
+ };
65
+
66
+ export type ListNode = {
67
+ type: 'list';
68
+ ordered: boolean;
69
+ items: ListItemNode[];
70
+ };
71
+
72
+ export type ListItemNode = {
73
+ contentHtml: string;
74
+ icons: InlineIcon[];
75
+ children: ContentNode[];
76
+ };
77
+
78
+ export type DescriptionListNode = {
79
+ type: 'descriptionList';
80
+ items: DescriptionListItemNode[];
81
+ };
82
+
83
+ export type DescriptionListItemNode = {
84
+ termsHtml: string[];
85
+ descriptionHtml: string;
86
+ descriptionIcons: InlineIcon[];
87
+ children: ContentNode[];
88
+ };
89
+
90
+ export type TableNode = {
91
+ type: 'table';
92
+ title?: string;
93
+ head: TableCellNode[][];
94
+ body: TableCellNode[][];
95
+ foot: TableCellNode[][];
96
+ };
97
+
98
+ export type TableCellNode = {
99
+ contentHtml: string;
100
+ colSpan?: number;
101
+ rowSpan?: number;
102
+ };
103
+
104
+ export type ImageNode = {
105
+ type: 'image';
106
+ src: string;
107
+ alt: string;
108
+ title?: string;
109
+ width?: string;
110
+ height?: string;
111
+ };
112
+
113
+ export type QuoteNode = {
114
+ type: 'quote';
115
+ attribution?: string;
116
+ citeTitle?: string;
117
+ children: ContentNode[];
118
+ };
119
+
120
+ export type SidebarNode = {
121
+ type: 'sidebar';
122
+ title?: string;
123
+ children: ContentNode[];
124
+ };
125
+
126
+ export type ExampleNode = {
127
+ type: 'example';
128
+ title?: string;
129
+ children: ContentNode[];
130
+ };
131
+
132
+ export type CollapsibleNode = {
133
+ type: 'collapsible';
134
+ title?: string;
135
+ children: ContentNode[];
136
+ };
137
+
138
+ export type ThematicBreakNode = {
139
+ type: 'thematicBreak';
140
+ };
141
+
142
+ export type HtmlPassthroughNode = {
143
+ type: 'htmlPassthrough';
144
+ html: string;
145
+ };
146
+
147
+ export type SectionNode = {
148
+ type: 'section';
149
+ id: string;
150
+ title: string;
151
+ titleHtml: string;
152
+ titleIcons: InlineIcon[];
153
+ level: number;
154
+ children: ContentNode[];
155
+ };
156
+
157
+ export type InlineIcon = {
158
+ name: string;
159
+ style: string;
160
+ size?: string;
161
+ };
162
+
163
+ // ─── Section tree (used for TOC, search, AI docs) ─────────────────────────
164
+
165
+ export type AsciidocSection = {
166
+ id: string;
167
+ title: string;
168
+ level: number;
169
+ textContent: string;
170
+ children: AsciidocSection[];
171
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "references": [{ "path": "../theme/tsconfig.build.json" }],
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "noEmit": false,
6
+ "outDir": "lib",
7
+ "rootDir": "src",
8
+ "baseUrl": ".",
9
+ "tsBuildInfoFile": "lib/.tsbuildinfo"
10
+ },
11
+ "extends": "./tsconfig.json",
12
+ "include": ["src"]
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "./",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx"
8
+ },
9
+ "include": ["src"]
10
+ }