@diplodoc/cli-tests 5.43.3 → 5.45.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 (35) hide show
  1. package/e2e/__snapshots__/llms.spec.ts.snap +257 -0
  2. package/e2e/__snapshots__/regression.test.ts.snap +39 -33
  3. package/e2e/crawler-manifest.spec.ts +4 -5
  4. package/e2e/llms.spec.ts +24 -0
  5. package/e2e/openapi-companion.spec.ts +213 -0
  6. package/e2e/themer.test.ts +66 -0
  7. package/e2e/translation.spec.ts +7 -1
  8. package/mocks/crawler-manifest/notifications-docs-viewer/input/.yfm +1 -1
  9. package/mocks/crawler-manifest/notifications-root/input/.yfm +4 -2
  10. package/mocks/llms/input/.yfm +1 -0
  11. package/mocks/llms/input/_includes/requirements.md +4 -0
  12. package/mocks/llms/input/api.md +9 -0
  13. package/mocks/llms/input/beta.md +4 -0
  14. package/mocks/llms/input/index.md +8 -0
  15. package/mocks/llms/input/presets.yaml +2 -0
  16. package/mocks/llms/input/start.md +9 -0
  17. package/mocks/llms/input/toc.yaml +11 -0
  18. package/mocks/openapi-companion/input/petstore.yaml +29 -0
  19. package/mocks/openapi-companion/input/toc.yaml +9 -0
  20. package/mocks/openapi-companion-disabled/input/.yfm +2 -0
  21. package/mocks/openapi-companion-disabled/input/petstore.yaml +29 -0
  22. package/mocks/openapi-companion-disabled/input/toc.yaml +9 -0
  23. package/mocks/openapi-companion-link/input/petstore.yaml +29 -0
  24. package/mocks/openapi-companion-link/input/toc.yaml +12 -0
  25. package/mocks/themer/test6/input/.yfm +3 -0
  26. package/mocks/themer/test6/input/index.md +11 -0
  27. package/mocks/themer/test6/input/toc.yaml +5 -0
  28. package/mocks/themer/test7/input/.yfm +3 -0
  29. package/mocks/themer/test7/input/index.md +5 -0
  30. package/mocks/themer/test7/input/theme.yaml +7 -0
  31. package/mocks/themer/test7/input/toc.yaml +5 -0
  32. package/mocks/themer/test8/input/.yfm +3 -0
  33. package/mocks/themer/test8/input/index.md +5 -0
  34. package/mocks/themer/test8/input/toc.yaml +5 -0
  35. package/package.json +1 -1
