@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/lib/.tsbuildinfo +1 -0
- package/lib/asciidoc-parser.d.ts +15 -0
- package/lib/asciidoc-parser.js +747 -0
- package/lib/asciidoc-parser.js.map +1 -0
- package/lib/get-ai-search-documents.d.ts +24 -0
- package/lib/get-ai-search-documents.js +133 -0
- package/lib/get-ai-search-documents.js.map +1 -0
- package/lib/plugin.d.ts +2 -0
- package/lib/plugin.js +314 -0
- package/lib/plugin.js.map +1 -0
- package/lib/search-facets.d.ts +3 -0
- package/lib/search-facets.js +34 -0
- package/lib/search-facets.js.map +1 -0
- package/lib/search-resolver.d.ts +4 -0
- package/lib/search-resolver.js +72 -0
- package/lib/search-resolver.js.map +1 -0
- package/lib/template.d.ts +18 -0
- package/lib/template.js +346 -0
- package/lib/template.js.map +1 -0
- package/lib/types.d.ts +130 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +45 -0
- package/src/asciidoc-parser.ts +927 -0
- package/src/get-ai-search-documents.ts +193 -0
- package/src/plugin.ts +483 -0
- package/src/search-facets.ts +46 -0
- package/src/search-resolver.ts +98 -0
- package/src/template.tsx +628 -0
- package/src/types.ts +171 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.json +10 -0
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
|
+
}
|