@diplodoc/cli-tests 5.13.2 → 5.14.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 (30) hide show
  1. package/e2e/__snapshots__/includes.test.ts.snap +477 -0
  2. package/e2e/__snapshots__/metadata.spec.ts.snap +19 -6
  3. package/e2e/__snapshots__/pdf-page.spec.ts.snap +2 -2
  4. package/e2e/__snapshots__/regression.test.ts.snap +64 -38
  5. package/e2e/includes.test.ts +38 -0
  6. package/fixtures/utils/file.ts +21 -0
  7. package/mocks/includes/input/.yfm +1 -0
  8. package/mocks/includes/input/_assets/4.png +0 -0
  9. package/mocks/includes/input/includes/commented-include.md +5 -0
  10. package/mocks/includes/input/includes/deep-include.md +13 -0
  11. package/mocks/includes/input/includes/fragments.md +23 -0
  12. package/mocks/includes/input/includes/nested-include.md +5 -0
  13. package/mocks/includes/input/includes/no-title-include.md +19 -0
  14. package/mocks/includes/input/includes/root-include.md +11 -0
  15. package/mocks/includes/input/includes/user.md +5 -0
  16. package/mocks/includes/input/index.md +62 -0
  17. package/mocks/includes/input/level1/includes/level1-include.md +11 -0
  18. package/mocks/includes/input/level1/level2/includes/level2-include.md +11 -0
  19. package/mocks/includes/input/level1/level2/page2.md +29 -0
  20. package/mocks/includes/input/level1/page1.md +29 -0
  21. package/mocks/includes/input/presets.yaml +3 -0
  22. package/mocks/includes/input/toc-include.md +13 -0
  23. package/mocks/includes/input/toc.yaml +13 -0
  24. package/mocks/includes-missing/input/index.md +7 -0
  25. package/mocks/includes-missing/input/toc.yaml +3 -0
  26. package/mocks/metadata/md2html-with-metadata/input/.yfm +1 -0
  27. package/mocks/metadata/md2html-with-metadata/input/page.md +3 -1
  28. package/mocks/regression/input/includes/fragments.md +17 -0
  29. package/mocks/regression/input/includes.md +4 -0
  30. package/package.json +1 -1
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports[`Allow load custom resources > md2html with metadata > filelist 1`] = `
4
4
  "[
5
+ ".yfm",
5
6
  "index.html",
6
7
  "page.html",
7
8
  "project/config.html",
@@ -10,6 +11,11 @@ exports[`Allow load custom resources > md2html with metadata > filelist 1`] = `
10
11
  `;
11
12
 
12
13
  exports[`Allow load custom resources > md2html with metadata 1`] = `
14
+ "mtimes: true
15
+ "
16
+ `;
17
+
18
+ exports[`Allow load custom resources > md2html with metadata 2`] = `
13
19
  "<!DOCTYPE html>
14
20
  <html lang="ru" dir="ltr">
15
21
  <head>
@@ -17,6 +23,8 @@ exports[`Allow load custom resources > md2html with metadata 1`] = `
17
23
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
24
  <base href="./" />
19
25
  <title>Documentation | Documentation</title>
26
+ <meta http-equiv="last-modified" content="2025-10-15T00:00:00.000Z">
27
+ <meta property="article:modified_time" content="2025-10-15T00:00:00.000Z">
20
28
  <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
21
29
  <meta name="test-yfm" content="inline test">
22
30
  <meta name="yfm-config" content="config test">
@@ -25,7 +33,7 @@ exports[`Allow load custom resources > md2html with metadata 1`] = `
25
33
  <body class="g-root g-root_theme_light">
26
34
  <div id="root"></div>
27
35
  <script type="application/json" id="diplodoc-state">
28
- {"data":{"leading":true,"data":{"title":"Documentation","description":"","links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"}],"title":"Documentation","noIndex":true,"vcsPath":"index.yaml"},"title":"Documentation"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
36
+ {"data":{"leading":true,"data":{"title":"Documentation","description":"","links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"}],"title":"Documentation","noIndex":true,"vcsPath":"index.yaml","updatedAt":"2025-10-15T00:00:00.000Z"},"title":"Documentation"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
29
37
  </script>
30
38
  <script type="application/javascript">
31
39
  const data = document.querySelector('script#diplodoc-state');
@@ -39,7 +47,7 @@ exports[`Allow load custom resources > md2html with metadata 1`] = `
39
47
  </html>"
40
48
  `;