@@ -0,0 +1,257 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "api.md",
7
+ "index.md",
8
+ "llms-full.txt",
9
+ "llms.txt",
10
+ "start.md",
11
+ "toc.yaml"
12
+ ]"
13
+ `;
14
+
15
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html > filelist 2`] = `
16
+ "[
17
+ ".yfm",
18
+ "api.html",
19
+ "index.html",
20
+ "llms-full.txt",
21
+ "llms.txt",
22
+ "start.html",
23
+ "toc.js"
24
+ ]"
25
+ `;
26
+
27
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 1`] = `
28
+ "allowHtml: true
29
+ "
30
+ `;
31
+
32
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 2`] = `
33
+ "---
34
+ metadata:
35
+ - name: generator
36
+ content: Diplodoc Platform vDIPLODOC-VERSION
37
+ description: Full reference of the public HTTP endpoints.
38
+ vcsPath: api.md
39
+ ---
40
+
41
+ # API Reference
42
+
43
+ ## GET /things
44
+
45
+ Returns the list of things.
46
+ "
47
+ `;
48
+
49
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 3`] = `
50
+ "---
51
+ metadata:
52
+ - name: generator
53
+ content: Diplodoc Platform vDIPLODOC-VERSION
54
+ title: Overview
55
+ description: What this product is and how to get started.
56
+ vcsPath: index.md
57
+ ---
58
+
59
+ # Overview
60
+
61
+ Welcome to **My Product** — the documentation home page.
62
+ "
63
+ `;
64
+
65
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 4`] = `
66
+ "# My Product
67
+
68
+ # Overview
69
+
70
+ Welcome to **My Product** — the documentation home page.
71
+
72
+ # Getting Started
73
+
74
+ Run the installer and create your first project.
75
+
76
+ ## Requirements
77
+
78
+ - Node.js 18+
79
+ - 2 GB RAM
80
+
81
+ # API Reference
82
+
83
+ ## GET /things
84
+
85
+ Returns the list of things.
86
+ "
87
+ `;
88
+
89
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 5`] = `
90
+ "# My Product
91
+
92
+ - [Overview](index.md): What this product is and how to get started.
93
+ - [Getting Started](start.md): Install the product and build your first project.
94
+ - [API Reference](api.md): Full reference of the public HTTP endpoints.
95
+ "
96
+ `;
97
+
98
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 6`] = `
99
+ "---
100
+ metadata:
101
+ - name: generator
102
+ content: Diplodoc Platform vDIPLODOC-VERSION
103
+ description: Install the product and build your first project.
104
+ vcsPath: start.md
105
+ ---
106
+
107
+ # Getting Started
108
+
109
+ Run the installer and create your first project.
110
+
111
+ <!-- source: _includes/requirements.md -->
112
+ ## Requirements
113
+
114
+ - Node.js 18+
115
+ - 2 GB RAM
116
+ <!-- endsource: _includes/requirements.md -->
117
+ "
118
+ `;
119
+
120
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 7`] = `
121
+ "title: My Product
122
+ href: index.md
123
+ items:
124
+ - name: Getting Started
125
+ href: start.md
126
+ - name: API Reference
127
+ href: api.md
128
+ path: toc.yaml
129
+ "
130
+ `;
131
+
132
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 8`] = `
133
+ "allowHtml: true
134
+ "
135
+ `;
136
+
137
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 9`] = `
138
+ "<!DOCTYPE html>
139
+ <html lang="ru" dir="ltr">
140
+ <head>
141
+ <meta charset="utf-8">
142
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
143
+ <base href="./" />
144
+ <title>API Reference | My Product</title>
145
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
146
+ <meta name="description" content="Full reference of the public HTTP endpoints.">
147
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
148
+ </head>
149
+ <body class="g-root g-root_theme_light">
150
+ <div id="root"></div>
151
+ <script type="application/json" id="diplodoc-state">
152
+ {"data":{"leading":false,"html":"&lt;h2 id=\\"get-/things\\"&gt;&lt;a href=\\"api.html#get-/things\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;GET /things&lt;/span&gt;&lt;/a&gt;GET /things&lt;/h2&gt;/n&lt;p&gt;Returns the list of things.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"Full reference of the public HTTP endpoints."}],"description":"Full reference of the public HTTP endpoints.","vcsPath":"api.md"},"headings":[{"title":"GET /things","href":"api.html#get-/things","level":2}],"title":"API Reference"},"router":{"pathname":"api","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
153
+ </script>
154
+ <script type="application/javascript">
155
+ const data = document.querySelector('script#diplodoc-state');
156
+ window.__DATA__ = JSON.parse((function unescape(string) {
157
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
158
+ })(data.innerText));
159
+ window.STATIC_CONTENT = false;
160
+ </script>
161
+ <script type="application/javascript" defer src="toc.js"></script>
162
+ </body>
163
+ </html>"
164
+ `;
165
+
166
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 10`] = `
167
+ "<!DOCTYPE html>
168
+ <html lang="ru" dir="ltr">
169
+ <head>
170
+ <meta charset="utf-8">
171
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
172
+ <base href="./" />
173
+ <title>Overview | My Product</title>
174
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
175
+ <meta name="description" content="What this product is and how to get started.">
176
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
177
+ </head>
178
+ <body class="g-root g-root_theme_light">
179
+ <div id="root"></div>
180
+ <script type="application/json" id="diplodoc-state">
181
+ {"data":{"leading":false,"html":"&lt;p&gt;Welcome to &lt;strong&gt;My Product&lt;/strong&gt; — the documentation home page.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"What this product is and how to get started."}],"title":"Overview","description":"What this product is and how to get started.","vcsPath":"index.md"},"headings":[],"title":"Overview"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
182
+ </script>
183
+ <script type="application/javascript">
184
+ const data = document.querySelector('script#diplodoc-state');
185
+ window.__DATA__ = JSON.parse((function unescape(string) {
186
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
187
+ })(data.innerText));
188
+ window.STATIC_CONTENT = false;
189
+ </script>
190
+ <script type="application/javascript" defer src="toc.js"></script>
191
+ </body>
192
+ </html>"
193
+ `;
194
+
195
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 11`] = `
196
+ "# My Product
197
+
198
+ # Overview
199
+
200
+ Welcome to **My Product** — the documentation home page.
201
+
202
+ # Getting Started
203
+
204
+ Run the installer and create your first project.
205
+
206
+ ## Requirements
207
+
208
+ - Node.js 18+
209
+ - 2 GB RAM
210
+
211
+ # API Reference
212
+
213
+ ## GET /things
214
+
215
+ Returns the list of things.
216
+ "
217
+ `;
218
+
219
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 12`] = `
220
+ "# My Product
221
+
222
+ - [Overview](index.html): What this product is and how to get started.
223
+ - [Getting Started](start.html): Install the product and build your first project.
224
+ - [API Reference](api.html): Full reference of the public HTTP endpoints.
225
+ "
226
+ `;
227
+
228
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 13`] = `
229
+ "<!DOCTYPE html>
230
+ <html lang="ru" dir="ltr">
231
+ <head>
232
+ <meta charset="utf-8">
233
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
234
+ <base href="./" />
235
+ <title>Getting Started | My Product</title>
236
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
237
+ <meta name="description" content="Install the product and build your first project.">
238
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
239
+ </head>
240
+ <body class="g-root g-root_theme_light">
241
+ <div id="root"></div>
242
+ <script type="application/json" id="diplodoc-state">
243
+ {"data":{"leading":false,"html":"&lt;p&gt;Run the installer and create your first project.&lt;/p&gt;/n&lt;h2 id=\\"requirements\\"&gt;&lt;a href=\\"start.html#requirements\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Requirements&lt;/span&gt;&lt;/a&gt;Requirements&lt;/h2&gt;/n&lt;ul&gt;/n&lt;li&gt;Node.js 18+&lt;/li&gt;/n&lt;li&gt;2 GB RAM&lt;/li&gt;/n&lt;/ul&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"Install the product and build your first project."}],"description":"Install the product and build your first project.","vcsPath":"start.md"},"headings":[{"title":"Requirements","href":"start.html#requirements","level":2}],"title":"Getting Started"},"router":{"pathname":"start","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
244
+ </script>
245
+ <script type="application/javascript">
246
+ const data = document.querySelector('script#diplodoc-state');
247
+ window.__DATA__ = JSON.parse((function unescape(string) {
248
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
249
+ })(data.innerText));
250
+ window.STATIC_CONTENT = false;
251
+ </script>
252
+ <script type="application/javascript" defer src="toc.js"></script>
253
+ </body>
254
+ </html>"
255
+ `;
256
+
257
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 14`] = `"window.__DATA__.data.toc = {"title":"My Product","href":"index.html","items":[{"name":"Getting Started","href":"start.html","id":"UUID"},{"name":"API Reference","href":"api.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -28,6 +28,7 @@ exports[`Regression > internal > filelist 1`] = `
28
28
  "merge/toc.yaml",
29
29
  "mermaid.md",
30
30
  "openapi/index.md",
31
+ "openapi/openapi-spec.openapi.json",
31
32
  "openapi/test-controller/getHiddenTest.md",
32
33
  "openapi/test-controller/getWithPayloadResponse.md",
33
34
  "openapi/test-controller/index.md",
@@ -66,6 +67,7 @@ exports[`Regression > internal > filelist 2`] = `
66
67
  "merge/toc.js",
67
68
  "mermaid.html",
68
69
  "openapi/index.html",
70
+ "openapi/openapi-spec.openapi.json",
69
71
  "openapi/test-controller/getHiddenTest.html",
70
72
  "openapi/test-controller/getWithPayloadResponse.html",
71
73
  "openapi/test-controller/index.html",
@@ -952,7 +954,9 @@ vcsPath: openapi/index.md
952
954
  {% endcut %}"
953
955
  `;
954
956
 
955
- exports[`Regression > internal 22`] = `
957
+ exports[`Regression > internal 22`] = `"{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/test":{"get":{"tags":["test-controller"],"summary":"Simple get operation. тест новой верстки 3","description":"Defines a simple get operation with no inputs and a complex","operationId":"getWithPayloadResponse","responses":{"200":{"description":"200!!!!","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurceTop"}}}}}}},"/hidden-test":{"get":{"tags":["test-controller"],"summary":"Test x-hidden attribute","description":"Test various x-hidden scenarios","operationId":"getHiddenTest","responses":{"200":{"description":"Response with hidden fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HiddenTestResponse"}}}}}}}},"components":{"schemas":{"RecurceTop":{"type":"object","properties":{"A":{"type":"string"}}},"HiddenTestResponse":{"type":"object","description":"Response object with various hidden field scenarios","properties":{"visibleField":{"type":"string","description":"This field should be visible"},"refToHiddenField":{"$ref":"#/components/schemas/HiddenField"},"refToHiddenObject":{"$ref":"#/components/schemas/HiddenObject"},"nestedObject":{"type":"object","description":"Object with hidden properties","properties":{"visibleNested":{"type":"string"},"refToHiddenInNested":{"$ref":"#/components/schemas/HiddenField"}}},"arrayWithHiddenItems":{"type":"array","description":"Array with hidden item schema","items":{"$ref":"#/components/schemas/HiddenField"}},"mixedVisibility":{"type":"object","properties":{"field1":{"type":"string"},"field2":{"$ref":"#/components/schemas/HiddenField"},"field3":{"type":"string"},"field5":{"type":"string"}}}}}}}}"`;
958
+
959
+ exports[`Regression > internal 23`] = `
956
960
  "---
957
961
  metadata:
958
962
  - name: generator
@@ -1150,7 +1154,7 @@ _Example:_{.json-schema-reset .json-schema-example} \`example\`
1150
1154
  [*Deprecated]: No longer supported, please use an alternative and newer version."
1151
1155
  `;
1152
1156
 
1153
- exports[`Regression > internal 23`] = `
1157
+ exports[`Regression > internal 24`] = `
1154
1158
  "---
1155
1159
  metadata:
1156
1160
  - name: generator
@@ -1232,7 +1236,7 @@ _Example:_{.json-schema-reset .json-schema-example} \`example\`
1232
1236
  [*Deprecated]: No longer supported, please use an alternative and newer version."
1233
1237
  `;
1234
1238
 
1235
- exports[`Regression > internal 24`] = `
1239
+ exports[`Regression > internal 25`] = `
1236
1240
  "---
1237
1241
  metadata:
1238
1242
  - name: generator
@@ -1252,7 +1256,7 @@ vcsPath: openapi/test-controller/index.md
1252
1256
  "
1253
1257
  `;
1254
1258
 
1255
- exports[`Regression > internal 25`] = `
1259
+ exports[`Regression > internal 26`] = `
1256
1260
  "files:
1257
1261
  - from: c.md
1258
1262
  to: d.md
@@ -1262,7 +1266,7 @@ common:
1262
1266
  "
1263
1267
  `;
1264
1268
 
1265
- exports[`Regression > internal 26`] = `
1269
+ exports[`Regression > internal 27`] = `
1266
1270
  "---
1267
1271
  metadata:
1268
1272
  - name: generator
@@ -1279,7 +1283,7 @@ Item 1 text
1279
1283
  "
1280
1284
  `;
1281
1285
 
1282
- exports[`Regression > internal 27`] = `
1286
+ exports[`Regression > internal 28`] = `
1283
1287
  "items:
1284
1288
  - name: Verbose root (index.yaml) will be transformed to index.html
1285
1289
  href: index.yaml
@@ -1344,13 +1348,13 @@ path: toc.yaml
1344
1348
  "
1345
1349
  `;
1346
1350
 
1347
- exports[`Regression > internal 28`] = `
1351
+ exports[`Regression > internal 29`] = `
1348
1352
  "preprocess:
1349
1353
  mergeAutotitles: true
1350
1354
  "
1351
1355
  `;
1352
1356
 
1353
- exports[`Regression > internal 29`] = `
1357
+ exports[`Regression > internal 30`] = `
1354
1358
  "<!DOCTYPE html>
1355
1359
  <html lang="ru" dir="ltr">
1356
1360
  <head>
@@ -1378,7 +1382,7 @@ exports[`Regression > internal 29`] = `
1378
1382
  </html>"
1379
1383
  `;
1380
1384
 
1381
- exports[`Regression > internal 30`] = `
1385
+ exports[`Regression > internal 31`] = `
1382
1386
  "<!DOCTYPE html>
1383
1387
  <html lang="ru" dir="ltr">
1384
1388
  <head>
@@ -1406,7 +1410,7 @@ exports[`Regression > internal 30`] = `
1406
1410
  </html>"
1407
1411
  `;
1408
1412
 
1409
- exports[`Regression > internal 31`] = `
1413
+ exports[`Regression > internal 32`] = `
1410
1414
  "<!DOCTYPE html>
1411
1415
  <html lang="ru" dir="ltr">
1412
1416
  <head>
@@ -1434,7 +1438,7 @@ exports[`Regression > internal 31`] = `
1434
1438
  </html>"
1435
1439
  `;
1436
1440
 
1437
- exports[`Regression > internal 32`] = `
1441
+ exports[`Regression > internal 33`] = `
1438
1442
  "<!DOCTYPE html>
1439
1443
  <html lang="ru" dir="ltr">
1440
1444
  <head>
@@ -1462,7 +1466,7 @@ exports[`Regression > internal 32`] = `
1462
1466
  </html>"
1463
1467
  `;
1464
1468
 
1465
- exports[`Regression > internal 33`] = `
1469
+ exports[`Regression > internal 34`] = `
1466
1470
  "<!DOCTYPE html>
1467
1471
  <html lang="ru" dir="ltr">
1468
1472
  <head>
@@ -1490,7 +1494,7 @@ exports[`Regression > internal 33`] = `
1490
1494
  </html>"
1491
1495
  `;
1492
1496
 
1493
- exports[`Regression > internal 34`] = `
1497
+ exports[`Regression > internal 35`] = `
1494
1498
  "<!DOCTYPE html>
1495
1499
  <html lang="ru" dir="ltr">
1496
1500
  <head>
@@ -1518,7 +1522,7 @@ exports[`Regression > internal 34`] = `
1518
1522
  </html>"
1519
1523
  `;
1520
1524
 
1521
- exports[`Regression > internal 35`] = `
1525
+ exports[`Regression > internal 36`] = `
1522
1526
  "<!DOCTYPE html>
1523
1527
  <html lang="ru" dir="ltr">
1524
1528
  <head>
@@ -1546,7 +1550,7 @@ exports[`Regression > internal 35`] = `
1546
1550
  </html>"
1547
1551
  `;
1548
1552
 
1549
- exports[`Regression > internal 36`] = `
1553
+ exports[`Regression > internal 37`] = `
1550
1554
  "<!DOCTYPE html>
1551
1555
  <html lang="ru" dir="ltr">
1552
1556
  <head>
@@ -1574,7 +1578,7 @@ exports[`Regression > internal 36`] = `
1574
1578
  </html>"
1575
1579
  `;
1576
1580
 
1577
- exports[`Regression > internal 37`] = `
1581
+ exports[`Regression > internal 38`] = `
1578
1582
  "<!DOCTYPE html>
1579
1583
  <html lang="ru" dir="ltr">
1580
1584
  <head>
@@ -1602,7 +1606,7 @@ exports[`Regression > internal 37`] = `
1602
1606
  </html>"
1603
1607
  `;
1604
1608
 
1605
- exports[`Regression > internal 38`] = `
1609
+ exports[`Regression > internal 39`] = `
1606
1610
  "<!DOCTYPE html>
1607
1611
  <html lang="ru" dir="ltr">
1608
1612
  <head>
@@ -1630,7 +1634,7 @@ exports[`Regression > internal 38`] = `
1630
1634
  </html>"