41
49
 
42
- exports[`Allow load custom resources > md2html with metadata 2`] = `
50
+ exports[`Allow load custom resources > md2html with metadata 3`] = `
43
51
  "<!DOCTYPE html>
44
52
  <html lang="ru" dir="ltr">
45
53
  <head>
@@ -47,10 +55,13 @@ exports[`Allow load custom resources > md2html with metadata 2`] = `
47
55
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
48
56
  <base href="./" />
49
57
  <title>Page Title | Documentation</title>
58
+ <meta http-equiv="last-modified" content="2025-10-15T00:00:00.000Z">
59
+ <meta property="article:modified_time" content="2025-10-15T00:00:00.000Z">
50
60
  <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
51
61
  <meta name="test-yfm" content="inline test">
52
62
  <meta name="yfm-config" content="config test">
53
63
  <meta name="yfm" content="builder in page">
64
+ <meta property="og:title" content="Some kind of headline">
54
65
  <meta name="description" content="Some test description">
55
66
  <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
56
67
  <link rel="icon" type="image/x-icon" href="/favicon.ico">
@@ -58,7 +69,7 @@ exports[`Allow load custom resources > md2html with metadata 2`] = `
58
69
  <body class="g-root g-root_theme_light">
59
70
  <div id="root"></div>
60
71
  <script type="application/json" id="diplodoc-state">