1631
1635
  `;
1632
1636
 
1633
- exports[`Regression > internal 39`] = `
1637
+ exports[`Regression > internal 40`] = `
1634
1638
  "<!DOCTYPE html>
1635
1639
  <html lang="ru" dir="ltr">
1636
1640
  <head>
@@ -1658,7 +1662,7 @@ exports[`Regression > internal 39`] = `
1658
1662
  </html>"
1659
1663
  `;
1660
1664
 
1661
- exports[`Regression > internal 40`] = `
1665
+ exports[`Regression > internal 41`] = `
1662
1666
  "<!DOCTYPE html>
1663
1667
  <html lang="ru" dir="ltr">
1664
1668
  <head>
@@ -1686,7 +1690,7 @@ exports[`Regression > internal 40`] = `
1686
1690
  </html>"
1687
1691
  `;
1688
1692
 
1689
- exports[`Regression > internal 41`] = `
1693
+ exports[`Regression > internal 42`] = `
1690
1694
  "<!DOCTYPE html>
1691
1695
  <html lang="ru" dir="ltr">
1692
1696
  <head>
@@ -1714,7 +1718,7 @@ exports[`Regression > internal 41`] = `
1714
1718
  </html>"
1715
1719
  `;
1716
1720
 
1717
- exports[`Regression > internal 42`] = `
1721
+ exports[`Regression > internal 43`] = `
1718
1722
  "<!DOCTYPE html>
1719
1723
  <html lang="ru" dir="ltr">
1720
1724
  <head>
@@ -1742,7 +1746,7 @@ exports[`Regression > internal 42`] = `
1742
1746
  </html>"
1743
1747
  `;
1744
1748
 
1745
- exports[`Regression > internal 43`] = `
1749
+ exports[`Regression > internal 44`] = `
1746
1750
  "<!DOCTYPE html>
1747
1751
  <html lang="ru" dir="ltr">
1748
1752
  <head>
@@ -1770,7 +1774,7 @@ exports[`Regression > internal 43`] = `
1770
1774
  </html>"
1771
1775
  `;
1772
1776
 
1773
- exports[`Regression > internal 44`] = `
1777
+ exports[`Regression > internal 45`] = `
1774
1778
  "<!DOCTYPE html>
1775
1779
  <html lang="ru" dir="ltr">
1776
1780
  <head>
@@ -1798,7 +1802,7 @@ exports[`Regression > internal 44`] = `
1798
1802
  </html>"
1799
1803
  `;
1800
1804
 
1801
- exports[`Regression > internal 45`] = `
1805
+ exports[`Regression > internal 46`] = `
1802
1806
  "<!DOCTYPE html>
1803
1807
  <html lang="ru" dir="ltr">
1804
1808
  <head>
@@ -1826,7 +1830,7 @@ exports[`Regression > internal 45`] = `
1826
1830
  </html>"
1827
1831
  `;
1828
1832
 
1829
- exports[`Regression > internal 46`] = `
1833
+ exports[`Regression > internal 47`] = `
1830
1834
  "<!DOCTYPE html>
1831
1835
  <html lang="ru" dir="ltr">
1832
1836
  <head>
@@ -1854,9 +1858,9 @@ exports[`Regression > internal 46`] = `
1854
1858
  </html>"
1855
1859
  `;
1856
1860
 
1857
- exports[`Regression > internal 47`] = `"window.__DATA__.data.toc = {"items":[{"name":"Use merged","href":"merge/merge.html","id":"UUID"},{"name":"Multitoc item","href":"1.html","id":"UUID"},{"name":"Merged item","href":"merge/merged.html","id":"UUID"}],"path":"merge/toc.yaml","id":"UUID"};"`;
1861
+ exports[`Regression > internal 48`] = `"window.__DATA__.data.toc = {"items":[{"name":"Use merged","href":"merge/merge.html","id":"UUID"},{"name":"Multitoc item","href":"1.html","id":"UUID"},{"name":"Merged item","href":"merge/merged.html","id":"UUID"}],"path":"merge/toc.yaml","id":"UUID"};"`;
1858
1862
 
1859
- exports[`Regression > internal 48`] = `
1863
+ exports[`Regression > internal 49`] = `
1860
1864
  "<!DOCTYPE html>
1861
1865
  <html lang="ru" dir="ltr">
1862
1866
  <head>
@@ -1884,7 +1888,7 @@ exports[`Regression > internal 48`] = `
1884
1888
  </html>"
1885
1889
  `;
1886
1890
 
1887
- exports[`Regression > internal 49`] = `
1891
+ exports[`Regression > internal 50`] = `
1888
1892
  "<!DOCTYPE html>
1889
1893
  <html lang="ru" dir="ltr">
1890
1894
  <head>
@@ -1912,7 +1916,9 @@ exports[`Regression > internal 49`] = `
1912
1916
  </html>"
1913
1917
  `;
1914
1918
 
1915
- exports[`Regression > internal 50`] = `
1919
+ exports[`Regression > internal 51`] = `"{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"http://localhost:8080","description":"Generated server url"}],"paths":{"/test":{"get":{"tags":["test-controller"],"summary":"Simple get operation. тест новой верстки 3","description":"Defines a simple get operation with no inputs and a complex","operationId":"getWithPayloadResponse","responses":{"200":{"description":"200!!!!","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurceTop"}}}}}}},"/hidden-test":{"get":{"tags":["test-controller"],"summary":"Test x-hidden attribute","description":"Test various x-hidden scenarios","operationId":"getHiddenTest","responses":{"200":{"description":"Response with hidden fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HiddenTestResponse"}}}}}}}},"components":{"schemas":{"RecurceTop":{"type":"object","properties":{"A":{"type":"string"}}},"HiddenTestResponse":{"type":"object","description":"Response object with various hidden field scenarios","properties":{"visibleField":{"type":"string","description":"This field should be visible"},"refToHiddenField":{"$ref":"#/components/schemas/HiddenField"},"refToHiddenObject":{"$ref":"#/components/schemas/HiddenObject"},"nestedObject":{"type":"object","description":"Object with hidden properties","properties":{"visibleNested":{"type":"string"},"refToHiddenInNested":{"$ref":"#/components/schemas/HiddenField"}}},"arrayWithHiddenItems":{"type":"array","description":"Array with hidden item schema","items":{"$ref":"#/components/schemas/HiddenField"}},"mixedVisibility":{"type":"object","properties":{"field1":{"type":"string"},"field2":{"$ref":"#/components/schemas/HiddenField"},"field3":{"type":"string"},"field5":{"type":"string"}}}}}}}}"`;
1920
+
1921
+ exports[`Regression > internal 52`] = `
1916
1922
  "<!DOCTYPE html>
1917
1923
  <html lang="ru" dir="ltr">
1918
1924
  <head>
@@ -1940,7 +1946,7 @@ exports[`Regression > internal 50`] = `
1940
1946
  </html>"