61
- {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","content":"builder in page"},{"name":"description","content":"Some test description"}],"title":"Page Title","description":"Some test description","interface":{"toc":false,"favicon-src":"/favicon.ico"},"vcsPath":"page.md"},"headings":[],"title":"Page Title"},"router":{"pathname":"page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":false,"search":true,"feedback":true,"favicon-src":"/favicon.ico"}}
72
+ {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","content":"builder in page"},{"property":"og:title","content":"Some kind of headline"},{"name":"description","content":"Some test description"}],"title":"Page Title","description":"Some test description","interface":{"toc":false,"favicon-src":"/favicon.ico"},"vcsPath":"page.md","updatedAt":"2025-10-15T00:00:00.000Z"},"headings":[],"title":"Page Title"},"router":{"pathname":"page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":false,"search":true,"feedback":true,"favicon-src":"/favicon.ico"}}
62
73
  </script>
63
74
  <script type="application/javascript">
64
75
  const data = document.querySelector('script#diplodoc-state');
@@ -72,7 +83,7 @@ exports[`Allow load custom resources > md2html with metadata 2`] = `
72
83
  </html>"
73
84
  `;
74
85
 
75
- exports[`Allow load custom resources > md2html with metadata 3`] = `
86
+ exports[`Allow load custom resources > md2html with metadata 4`] = `
76
87
  "<!DOCTYPE html>
77
88
  <html lang="ru" dir="ltr">
78
89
  <head>
@@ -80,6 +91,8 @@ exports[`Allow load custom resources > md2html with metadata 3`] = `
80
91
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
81
92
  <base href="../" />
82
93
  <title>Documentation</title>
94
+ <meta http-equiv="last-modified" content="2025-10-15T00:00:00.000Z">
95
+ <meta property="article:modified_time" content="2025-10-15T00:00:00.000Z">
83
96
  <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
84
97
  <meta name="test-yfm" content="inline test">
85
98
  <meta name="yfm-config" content="config test">
@@ -89,7 +102,7 @@ exports[`Allow load custom resources > md2html with metadata 3`] = `
89
102
  <body class="g-root g-root_theme_light">
90
103
  <div id="root"></div>
91
104
  <script type="application/json" id="diplodoc-state">
92
- {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","value":"builder in config"}],"vcsPath":"project/config.md"},"headings":[],"title":""},"router":{"pathname":"project/config","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
105
+ {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","value":"builder in config"}],"vcsPath":"project/config.md","updatedAt":"2025-10-15T00:00:00.000Z"},"headings":[],"title":""},"router":{"pathname":"project/config","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
93
106
  </script>
94
107
  <script type="application/javascript">
95
108
  const data = document.querySelector('script#diplodoc-state');
@@ -103,7 +116,7 @@ exports[`Allow load custom resources > md2html with metadata 3`] = `
103
116
  </html>"
104
117
  `;
105
118
 
106
- exports[`Allow load custom resources > md2html with metadata 4`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"index.html","items":[{"name":"Documentation","href":"page.html","id":"UUID"},{"name":"Config","href":"project/config.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
119
+ exports[`Allow load custom resources > md2html with metadata 5`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"index.html","items":[{"name":"Documentation","href":"page.html","id":"UUID"},{"name":"Config","href":"project/config.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
107
120
 
108
121
  exports[`Allow load custom resources > md2md with metadata > filelist 1`] = `
109
122
  "[
@@ -64,7 +64,7 @@ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 2
64
64
  <body class="g-root g-root_theme_light">
65
65
  <div id="root"></div>
66
66
  <script type="application/json" id="diplodoc-state">
67
- {"data":{"leading":false,"html":"&lt;h2 data-original-article=\\"index.html\\"&gt;Header&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#index\\" id=\\"index\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Content&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"#page1\\"&gt;Link 1&lt;/a&gt;&lt;br&gt;/n&lt;a href=\\"page2.html\\"&gt;Link 2&lt;/a&gt;&lt;/p&gt;/n&lt;hr class=\\"yfm-page__delimeter\\"&gt;&lt;h2 id=\\"syntax_test_syntax-page\\" data-original-article=\\"syntax/test.html\\"&gt;&lt;a href=\\"#syntax_test_syntax-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Syntax page&lt;/span&gt;&lt;/a&gt;Syntax page&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#syntax_test\\" id=\\"syntax_test\\"&gt;&lt;/a&gt;&lt;/h2&gt;/n&lt;hr class=\\"yfm-page__delimeter\\"&gt;&lt;h2 data-original-article=\\"page1.html\\"&gt;Page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href=\\"page2.html#hash\\"&gt;Link&lt;/a&gt;&lt;/p&gt;/n&lt;h4 id=\\"page1_include-link-page\\"&gt;&lt;a href=\\"#page1_include-link-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Include link page&lt;/span&gt;&lt;/a&gt;Include link page&lt;/h4&gt;/n&lt;p&gt;&lt;a href=\\"../syntax/test.html\\"&gt;link&lt;/a&gt;&lt;/p&gt;/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension"},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
67
+ {"data":{"leading":false,"html":"&lt;h2 data-original-article=\\"index.html\\"&gt;Header&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#index\\" id=\\"index\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Content&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"#page1\\"&gt;Link 1&lt;/a&gt;&lt;br&gt;/n&lt;a href=\\"page2.html\\"&gt;Link 2&lt;/a&gt;&lt;/p&gt;/n&lt;hr class=\\"yfm-page__delimeter\\"&gt;&lt;h2 id=\\"syntax_test_syntax-page\\" data-original-article=\\"syntax/test.html\\"&gt;&lt;a href=\\"#syntax_test_syntax-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Syntax page&lt;/span&gt;&lt;/a&gt;Syntax page&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#syntax_test\\" id=\\"syntax_test\\"&gt;&lt;/a&gt;&lt;/h2&gt;/n&lt;hr class=\\"yfm-page__delimeter\\"&gt;&lt;h2 data-original-article=\\"page1.html\\"&gt;Page 1&lt;a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href=\\"page2.html#hash\\"&gt;Link&lt;/a&gt;&lt;/p&gt;/n&lt;h4 id=\\"page1_include-link-page\\"&gt;&lt;a href=\\"#page1_include-link-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Include link page&lt;/span&gt;&lt;/a&gt;Include link page&lt;/h4&gt;/n&lt;p&gt;&lt;a href=\\"#syntax_test\\"&gt;link&lt;/a&gt;&lt;/p&gt;/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension"},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
68
68
  </script>
69
69
  <script type="application/javascript">
70
70
  const data = document.querySelector('script#diplodoc-state');
@@ -78,4 +78,4 @@ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 2
78
78
  </html>"
79
79
  `;
80
80
 
81
- exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 3`] = `"{"data":{"leading":false,"html":"<h2 data-original-article=\\"index.html\\">Header<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#index\\" id=\\"index\\"></a></h2><p>Content</p>/n<p><a href=\\"#page1\\">Link 1</a><br>/n<a href=\\"page2.html\\">Link 2</a></p>/n<hr class=\\"yfm-page__delimeter\\"><h2 id=\\"syntax_test_syntax-page\\" data-original-article=\\"syntax/test.html\\"><a href=\\"#syntax_test_syntax-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Syntax page</span></a>Syntax page<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#syntax_test\\" id=\\"syntax_test\\"></a></h2>/n<hr class=\\"yfm-page__delimeter\\"><h2 data-original-article=\\"page1.html\\">Page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"></a></h2><p><a href=\\"page2.html#hash\\">Link</a></p>/n<h4 id=\\"page1_include-link-page\\"><a href=\\"#page1_include-link-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Include link page</span></a>Include link page</h4>/n<p><a href=\\"../syntax/test.html\\">link</a></p>/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension","toc":{"title":"Skip html extension","href":"index.html","items":[{"name":"Syntax","href":"syntax/test.html","id":"UUID"},{"name":"Title 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"}},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}"`;
81
+ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 3`] = `"{"data":{"leading":false,"html":"<h2 data-original-article=\\"index.html\\">Header<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#index\\" id=\\"index\\"></a></h2><p>Content</p>/n<p><a href=\\"#page1\\">Link 1</a><br>/n<a href=\\"page2.html\\">Link 2</a></p>/n<hr class=\\"yfm-page__delimeter\\"><h2 id=\\"syntax_test_syntax-page\\" data-original-article=\\"syntax/test.html\\"><a href=\\"#syntax_test_syntax-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Syntax page</span></a>Syntax page<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#syntax_test\\" id=\\"syntax_test\\"></a></h2>/n<hr class=\\"yfm-page__delimeter\\"><h2 data-original-article=\\"page1.html\\">Page 1<a class=\\"yfm-anchor\\" aria-hidden=\\"true\\" href=\\"#page1\\" id=\\"page1\\"></a></h2><p><a href=\\"page2.html#hash\\">Link</a></p>/n<h4 id=\\"page1_include-link-page\\"><a href=\\"#page1_include-link-page\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Include link page</span></a>Include link page</h4>/n<p><a href=\\"#syntax_test\\">link</a></p>/n","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension","toc":{"title":"Skip html extension","href":"index.html","items":[{"name":"Syntax","href":"syntax/test.html","id":"UUID"},{"name":"Title 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"}},"router":{"pathname":"pdf-page","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}"`;
@@ -19,6 +19,7 @@ exports[`Regression > internal > filelist 1`] = `
19
19
  "included-item.md",
20
20
  "includes.md",
21
21
  "includes/deep-hash.md",
22
+ "includes/fragments-hash.md",
22
23
  "includes/test-hash.md",
23
24
  "includes/tools-hash.md",
24
25
  "includes/user-hash.md",
@@ -272,6 +273,10 @@ Text
272
273
 
273
274
  {% include [test](includes/test-hash.md) %}
274
275
 
276
+ {% include [test](includes/fragments-hash.md#f1) %}
277
+
278
+ {% include [test](includes/fragments-hash.md#p1) %}
279
+
275
280
  <!--{% include [For includes/deep.md](includes/deep.md) %}-->
276
281
  {% include [For includes/deep-hash.md](includes/deep-hash.md) %}
277
282
 
@@ -289,21 +294,42 @@ exports[`Regression > internal 12`] = `
289
294
  `;
290
295
 
291
296
  exports[`Regression > internal 13`] = `
292
- "Test
297
+ "### F1 {#f1}
298
+ Content F1
299
+
300
+ ## F2 {#f2}
301
+ Content F2
302
+
303
+ ### F2.1 {#f2.1}
304
+ Content F2.1
305
+
306
+ ## F3 {#f3}
307
+ Content F3
308
+
309
+ Some paragraph with anchor {#p1}
310
+
311
+ Some paragraph without anchor
312
+
313
+ Some paragraph with anchor {#p2}
293
314
  "
294
315
  `;
295
316
 
296
317
  exports[`Regression > internal 14`] = `
297
- "Tool: Hammer and Laser
318
+ "Test
298
319
  "
299
320
  `;
300
321
 
301
322
  exports[`Regression > internal 15`] = `
302
- "Bob
323
+ "Tool: Hammer and Laser
303
324
  "
304
325
  `;
305
326
 
306
327
  exports[`Regression > internal 16`] = `
328
+ "Bob
329
+ "
330
+ `;
331
+
332
+ exports[`Regression > internal 17`] = `
307
333
  "description:
308
334
  - Some text
309
335
  links:
@@ -319,7 +345,7 @@ meta:
319
345
  "
320
346
  `;
321
347
 
322
- exports[`Regression > internal 17`] = `
348
+ exports[`Regression > internal 18`] = `
323
349
  "---
324
350
  metadata:
325
351
  - name: generator
@@ -332,7 +358,7 @@ $/sqrt{3x-1}+(1+x)^2$
332
358
  "
333
359
  `;
334
360
 
335
- exports[`Regression > internal 18`] = `
361
+ exports[`Regression > internal 19`] = `
336
362
  "---
337
363
  metadata:
338
364
  - name: generator
@@ -347,7 +373,7 @@ vcsPath: merge/merge.md
347
373
  "
348
374
  `;
349
375
 
350
- exports[`Regression > internal 19`] = `
376
+ exports[`Regression > internal 20`] = `
351
377
  "---
352
378
  metadata:
353
379
  - name: generator
@@ -361,7 +387,7 @@ Should be linked in toc.yaml
361
387
  "
362
388
  `;
363
389
 
364
- exports[`Regression > internal 20`] = `
390
+ exports[`Regression > internal 21`] = `
365
391
  "items:
366
392
  - name: Use merged
367
393
  href: merge.md
@@ -373,7 +399,7 @@ path: merge/toc.yaml
373
399
  "
374
400
  `;
375
401
 
376
- exports[`Regression > internal 21`] = `
402
+ exports[`Regression > internal 22`] = `
377
403
  "---
378
404
  metadata:
379
405
  - name: generator
@@ -396,7 +422,7 @@ Some mermaid info
396
422
  "
397
423
  `;
398
424
 
399
- exports[`Regression > internal 22`] = `
425
+ exports[`Regression > internal 23`] = `
400
426
  "---
401
427
  metadata:
402
428
  - name: generator
@@ -496,7 +522,7 @@ vcsPath: openapi/index.md
496
522
  <!-- markdownlint-disable-file -->"
497
523
  `;
498
524
 
499
- exports[`Regression > internal 23`] = `
525
+ exports[`Regression > internal 24`] = `
500
526
  "---
501
527
  metadata:
502
528
  - name: generator
@@ -581,7 +607,7 @@ Generated server url
581
607
  [*Deprecated]: No longer supported, please use an alternative and newer version."
582
608
  `;
583
609
 
584
- exports[`Regression > internal 24`] = `
610
+ exports[`Regression > internal 25`] = `
585
611
  "---
586
612
  metadata:
587
613
  - name: generator
@@ -597,7 +623,7 @@ vcsPath: openapi/test-controller/index.md
597
623
  <!-- markdownlint-disable-file -->"
598
624
  `;
599
625
 
600
- exports[`Regression > internal 25`] = `
626
+ exports[`Regression > internal 26`] = `
601
627
  "files:
602
628
  - from: c.md
603
629
  to: d.md
@@ -607,7 +633,7 @@ common:
607
633
  "
608
634
  `;
609
635
 
610
- exports[`Regression > internal 26`] = `
636
+ exports[`Regression > internal 27`] = `
611
637
  "---
612
638
  metadata:
613
639
  - name: generator
@@ -622,7 +648,7 @@ Item 1 text
622
648
  "
623
649
  `;
624
650
 
625
- exports[`Regression > internal 27`] = `
651
+ exports[`Regression > internal 28`] = `
626
652
  "items:
627
653
  - name: Verbose root (index.yaml) will be transformed to index.html
628
654
  href: index.yaml
@@ -679,13 +705,13 @@ path: toc.yaml
679
705
  "
680
706
  `;
681
707
 
682
- exports[`Regression > internal 28`] = `
708
+ exports[`Regression > internal 29`] = `
683
709
  "preprocess:
684
710
  mergeAutotitles: true
685
711
  "
686
712
  `;
687
713
 
688
- exports[`Regression > internal 29`] = `
714
+ exports[`Regression > internal 30`] = `
689
715
  "<!DOCTYPE html>
690
716
  <html lang="ru" dir="ltr">
691
717
  <head>
@@ -713,7 +739,7 @@ exports[`Regression > internal 29`] = `
713
739
  </html>"
714
740
  `;
715
741
 
716
- exports[`Regression > internal 30`] = `
742
+ exports[`Regression > internal 31`] = `
717
743
  "<!DOCTYPE html>
718
744
  <html lang="ru" dir="ltr">
719
745
  <head>
@@ -741,7 +767,7 @@ exports[`Regression > internal 30`] = `
741
767
  </html>"
742
768
  `;
743
769
 
744
- exports[`Regression > internal 31`] = `
770
+ exports[`Regression > internal 32`] = `
745
771
  "<!DOCTYPE html>
746
772
  <html lang="ru" dir="ltr">
747
773
  <head>
@@ -769,7 +795,7 @@ exports[`Regression > internal 31`] = `
769
795
  </html>"
770
796
  `;
771
797
 
772
- exports[`Regression > internal 32`] = `
798
+ exports[`Regression > internal 33`] = `
773
799
  "<!DOCTYPE html>
774
800
  <html lang="ru" dir="ltr">
775
801
  <head>
@@ -797,7 +823,7 @@ exports[`Regression > internal 32`] = `
797
823
  </html>"
798
824
  `;
799
825
 
800
- exports[`Regression > internal 33`] = `
826
+ exports[`Regression > internal 34`] = `
801
827
  "<!DOCTYPE html>
802
828
  <html lang="ru" dir="ltr">
803
829
  <head>
@@ -825,7 +851,7 @@ exports[`Regression > internal 33`] = `
825
851
  </html>"
826
852
  `;
827
853
 
828
- exports[`Regression > internal 34`] = `
854
+ exports[`Regression > internal 35`] = `
829
855
  "<!DOCTYPE html>
830
856
  <html lang="ru" dir="ltr">
831
857
  <head>
@@ -853,7 +879,7 @@ exports[`Regression > internal 34`] = `
853
879
  </html>"
854
880
  `;
855
881
 
856
- exports[`Regression > internal 35`] = `
882
+ exports[`Regression > internal 36`] = `
857
883
  "<!DOCTYPE html>
858
884
  <html lang="ru" dir="ltr">
859
885
  <head>
@@ -881,7 +907,7 @@ exports[`Regression > internal 35`] = `
881
907
  </html>"
882
908
  `;
883
909
 
884
- exports[`Regression > internal 36`] = `
910
+ exports[`Regression > internal 37`] = `
885
911
  "<!DOCTYPE html>
886
912
  <html lang="ru" dir="ltr">
887
913
  <head>
@@ -909,7 +935,7 @@ exports[`Regression > internal 36`] = `
909
935
  </html>"
910
936
  `;
911
937
 
912
- exports[`Regression > internal 37`] = `
938
+ exports[`Regression > internal 38`] = `
913
939
  "<!DOCTYPE html>
914
940
  <html lang="ru" dir="ltr">
915
941
  <head>
@@ -937,7 +963,7 @@ exports[`Regression > internal 37`] = `
937
963
  </html>"
938
964
  `;
939
965
 
940
- exports[`Regression > internal 38`] = `
966
+ exports[`Regression > internal 39`] = `
941
967
  "<!DOCTYPE html>
942
968
  <html lang="ru" dir="ltr">
943
969
  <head>
@@ -965,7 +991,7 @@ exports[`Regression > internal 38`] = `
965
991
  </html>"
966
992
  `;
967
993
 
968
- exports[`Regression > internal 39`] = `
994
+ exports[`Regression > internal 40`] = `
969
995
  "<!DOCTYPE html>
970
996
  <html lang="ru" dir="ltr">
971
997
  <head>
@@ -979,7 +1005,7 @@ exports[`Regression > internal 39`] = `
979
1005
  <body class="g-root g-root_theme_light">
980
1006
  <div id="root"></div>
981
1007
  <script type="application/json" id="diplodoc-state">
982
- {"data":{"leading":false,"html":"&lt;p&gt;Text&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;p&gt;Test&lt;/p&gt;/n/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"../latex.html\\"&gt;&lt;img src=\\"_assets/3.png\\" alt=\\"img 3\\" /&gt;&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Link after include&lt;br /&gt;/n&lt;a href=\\"1.html#subtitle\\"&gt;Subtitle&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Link after include&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"includes.md"},"headings":[],"title":""},"router":{"pathname":"includes","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
1008
+ {"data":{"leading":false,"html":"&lt;p&gt;Text&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;p&gt;Test&lt;/p&gt;/n&lt;h3 id=\\"f1\\"&gt;&lt;a href=\\"includes.html#f1\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;F1&lt;/span&gt;&lt;/a&gt;F1&lt;/h3&gt;/n&lt;p&gt;Content F1&lt;/p&gt;/n&lt;p id=\\"p1\\"&gt;Some paragraph with anchor&lt;/p&gt;/n/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"latex.html\\"&gt;&lt;img src=\\"_assets/3.png\\" alt=\\"img 3\\" /&gt;&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Link after include&lt;br /&gt;/n&lt;a href=\\"1.html#subtitle\\"&gt;Subtitle&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Link after include&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"includes.md"},"headings":[],"title":""},"router":{"pathname":"includes","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
983
1009
  </script>
984
1010
  <script type="application/javascript">
985
1011
  const data = document.querySelector('script#diplodoc-state');
@@ -993,7 +1019,7 @@ exports[`Regression > internal 39`] = `
993
1019
  </html>"
994
1020
  `;
995
1021
 
996
- exports[`Regression > internal 40`] = `
1022
+ exports[`Regression > internal 41`] = `
997
1023
  "<!DOCTYPE html>
998
1024
  <html lang="ru" dir="ltr">
999
1025
  <head>
@@ -1021,7 +1047,7 @@ exports[`Regression > internal 40`] = `
1021
1047
  </html>"
1022
1048
  `;
1023
1049
 
1024
- exports[`Regression > internal 41`] = `
1050
+ exports[`Regression > internal 42`] = `
1025
1051
  "<!DOCTYPE html>
1026
1052
  <html lang="ru" dir="ltr">
1027
1053
  <head>
@@ -1049,7 +1075,7 @@ exports[`Regression > internal 41`] = `
1049
1075
  </html>"
1050
1076
  `;
1051
1077
 
1052
- exports[`Regression > internal 42`] = `
1078
+ exports[`Regression > internal 43`] = `
1053
1079
  "<!DOCTYPE html>
1054
1080
  <html lang="ru" dir="ltr">
1055
1081
  <head>
@@ -1077,7 +1103,7 @@ exports[`Regression > internal 42`] = `
1077
1103
  </html>"
1078
1104
  `;
1079
1105
 
1080
- exports[`Regression > internal 43`] = `
1106
+ exports[`Regression > internal 44`] = `
1081
1107
  "<!DOCTYPE html>
1082
1108
  <html lang="ru" dir="ltr">
1083
1109
  <head>
@@ -1105,9 +1131,9 @@ exports[`Regression > internal 43`] = `
1105
1131
  </html>"
1106
1132
  `;
1107
1133
 
1108
- exports[`Regression > internal 44`] = `"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"};"`;
1134
+ exports[`Regression > internal 45`] = `"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"};"`;
1109
1135
 
1110
- exports[`Regression > internal 45`] = `
1136
+ exports[`Regression > internal 46`] = `
1111
1137
  "<!DOCTYPE html>
1112
1138
  <html lang="ru" dir="ltr">
1113
1139
  <head>
@@ -1135,7 +1161,7 @@ exports[`Regression > internal 45`] = `
1135
1161
  </html>"
1136
1162
  `;
1137
1163
 
1138
- exports[`Regression > internal 46`] = `
1164
+ exports[`Regression > internal 47`] = `
1139
1165
  "<!DOCTYPE html>
1140
1166
  <html lang="ru" dir="ltr">
1141
1167
  <head>
@@ -1165,7 +1191,7 @@ exports[`Regression > internal 46`] = `
1165
1191
  </html>"
1166
1192
  `;
1167
1193
 
1168
- exports[`Regression > internal 47`] = `
1194
+ exports[`Regression > internal 48`] = `
1169
1195
  "<!DOCTYPE html>
1170
1196
  <html lang="ru" dir="ltr">
1171
1197
  <head>
@@ -1195,7 +1221,7 @@ exports[`Regression > internal 47`] = `
1195
1221
  </html>"
1196
1222
  `;
1197
1223
 
1198
- exports[`Regression > internal 48`] = `
1224
+ exports[`Regression > internal 49`] = `
1199
1225
  "<!DOCTYPE html>
1200
1226
  <html lang="ru" dir="ltr">
1201
1227
  <head>
@@ -1223,7 +1249,7 @@ exports[`Regression > internal 48`] = `
1223
1249
  </html>"
1224
1250
  `;
1225
1251
 
1226
- exports[`Regression > internal 49`] = `
1252
+ exports[`Regression > internal 50`] = `
1227
1253
  "<!DOCTYPE html>
1228
1254
  <html lang="ru" dir="ltr">
1229
1255
  <head>
@@ -1251,4 +1277,4 @@ exports[`Regression > internal 49`] = `
1251
1277
  </html>"
1252
1278
  `;
1253
1279
 
1254
- exports[`Regression > internal 50`] = `"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":"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":"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"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
1280
+ exports[`Regression > internal 51`] = `"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":"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":"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"}],"id":"UUID"}],"id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -0,0 +1,38 @@
1
+ import {describe, expect, test} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('Includes', () => {
6
+ test('Various include scenarios', async () => {
7
+ const {inputPath, outputPath} = getTestPaths('mocks/includes');
8
+
9
+ // Test md2md transformation
10
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
11
+ md2md: true,
12
+ md2html: false,
13
+ });
14
+ await compareDirectories(outputPath);
15
+
16
+ // Test md2html transformation
17
+ await TestAdapter.testBuildPass(outputPath, outputPath + '-html', {
18
+ md2md: false,
19
+ md2html: true,
20
+ });
21
+ await compareDirectories(outputPath + '-html');
22
+ });
23
+
24
+ test('Include with missing file should fail', async () => {
25
+ const {inputPath, outputPath} = getTestPaths('mocks/includes-missing');
26
+
27
+ // Test md2md transformation should fail
28
+ const mdReport = await TestAdapter.build.run(inputPath, outputPath, ['-f', 'md']);
29
+ expect(mdReport.code).toBeGreaterThan(0);
30
+
31
+ // Test md2html transformation should fail
32
+ const htmlReport = await TestAdapter.build.run(inputPath, outputPath + '-html', [
33
+ '-f',
34
+ 'html',
35
+ ]);
36
+ expect(htmlReport.code).toBeGreaterThan(0);
37
+ });
38
+ });
@@ -27,6 +27,27 @@ export function stripSystemLinks(content: string) {
27
27
  '',
28
28
  );
29
29
 
30
+ content = content.replace(
31
+ new RegExp(
32
+ `<meta http-equiv="last-modified" content="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z">`,
33
+ 'g',
34
+ ),
35
+ '<meta http-equiv="last-modified" content="2025-10-15T00:00:00.000Z">',
36
+ );
37
+
38
+ content = content.replace(
39
+ new RegExp(
40
+ `<meta property="article:modified_time" content="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z">`,
41
+ 'g',
42
+ ),
43
+ '<meta property="article:modified_time" content="2025-10-15T00:00:00.000Z">',
44
+ );
45
+
46
+ content = content.replace(
47
+ new RegExp(`"updatedAt":"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z"`, 'g'),
48
+ '"updatedAt":"2025-10-15T00:00:00.000Z"',
49
+ );
50
+
30
51
  content = content.replace(/^[ \t]*\r?\n/gm, '');
31
52
 
32
53
  return content;
@@ -0,0 +1 @@
1
+ projectTitle: Test Includes
File without changes
@@ -0,0 +1,5 @@
1
+ This is a commented include.
2
+
3
+ <!-- {% include [test](test.md) %} -->
4
+
5
+ [Link to index](../index.md)
@@ -0,0 +1,13 @@
1
+ # Deep nested include [→ index](../index.md) {#deep-nested-include}
2
+
3
+ [Link to index](../index.md)
4
+
5
+ [Link to level1 page1](../level1/page1.md)
6
+
7
+ [Link to level2 page2](../level1/level2/page2.md)
8
+
9
+ This is a deep nested include.
10
+
11
+ {% include [user](user.md) %}
12
+
13
+ ![img 3](../_assets/{{img_3}})
@@ -0,0 +1,23 @@
1
+ # Fragments for include
2
+
3
+ ## Section 1 {#section1}
4
+
5
+ This is content of section 1.
6
+
7
+ ## Section 2 {#section2}
8
+
9
+ This is content of section 2.
10
+
11
+ ### Subsection 2.1 {#subsection21}
12
+
13
+ This is content of subsection 2.1.
14
+
15
+ ## Section 3 {#section3}
16
+
17
+ This is content of section 3.
18
+
19
+ Some paragraph with anchor {#p1}
20
+
21
+ Some paragraph without anchor
22
+
23
+ Some paragraph with anchor {#p2}
@@ -0,0 +1,5 @@
1
+ # Nested include [→ index](../index.md) {#nested-include}
2
+
3
+ This is a nested include.
4
+
5
+ {% include [level1-include](../level1/includes/level1-include.md) %}