1941
1947
  `;
1942
1948
 
1943
- exports[`Regression > internal 51`] = `
1949
+ exports[`Regression > internal 53`] = `
1944
1950
  "<!DOCTYPE html>
1945
1951
  <html lang="ru" dir="ltr">
1946
1952
  <head>
@@ -1968,7 +1974,7 @@ exports[`Regression > internal 51`] = `
1968
1974
  </html>"
1969
1975
  `;
1970
1976
 
1971
- exports[`Regression > internal 52`] = `
1977
+ exports[`Regression > internal 54`] = `
1972
1978
  "<!DOCTYPE html>
1973
1979
  <html lang="ru" dir="ltr">
1974
1980
  <head>
@@ -1996,7 +2002,7 @@ exports[`Regression > internal 52`] = `
1996
2002
  </html>"
1997
2003
  `;
1998
2004
 
1999
- exports[`Regression > internal 53`] = `
2005
+ exports[`Regression > internal 55`] = `
2000
2006
  "<!DOCTYPE html>
2001
2007
  <html lang="ru" dir="ltr">
2002
2008
  <head>
@@ -2024,4 +2030,4 @@ exports[`Regression > internal 53`] = `
2024
2030
  </html>"
2025
2031
  `;
2026
2032
 
2027
- exports[`Regression > internal 54`] = `"window.__DATA__.data.toc = {"items":[{"name":"Verbose root (index.yaml) will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Root will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Md item with not_var syntax","href":"1.html","id":"UUID"},{"name":"Md item named without extension","href":"1.html","id":"UUID"},{"name":"Item with empty href","id":"UUID"},{"name":"Multitoc item","href":"merge/merged.html","id":"UUID"},{"name":"Fragments","href":"includes/fragments.html","id":"UUID"},{"name":"Included Item","href":"included-item.html","id":"UUID"},{"name":"Named include (items is Object here - this is not an error)","items":[{"name":"Item 1","href":"sub/folder/item-1.html","id":"UUID"}],"id":"UUID"},{"href":"mermaid.html","name":"Mermaid usage","id":"UUID"},{"name":"Latex usage","href":"latex.html","id":"UUID"},{"name":"Images","href":"images.html","id":"UUID"},{"name":"Autotitle","href":"autotitle.html","id":"UUID"},{"name":"includes","href":"includes.html","id":"UUID"},{"name":"Entry as include","href":"entry-as-include.html","id":"UUID"},{"name":"Includer of entry","href":"includer-of-entry.html","id":"UUID"},{"name":"generic","items":[{"name":"Note 1","href":"generic/1.html","id":"UUID"},{"name":"Note 1","href":"generic/2.html","id":"UUID"},{"name":"3","href":"generic/3.html","id":"UUID"},{"name":"Sub notes","items":[{"name":"Sub note 1","href":"generic/Sub notes/1.html","id":"UUID"},{"name":"Sub note 2","href":"generic/Sub notes/2.html","id":"UUID"}],"id":"UUID"}],"id":"UUID"},{"name":"openapi","items":[{"name":"Overview","href":"openapi/index.html","id":"UUID"},{"name":"test-controller","items":[{"name":"Overview","href":"openapi/test-controller/index.html","id":"UUID"},{"href":"openapi/test-controller/getWithPayloadResponse.html","name":"Simple get operation. тест новой верстки 3","id":"UUID"},{"href":"openapi/test-controller/getHiddenTest.html","name":"Test x-hidden attribute","id":"UUID"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
2033
+ exports[`Regression > internal 56`] = `"window.__DATA__.data.toc = {"items":[{"name":"Verbose root (index.yaml) will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Root will be transformed to index.html","href":"index.html","id":"UUID"},{"name":"Md item with not_var syntax","href":"1.html","id":"UUID"},{"name":"Md item named without extension","href":"1.html","id":"UUID"},{"name":"Item with empty href","id":"UUID"},{"name":"Multitoc item","href":"merge/merged.html","id":"UUID"},{"name":"Fragments","href":"includes/fragments.html","id":"UUID"},{"name":"Included Item","href":"included-item.html","id":"UUID"},{"name":"Named include (items is Object here - this is not an error)","items":[{"name":"Item 1","href":"sub/folder/item-1.html","id":"UUID"}],"id":"UUID"},{"href":"mermaid.html","name":"Mermaid usage","id":"UUID"},{"name":"Latex usage","href":"latex.html","id":"UUID"},{"name":"Images","href":"images.html","id":"UUID"},{"name":"Autotitle","href":"autotitle.html","id":"UUID"},{"name":"includes","href":"includes.html","id":"UUID"},{"name":"Entry as include","href":"entry-as-include.html","id":"UUID"},{"name":"Includer of entry","href":"includer-of-entry.html","id":"UUID"},{"name":"generic","items":[{"name":"Note 1","href":"generic/1.html","id":"UUID"},{"name":"Note 1","href":"generic/2.html","id":"UUID"},{"name":"3","href":"generic/3.html","id":"UUID"},{"name":"Sub notes","items":[{"name":"Sub note 1","href":"generic/Sub notes/1.html","id":"UUID"},{"name":"Sub note 2","href":"generic/Sub notes/2.html","id":"UUID"}],"id":"UUID"}],"id":"UUID"},{"name":"openapi","items":[{"name":"Overview","href":"openapi/index.html","id":"UUID"},{"name":"test-controller","items":[{"name":"Overview","href":"openapi/test-controller/index.html","id":"UUID"},{"href":"openapi/test-controller/getWithPayloadResponse.html","name":"Simple get operation. тест новой верстки 3","id":"UUID"},{"href":"openapi/test-controller/getHiddenTest.html","name":"Test x-hidden attribute","id":"UUID"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -86,13 +86,13 @@ describe('Crawler manifest', () => {
86
86
  const manifest = JSON.parse(manifestContent);
87
87
 
88
88
  expect(manifest.notifications).toEqual({
89
- channels: ['email', 'messenger'],
90
89
  interval: 'daily',
91
- receivers: ['user1', 'user2'],
90
+ emailReceivers: ['user1', 'user2'],
91
+ messengerReceivers: ['user1', 'user2'],
92
92
  });
93
93
  });
94
94
 
95
- test('includes notifications from docs-viewer.crawler config with default channel', async () => {
95
+ test('includes notifications from docs-viewer.crawler config with default interval', async () => {
96
96
  const {inputPath, outputPath} = getTestPaths(
97
97
  'mocks/crawler-manifest/notifications-docs-viewer',
98
98
  );
@@ -106,9 +106,8 @@ describe('Crawler manifest', () => {
106
106
  const manifest = JSON.parse(manifestContent);
107
107
 
108
108
  expect(manifest.notifications).toEqual({
109
- channels: ['email'],
110
109
  interval: 'weekly',
111
- receivers: ['user3'],
110
+ emailReceivers: ['user3'],
112
111
  });
113
112
  });
114
113
 
@@ -0,0 +1,24 @@
1
+ import {describe, test} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('llms.txt', () => {
6
+ // Builds the same fixture in both md and html with `--llms` (variant B):
7
+ // - md output -> `${outputPath}` (llms-full.txt has includes merged)
8
+ // - html output -> `${outputPath}-html` (llms-full.txt keeps include directives)
9
+ // The fixture also has per-page frontmatter descriptions (surfaced in
10
+ // llms.txt) and a `when: showBeta` page that the default version filters
11
+ // out — proving the artifacts stay consistent with the built "version".
12
+ test('generates llms.txt and llms-full.txt for md and html', async () => {
13
+ const {inputPath, outputPath} = getTestPaths('mocks/llms');
14
+
15
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
16
+ md2md: true,
17
+ md2html: true,
18
+ args: '--llms',
19
+ });
20
+
21
+ await compareDirectories(outputPath);
22
+ await compareDirectories(`${outputPath}-html`);
23
+ });
24
+ });
@@ -0,0 +1,213 @@
1
+ import {existsSync, readFileSync} from 'node:fs';
2
+ import {resolve} from 'node:path';
3
+ import {describe, expect, it} from 'vitest';
4
+
5
+ import {TestAdapter, getTestPaths} from '../fixtures';
6
+
7
+ /**
8
+ * These tests cover the CLI-side guarantees for the OpenAPI spec companion that are
9
+ * implemented in `packages/cli` (the openapi build wrapper + build-manifest feature):
10
+ * - the standalone `*.openapi.json` file lands in the final output tree (md2md);
11
+ * - its name is derived from the source spec (`petstore.yaml` -> `petstore.openapi.json`);
12
+ * - it is recorded in the build manifest with the exact emitted path and the sibling
13
+ * `index` leading page;
14
+ * - emission does not depend on `--build-manifest`;
15
+ * - for static md2html builds the companion hint is baked into the leading page `<body>`
16
+ * as an HTML comment (the viewer does this at serve time for md2md, but md2html has no
17
+ * viewer), gated by the companion actually being emitted.
18
+ *
19
+ * The companion *content* (filtering, x-hidden stripping, render-mode switching) is produced
20
+ * by `@diplodoc/openapi-extension` and is covered by that package's own unit tests.
21
+ */
22
+ describe('OpenAPI spec companion (CLI build)', () => {
23
+ const COMPANION_PATH = 'api/petstore.openapi.json';
24
+ const LEADING_PAGE = 'api/index';
25
+
26
+ it('emits the .openapi.json companion into the md output tree', async () => {
27
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
28
+
29
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
30
+ md2md: true,
31
+ md2html: false,
32
+ });
33
+
34
+ const companion = resolve(outputPath, COMPANION_PATH);
35
+ expect(existsSync(companion)).toBe(true);
36
+
37
+ // The companion sits next to the generated leading page.
38
+ expect(existsSync(resolve(outputPath, 'api/index.md'))).toBe(true);
39
+
40
+ const raw = readFileSync(companion, 'utf-8');
41
+
42
+ // Valid JSON describing the spec.
43
+ const json = JSON.parse(raw);
44
+ expect(json.openapi).toBeTruthy();
45
+ expect(json.paths).toBeTruthy();
46
+
47
+ // Minified: no pretty-print whitespace.
48
+ expect(raw).not.toContain('\n');
49
+ expect(raw).toBe(JSON.stringify(json));
50
+ });
51
+
52
+ it('emits the companion even without --build-manifest', async () => {
53
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
54
+
55
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
56
+ md2md: true,
57
+ md2html: false,
58
+ });
59
+
60
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
61
+ // Manifest is opt-in, so it must be absent here.
62
+ expect(existsSync(resolve(outputPath, 'yfm-build-manifest.json'))).toBe(false);
63
+ });
64
+
65
+ it('records the companion in the build manifest with the exact emitted path', async () => {
66
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
67
+
68
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
69
+ md2md: true,
70
+ md2html: false,
71
+ args: '--build-manifest',
72
+ });
73
+
74
+ const manifest = JSON.parse(
75
+ readFileSync(resolve(outputPath, 'yfm-build-manifest.json'), 'utf-8'),
76
+ );
77
+
78
+ expect(Array.isArray(manifest.openapiCompanions)).toBe(true);
79
+
80
+ const entry = manifest.openapiCompanions.find(
81
+ (c: {companionPath: string}) => c.companionPath === COMPANION_PATH,
82
+ );
83
+ expect(entry).toBeDefined();
84
+ expect(entry.leadingPage).toBe(LEADING_PAGE);
85
+
86
+ // The path advertised by the manifest must resolve to a real file in the output.
87
+ expect(existsSync(resolve(outputPath, entry.companionPath))).toBe(true);
88
+ });
89
+
90
+ const COMMENT =
91
+ '<!-- json-схема со спецификацией доступна по ссылке: petstore.openapi.json -->';
92
+
93
+ it('bakes the companion comment into the static html body (md2html + ai opt-in)', async () => {
94
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
95
+
96
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
97
+ md2md: false,
98
+ md2html: true,
99
+ // md2html emits the companion only when AI companions are explicitly enabled.
100
+ args: '--ai-openapi-companions',
101
+ });
102
+
103
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
104
+
105
+ const html = readFileSync(resolve(outputPath, 'api/index.html'), 'utf-8');
106
+ expect(html).toContain(COMMENT);
107
+
108
+ // The comment must live inside <body>.
109
+ const body = html.slice(html.indexOf('<body'), html.indexOf('</body>'));
110
+ expect(body).toContain(COMMENT);
111
+ });
112
+
113
+ it('omits the companion and the comment for md2html without ai opt-in', async () => {
114
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
115
+
116
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
117
+ md2md: false,
118
+ md2html: true,
119
+ });
120
+
121
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(false);
122
+
123
+ const html = readFileSync(resolve(outputPath, 'api/index.html'), 'utf-8');
124
+ expect(html).not.toContain('json-схема со спецификацией доступна по ссылке');
125
+ });
126
+ });
127
+
128
+ /**
129
+ * Covers the leading-page render-mode knobs introduced together with the companion:
130
+ * - `leadingPage.spec.renderMode: inline | link` (toc);
131
+ * - `--max-openapi-include-inline-size` auto-switching `inline -> link`;
132
+ * - `ai.openapiCompanions: false` disabling companion emission.
133
+ *
134
+ * Assertions look at the generated leading page (`api/index.md`) and the presence of the
135
+ * companion file, which are the observable CLI-side outputs of these knobs.
136
+ */
137
+ describe('OpenAPI leading page render modes & params (CLI build)', () => {
138
+ const COMPANION_PATH = 'api/petstore.openapi.json';
139
+ const INDEX_MD = 'api/index.md';
140
+ // Inline mode embeds the spec inside a `{% cut %}` block; link mode points to the companion.
141
+ const INLINE_MARKER = '{% cut "Open API" %}';
142
+ const LINK_MARKER = '[Open API specification](petstore.openapi.json)';
143
+
144
+ it('renderMode: inline (default) embeds the spec and still emits the companion', async () => {
145
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
146
+
147
+ await TestAdapter.testBuildPass(inputPath, outputPath, {md2md: true, md2html: false});
148
+
149
+ const index = readFileSync(resolve(outputPath, INDEX_MD), 'utf-8');
150
+ expect(index).toContain(INLINE_MARKER);
151
+ expect(index).not.toContain(LINK_MARKER);
152
+
153
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
154
+ });
155
+
156
+ it('renderMode: link renders a link to the companion instead of inlining it', async () => {
157
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion-link');
158
+
159
+ await TestAdapter.testBuildPass(inputPath, outputPath, {md2md: true, md2html: false});
160
+
161
+ const index = readFileSync(resolve(outputPath, INDEX_MD), 'utf-8');
162
+ expect(index).toContain(LINK_MARKER);
163
+ expect(index).not.toContain(INLINE_MARKER);
164
+
165
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
166
+ });
167
+
168
+ it('--max-openapi-include-inline-size auto-switches inline -> link for large specs', async () => {
169
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
170
+
171
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
172
+ md2md: true,
173
+ md2html: false,
174
+ // 1 byte: any real spec exceeds it, forcing the link form.
175
+ args: '--max-openapi-include-inline-size 1',
176
+ });
177
+
178
+ const index = readFileSync(resolve(outputPath, INDEX_MD), 'utf-8');
179
+ expect(index).toContain(LINK_MARKER);
180
+ expect(index).not.toContain(INLINE_MARKER);
181
+
182
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
183
+ });
184
+
185
+ it('--max-openapi-include-inline-size 0 always renders the spec as a link', async () => {
186
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion');
187
+
188
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
189
+ md2md: true,
190
+ md2html: false,
191
+ args: '--max-openapi-include-inline-size 0',
192
+ });
193
+
194
+ const index = readFileSync(resolve(outputPath, INDEX_MD), 'utf-8');
195
+ expect(index).toContain(LINK_MARKER);
196
+ expect(index).not.toContain(INLINE_MARKER);
197
+
198
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(true);
199
+ });
200
+
201
+ it('ai.openapiCompanions: false disables the companion file (md2md)', async () => {
202
+ const {inputPath, outputPath} = getTestPaths('mocks/openapi-companion-disabled');
203
+
204
+ await TestAdapter.testBuildPass(inputPath, outputPath, {md2md: true, md2html: false});
205
+
206
+ expect(existsSync(resolve(outputPath, COMPANION_PATH))).toBe(false);
207
+
208
+ // With no companion to link to, the leading page falls back to inlining the spec.
209
+ const index = readFileSync(resolve(outputPath, INDEX_MD), 'utf-8');
210
+ expect(index).toContain(INLINE_MARKER);
211
+ expect(index).not.toContain(LINK_MARKER);
212
+ });
213
+ });
@@ -191,6 +191,72 @@ describe('Build themer feature', () => {
191
191
  expect(css).toContain('--g-color-private-base-brand-600-solid: rgb(234 4 5);');
192
192
  });
193
193
 
194
+ it.each([
195
+ ['md2md', true, false],
196
+ ['md2html', false, true],
197
+ ])('generates theme.css from codeHighlight only (%s)', async (_, md2md, md2html) => {
198
+ const {inputPath, outputPath} = getTestPaths('mocks/themer/test6');
199
+
200
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
201
+ md2md,
202
+ md2html,
203
+ });
204
+
205
+ const cssPath = join(outputPath, '_assets', 'style', 'theme.css');
206
+ const css = await readFile(cssPath, 'utf8');
207
+
208
+ expect(existsSync(join(inputPath, 'theme.yaml'))).toBe(false);
209
+ expect(css).toContain('.g-root_theme_light .dc-doc-page .yfm .hljs');
210
+ expect(css).toContain('.g-root_theme_dark .dc-doc-page .yfm .hljs');
211
+ expect(css).toContain('.g-root_theme_light .dc-doc-page .yfm .hljs-keyword');
212
+ expect(css).toContain('.g-root_theme_dark .dc-doc-page .yfm .hljs-keyword');
213
+ });
214
+
215
+ it.each([
216
+ ['md2md', true, false],
217
+ ['md2html', false, true],
218
+ ])(
219
+ 'generates theme.css from codeHighlight with theme.yaml overrides (%s)',
220
+ async (_, md2md, md2html) => {
221
+ const {inputPath, outputPath} = getTestPaths('mocks/themer/test7');
222
+
223
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
224
+ md2md,
225
+ md2html,
226
+ });
227
+
228
+ const cssPath = join(outputPath, '_assets', 'style', 'theme.css');
229
+ const css = await readFile(cssPath, 'utf8');
230
+
231
+ expect(css).toContain('.g-root_theme_light .dc-doc-page .yfm .hljs');
232
+ expect(css).toContain('.g-root_theme_dark .dc-doc-page .yfm .hljs');
233
+
234
+ expect(css).toContain('--yfm-color-code: #111111;');
235
+ expect(css).toContain('--yfm-color-code-background: #ffeeaa;');
236
+ expect(css).toContain('--yfm-color-code: #eeeeee;');
237
+ expect(css).toContain('--yfm-color-code-background: #221144;');
238
+
239
+ expect(css).toContain('color: var(--yfm-color-code);');
240
+ expect(css).toContain('background: var(--yfm-color-code-background);');
241
+ },
242
+ );
243
+
244
+ it.each([
245
+ ['md2md', 'md'],
246
+ ['md2html', 'html'],
247
+ ])('includes error for unknown code highlight theme (%s)', async (_, format) => {
248
+ const {inputPath, outputPath} = getTestPaths('mocks/themer/test8');
249
+
250
+ const report = await TestAdapter.build.run(inputPath, outputPath, ['-f', format]);
251
+
252
+ expect(report.code).toBe(1);
253
+ expect(
254
+ report.errors.includes(
255
+ 'ERR Failed to generate theme: Error: Unknown highlight.js theme: "unknown-highlight-theme"',
256
+ ),
257
+ ).toBe(true);
258
+ });
259
+
194
260
  it.each([
195
261
  ['md2md', true, false],
196
262
  ['md2html', false, true],
@@ -44,7 +44,13 @@ const buildFilesYamlTestTemplate = (
44
44
  const {inputPath, outputPath} = getTestPaths(testRootPath);
45
45
  const {md2md, md2html} = buildProps;
46
46
 
47
- await TestAdapter.testBuildPass(inputPath, outputPath, {md2html, md2md});
47
+ // Disable OpenAPI spec companions: the mock ships an openapi spec, and emitting the
48
+ // `*.openapi.json` companion would change these translation snapshots.
49
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
50
+ md2html,
51
+ md2md,
52
+ args: '--no-ai-openapi-companions',
53
+ });
48
54
 
49
55
  await compareDirectories(outputPath);
50
56
  });
@@ -4,5 +4,5 @@ docs-viewer:
4
4
  crawler:
5
5
  notifications:
6
6
  interval: weekly
7
- receivers:
7
+ emailReceivers:
8
8
  - user3
@@ -3,7 +3,9 @@ crawlerManifest: true
3
3
  crawler:
4
4
  notifications:
5
5
  interval: daily
6
- channels: ['email', 'messenger']
7
- receivers:
6
+ emailReceivers:
7
+ - user1
8
+ - user2
9
+ messengerReceivers:
8
10
  - user1
9
11
  - user2
@@ -0,0 +1 @@
1
+ allowHtml: true
@@ -0,0 +1,4 @@
1
+ ## Requirements
2
+
3
+ - Node.js 18+
4
+ - 2 GB RAM
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Full reference of the public HTTP endpoints.
3
+ ---
4
+
5
+ # API Reference
6
+
7
+ ## GET /things
8
+
9
+ Returns the list of things.
@@ -0,0 +1,4 @@
1
+ # Beta Feature
2
+
3
+ This page is gated behind `when: showBeta` and must NOT appear in the llms
4
+ artifacts for the default (showBeta = false) version.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Overview
3
+ description: What this product is and how to get started.
4
+ ---
5
+
6
+ # Overview
7
+
8
+ Welcome to **My Product** — the documentation home page.
@@ -0,0 +1,2 @@
1
+ default:
2
+ showBeta: false
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Install the product and build your first project.
3
+ ---
4
+
5
+ # Getting Started
6
+
7
+ Run the installer and create your first project.
8
+
9
+ {% include [Requirements](_includes/requirements.md) %}
@@ -0,0 +1,11 @@
1
+ title: My Product
2
+ href: index.md
3
+
4
+ items:
5
+ - name: Getting Started
6
+ href: start.md
7
+ - name: API Reference
8
+ href: api.md
9
+ - name: Beta Feature
10
+ href: beta.md
11
+ when: showBeta
@@ -0,0 +1,29 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Pet Store
4
+ version: v1
5
+ servers:
6
+ - url: http://localhost:8080
7
+ paths:
8
+ /pets:
9
+ get:
10
+ tags:
11
+ - pets
12
+ summary: List pets
13
+ operationId: listPets
14
+ responses:
15
+ "200":
16
+ description: OK
17
+ content:
18
+ application/json:
19
+ schema:
20
+ $ref: '#/components/schemas/Pet'
21
+ components:
22
+ schemas:
23
+ Pet:
24
+ type: object
25
+ properties:
26
+ id:
27
+ type: integer
28
+ name:
29
+ type: string
@@ -0,0 +1,9 @@
1
+ title: OpenAPI Companion Test
2
+ items:
3
+ - name: API
4
+ include:
5
+ path: api
6
+ includers:
7
+ - name: openapi
8
+ input: petstore.yaml
9
+ mode: link
@@ -0,0 +1,2 @@
1
+ ai:
2
+ openapiCompanions: false
@@ -0,0 +1,29 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Pet Store
4
+ version: v1
5
+ servers:
6
+ - url: http://localhost:8080
7
+ paths:
8
+ /pets:
9
+ get:
10
+ tags:
11
+ - pets
12
+ summary: List pets
13
+ operationId: listPets
14
+ responses:
15
+ "200":
16
+ description: OK
17
+ content:
18
+ application/json:
19
+ schema:
20
+ $ref: '#/components/schemas/Pet'
21
+ components:
22
+ schemas:
23
+ Pet:
24
+ type: object
25
+ properties:
26
+ id:
27
+ type: integer
28
+ name:
29
+ type: string
@@ -0,0 +1,9 @@
1
+ title: OpenAPI Companion Disabled Test
2
+ items:
3
+ - name: API
4
+ include:
5
+ path: api
6
+ includers:
7
+ - name: openapi
8
+ input: petstore.yaml
9
+ mode: link
@@ -0,0 +1,29 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ title: Pet Store
4
+ version: v1
5
+ servers:
6
+ - url: http://localhost:8080
7
+ paths:
8
+ /pets:
9
+ get:
10
+ tags:
11
+ - pets
12
+ summary: List pets
13
+ operationId: listPets
14
+ responses:
15
+ "200":
16
+ description: OK
17
+ content:
18
+ application/json:
19
+ schema:
20
+ $ref: '#/components/schemas/Pet'
21
+ components:
22
+ schemas:
23
+ Pet:
24
+ type: object
25
+ properties:
26
+ id:
27
+ type: integer
28
+ name:
29
+ type: string
@@ -0,0 +1,12 @@
1
+ title: OpenAPI Companion Link Test
2
+ items:
3
+ - name: API
4
+ include:
5
+ path: api
6
+ includers:
7
+ - name: openapi
8
+ input: petstore.yaml
9
+ leadingPage:
10
+ spec:
11
+ renderMode: 'link'
12
+ mode: link
@@ -0,0 +1,3 @@
1
+ codeHighlight:
2
+ light: github
3
+ dark: github-dark
@@ -0,0 +1,11 @@
1
+ # Code highlight theme test
2
+
3
+ ```python
4
+ def hello(name: str) -> None:
5
+ print(f"Hello, {name}")
6
+ ```
7
+
8
+ ```ts
9
+ const value: string = 'test';
10
+ console.log(value);
11
+ ```
@@ -0,0 +1,5 @@
1
+ title: Test
2
+ href: index.md
3
+ items:
4
+ - name: Index
5
+ href: index.md
@@ -0,0 +1,3 @@
1
+ codeHighlight:
2
+ light: github
3
+ dark: github-dark
@@ -0,0 +1,5 @@
1
+ # Invalid code highlight theme test
2
+
3
+ ```ts
4
+ const value = 'test';
5
+ ```
@@ -0,0 +1,7 @@
1
+ light:
2
+ code: '#111111'
3
+ code-background: '#ffeeaa'
4
+
5
+ dark:
6
+ code: '#eeeeee'
7
+ code-background: '#221144'
@@ -0,0 +1,5 @@
1
+ title: Test
2
+ href: index.md
3
+ items:
4
+ - name: Index
5
+ href: index.md
@@ -0,0 +1,3 @@
1
+ codeHighlight:
2
+ light: unknown-highlight-theme
3
+ dark: github-dark
@@ -0,0 +1,5 @@
1
+ # Invalid code highlight theme test
2
+
3
+ ```ts
4
+ const value = 'test';
5
+ ```
@@ -0,0 +1,5 @@
1
+ title: Test
2
+ href: index.md
3
+ items:
4
+ - name: Index
5
+ href: index.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.43.3",
3
+ "version": "5.45.0",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },