@diplodoc/cli-tests 5.12.3 → 5.12.5

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.
@@ -1,42 +1,30 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`Pdf page mode > transforms links correctly > filelist 1`] = `
3
+ exports[`Pdf page mode > creates a pdf folder when the .yfm option is specified > filelist 1`] = `
4
4
  "[
5
- ".yfm",
6
- "index.html",
7
- "page1.html",
8
- "page2.html",
9
- "page3.html",
10
- "toc.js"
5
+ "pdf-page-toc.js",
6
+ "pdf-page.html",
7
+ "pdf-page.json"
11
8
  ]"
12
9
  `;
13
10
 
14
- exports[`Pdf page mode > transforms links correctly 1`] = `
15
- "allowHTML: true
11
+ exports[`Pdf page mode > creates a pdf folder when the .yfm option is specified 1`] = `"window.__DATA__.data.toc = {"title":"Skip html extension","href":"#index","items":[{"name":"Title 1","href":"#page1","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
16
12
 
17
- hiddenPolicy:
18
- pdf: true
19
-
20
- docs-viewer:
21
- pdf: true
22
- "
23
- `;
24
-
25
- exports[`Pdf page mode > transforms links correctly 2`] = `
13
+ exports[`Pdf page mode > creates a pdf folder when the .yfm option is specified 2`] = `
26
14
  "<!DOCTYPE html>
27
15
  <html lang="ru" dir="ltr">
28
16
  <head>
29
17
  <meta charset="utf-8">
30
18
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
31
19
  <base href="./" />
32
- <title>Header | Skip html extension</title>
20
+ <title>Skip html extension | Skip html extension</title>
33
21
  <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
34
22
  <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
35
23
  </head>
36
24
  <body class="g-root g-root_theme_light">
37
25
  <div id="root"></div>
38
26
  <script type="application/json" id="diplodoc-state">
39
- {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"page1.html\\"&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","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Header"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
27
+ {"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 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","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}}
40
28
  </script>
41
29
  <script type="application/javascript">
42
30
  const data = document.querySelector('script#diplodoc-state');
@@ -45,82 +33,38 @@ exports[`Pdf page mode > transforms links correctly 2`] = `
45
33
  })(data.innerText));
46
34
  window.STATIC_CONTENT = false;
47
35
  </script>
48
- <script type="application/javascript" defer src="toc.js"></script>
36
+ <script type="application/javascript" defer src="pdf-page.html"></script>
49
37
  </body>
50
38
  </html>"
51
39
  `;
52
40
 
53
- exports[`Pdf page mode > transforms links correctly 3`] = `
54
- "<!DOCTYPE html>
55
- <html lang="ru" dir="ltr">
56
- <head>
57
- <meta charset="utf-8">
58
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
59
- <base href="./" />
60
- <title>Page 1 | Skip html extension</title>
61
- <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
62
- <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
63
- </head>
64
- <body class="g-root g-root_theme_light">
65
- <div id="root"></div>
66
- <script type="application/json" id="diplodoc-state">
67
- {"data":{"leading":false,"html":"&lt;p&gt;&lt;a href=\\"page2.html#hash\\"&gt;Link&lt;/a&gt;&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page1.md"},"headings":[],"title":"Page 1"},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
68
- </script>
69
- <script type="application/javascript">
70
- const data = document.querySelector('script#diplodoc-state');
71
- window.__DATA__ = JSON.parse((function unescape(string) {
72
- return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
73
- })(data.innerText));
74
- window.STATIC_CONTENT = false;
75
- </script>
76
- <script type="application/javascript" defer src="toc.js"></script>
77
- </body>
78
- </html>"
79
- `;
41
+ exports[`Pdf page mode > creates a pdf folder when the .yfm option 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 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","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension","toc":{"title":"Skip html extension","href":"index.html","items":[{"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}}"`;
80
42
 
81
- exports[`Pdf page mode > transforms links correctly 4`] = `
82
- "<!DOCTYPE html>
83
- <html lang="ru" dir="ltr">
84
- <head>
85
- <meta charset="utf-8">
86
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
87
- <base href="./" />
88
- <title>Page 2 | Skip html extension</title>
89
- <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
90
- <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
91
- </head>
92
- <body class="g-root g-root_theme_light">
93
- <div id="root"></div>
94
- <script type="application/json" id="diplodoc-state">
95
- {"data":{"leading":false,"html":"&lt;h2 id=\\"hash\\"&gt;&lt;a href=\\"page2.html#hash\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;hash&lt;/span&gt;&lt;/a&gt;hash&lt;/h2&gt;/n&lt;p&gt;&lt;a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\"&gt;External link&lt;/a&gt;&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page2.md"},"headings":[{"title":"hash","href":"page2.html#hash","level":2}],"title":"Page 2"},"router":{"pathname":"page2","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
96
- </script>
97
- <script type="application/javascript">
98
- const data = document.querySelector('script#diplodoc-state');
99
- window.__DATA__ = JSON.parse((function unescape(string) {
100
- return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
101
- })(data.innerText));
102
- window.STATIC_CONTENT = false;
103
- </script>
104
- <script type="application/javascript" defer src="toc.js"></script>
105
- </body>
106
- </html>"
43
+ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified > filelist 1`] = `
44
+ "[
45
+ "pdf-page-toc.js",
46
+ "pdf-page.html",
47
+ "pdf-page.json"
48
+ ]"
107
49
  `;
108
50
 
109
- exports[`Pdf page mode > transforms links correctly 5`] = `
51
+ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 1`] = `"window.__DATA__.data.toc = {"title":"Skip html extension","href":"#index","items":[{"name":"Title 1","href":"#page1","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
52
+
53
+ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 2`] = `
110
54
  "<!DOCTYPE html>
111
55
  <html lang="ru" dir="ltr">
112
56
  <head>
113
57
  <meta charset="utf-8">
114
58
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
115
59
  <base href="./" />
116
- <title>Page 3 | Skip html extension</title>
60
+ <title>Skip html extension | Skip html extension</title>
117
61
  <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
118
62
  <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
119
63
  </head>
120
64
  <body class="g-root g-root_theme_light">
121
65
  <div id="root"></div>
122
66
  <script type="application/json" id="diplodoc-state">
123
- {"data":{"leading":false,"html":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page3.md"},"headings":[],"title":"Page 3"},"router":{"pathname":"page3","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 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","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}}
124
68
  </script>
125
69
  <script type="application/javascript">
126
70
  const data = document.querySelector('script#diplodoc-state');
@@ -129,9 +73,9 @@ exports[`Pdf page mode > transforms links correctly 5`] = `
129
73
  })(data.innerText));
130
74
  window.STATIC_CONTENT = false;
131
75
  </script>
132
- <script type="application/javascript" defer src="toc.js"></script>
76
+ <script type="application/javascript" defer src="pdf-page.html"></script>
133
77
  </body>
134
78
  </html>"
135
79
  `;
136
80
 
137
- exports[`Pdf page mode > transforms links correctly 6`] = `"window.__DATA__.data.toc = {"title":"Skip html extension","href":"index.html","items":[{"name":"Title 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
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 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","headings":[],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"Skip html extension","toc":{"title":"Skip html extension","href":"index.html","items":[{"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}}"`;
@@ -699,7 +699,7 @@ exports[`Regression > internal 29`] = `
699
699
  <body class="g-root g-root_theme_light">
700
700
  <div id="root"></div>
701
701
  <script type="application/json" id="diplodoc-state">
702
- {"data":{"leading":false,"html":"&lt;p&gt;Text {{not-var}} {{skip()}} default-var-value&lt;/p&gt;/n&lt;p&gt;Text &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-1"&gt;{{not-var}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-2"&gt;{{skip()}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-3"&gt;default-var-value&lt;/code&gt;&lt;/p&gt;/n&lt;p&gt;Text&lt;/p&gt;/n/n &lt;div class=\\"yfm-clipboard\\"&gt;/n &lt;pre&gt;&lt;code class=\\"hljs\\"&gt;{{not-var}}/n/n{{skip()}}/n/ndefault-var-value/n&lt;/code&gt;&lt;/pre&gt;/n/n &lt;button class=\\"yfm-clipboard-button\\"&gt;/n &lt;svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"yfm-clipboard-icon\\" data-animation=\\"9\\"&gt;/n &lt;path fill=\\"currentColor\\" d=\\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\\"&gt;&lt;/path&gt;/n &lt;path stroke=\\"currentColor\\" fill=\\"transparent\\" stroke-width=\\"1.5\\" d=\\"M9.5 13l3 3l5 -5\\" visibility=\\"hidden\\"&gt;/n &lt;animate id=\\"visibileAnimation-9\\" attributeName=\\"visibility\\" from=\\"hidden\\" to=\\"visible\\" dur=\\"0.2s\\" fill=\\"freeze\\" begin&gt;&lt;/animate&gt;/n &lt;animate id=\\"hideAnimation-9\\" attributeName=\\"visibility\\" from=\\"visible\\" to=\\"hidden\\" dur=\\"1s\\" begin=\\"visibileAnimation-9.end+1\\" fill=\\"freeze\\"&gt;&lt;/animate&gt;/n &lt;/path&gt;/n &lt;/svg&gt;/n &lt;/button&gt;/n &lt;/div&gt;/n&lt;p&gt;&lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-4"&gt;[not a link](./path/to/relative/file.md)&lt;/code&gt;&lt;/p&gt;/n&lt;h2 id=\\"subtitle\\"&gt;&lt;a href=\\"1.html#subtitle\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Subtitle&lt;/span&gt;&lt;/a&gt;Subtitle&lt;/h2&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html\\"&gt;Mermaid usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html#info\\"&gt;Mermaid info&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"latex.html\\"&gt;Latex usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"includes\\"&gt;noext-link&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;div class=\\"yfm inline_code_tooltip\\" id=\\"tooltip_inline_clipboard_dialog\\" role=\\"dialog\\"&gt;Скопировано&lt;/div&gt;","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"1.md"},"headings":[{"title":"Subtitle","href":"1.html#subtitle","level":2}],"title":"Title"},"router":{"pathname":"1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
702
+ {"data":{"leading":false,"html":"&lt;p&gt;Text {{not-var}} {{skip()}} default-var-value&lt;/p&gt;/n&lt;p&gt;Text &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-1"&gt;{{not-var}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-2"&gt;{{skip()}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-3"&gt;default-var-value&lt;/code&gt;&lt;/p&gt;/n&lt;p&gt;Text&lt;/p&gt;/n/n &lt;div class=\\"yfm-clipboard\\"&gt;/n &lt;pre&gt;&lt;code class=\\"hljs\\"&gt;{{not-var}}/n/n{{skip()}}/n/ndefault-var-value/n&lt;/code&gt;&lt;/pre&gt;/n/n &lt;button class=\\"yfm-clipboard-button\\"&gt;/n &lt;svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"yfm-clipboard-icon\\" data-animation=\\"9\\"&gt;/n &lt;path fill=\\"currentColor\\" d=\\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\\"&gt;&lt;/path&gt;/n &lt;path stroke=\\"currentColor\\" fill=\\"transparent\\" stroke-width=\\"1.5\\" d=\\"M9.5 13l3 3l5 -5\\" visibility=\\"hidden\\"&gt;/n &lt;animate id=\\"visibileAnimation-9\\" attributeName=\\"visibility\\" from=\\"hidden\\" to=\\"visible\\" dur=\\"0.2s\\" fill=\\"freeze\\" begin&gt;&lt;/animate&gt;/n &lt;animate id=\\"hideAnimation-9\\" attributeName=\\"visibility\\" from=\\"visible\\" to=\\"hidden\\" dur=\\"1s\\" begin=\\"visibileAnimation-9.end+1\\" fill=\\"freeze\\"&gt;&lt;/animate&gt;/n &lt;/path&gt;/n &lt;/svg&gt;/n &lt;/button&gt;/n &lt;/div&gt;/n&lt;p&gt;&lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-4"&gt;[not a link](./path/to/relative/file.md)&lt;/code&gt;&lt;/p&gt;/n&lt;h2 id=\\"subtitle\\"&gt;&lt;a href=\\"1.html#subtitle\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Subtitle&lt;/span&gt;&lt;/a&gt;Subtitle&lt;/h2&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html\\"&gt;Mermaid usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html#info\\"&gt;Mermaid info&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"latex.html\\"&gt;Latex usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"includes\\"&gt;noext-link&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"1.md"},"headings":[{"title":"Subtitle","href":"1.html#subtitle","level":2}],"title":"Title"},"router":{"pathname":"1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
703
703
  </script>
704
704
  <script type="application/javascript">
705
705
  const data = document.querySelector('script#diplodoc-state');
@@ -31,6 +31,17 @@ describe('Errors', () => {
31
31
  ]);
32
32
  });
33
33
 
34
+ test('mocks/errors/object-validation', ({html}: TestResult) => {
35
+ expectErrors(html, [
36
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[1].name: found [object Object] value',
37
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[2].href: found [object Object] value',
38
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[3].items[0].name: found [object Object] value',
39
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[4].title: found [object Object] value',
40
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[5].label: found [object Object] value',
41
+ 'ERR Invalid toc structure in toc.yaml -> toc.yaml at items[6].navigation: found [object Object] value',
42
+ ]);
43
+ });
44
+
34
45
  it('translate extract with filtered links', async () => {
35
46
  const {inputPath, outputPath} = getTestPaths('mocks/errors/extract-filtered-link');
36
47
 
@@ -1,16 +1,31 @@
1
- import {describe, it} from 'vitest';
1
+ import {describe, test} from 'vitest';
2
2
 
3
3
  import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
4
 
5
- describe('Pdf page mode', () => {
6
- it('transforms links correctly', async () => {
7
- const {inputPath, outputPath} = getTestPaths('mocks/pdf-page');
5
+ const generateMapTestTemplate = (testTitle: string, testRootPath: string, args: string) => {
6
+ test(testTitle, async () => {
7
+ const {inputPath, outputPath} = getTestPaths(testRootPath);
8
8
 
9
9
  await TestAdapter.testBuildPass(inputPath, outputPath, {
10
10
  md2md: false,
11
11
  md2html: true,
12
- args: '-j2',
12
+ args,
13
13
  });
14
- await compareDirectories(outputPath);
14
+
15
+ await compareDirectories(`${outputPath}/pdf`);
15
16
  });
17
+ };
18
+
19
+ describe('Pdf page mode', () => {
20
+ generateMapTestTemplate(
21
+ 'creates a pdf folder when the --pdf flag is specified',
22
+ 'mocks/pdf-page/flag-enabled',
23
+ '-j2 --pdf',
24
+ );
25
+
26
+ generateMapTestTemplate(
27
+ 'creates a pdf folder when the .yfm option is specified',
28
+ 'mocks/pdf-page/yfm-config',
29
+ '-j2',
30
+ );
16
31
  });
@@ -0,0 +1,3 @@
1
+ # Test Document
2
+
3
+ This is a test document for object validation.
@@ -0,0 +1,14 @@
1
+ items:
2
+ - name: Valid Item
3
+ href: valid.md
4
+ - name: {{some-var}}
5
+ href: invalid-name.md
6
+ - name: Invalid Href Item
7
+ href: {{some-var}}
8
+ - name: Parent Item
9
+ items:
10
+ - name: {{some-var}}
11
+ href: nested-invalid.md
12
+ - title: {{some-var}}
13
+ - label: {{some-var}}
14
+ - navigation: {{some-var}}
@@ -0,0 +1,7 @@
1
+ # Page 2
2
+
3
+ ## hash
4
+
5
+ [External link](https://example.com)
6
+
7
+ <div data-pdf-hidden="true"> Will be deleted in pdf <div>
@@ -0,0 +1,5 @@
1
+ allowHTML: true
2
+
3
+ pdf:
4
+ enabled: true
5
+ hddenPolicy: true
@@ -0,0 +1,6 @@
1
+ # Header
2
+
3
+ Content
4
+
5
+ [Link 1](page1.md)
6
+ [Link 2](page2.md)
@@ -0,0 +1,3 @@
1
+ # Page 1
2
+
3
+ [Link](page2.md#hash)
@@ -0,0 +1,7 @@
1
+ # Page 2
2
+
3
+ ## hash
4
+
5
+ [External link](https://example.com)
6
+
7
+ <div data-pdf-hidden="true"> Will be deleted in pdf <div>
@@ -0,0 +1 @@
1
+ # Page 3
@@ -0,0 +1,15 @@
1
+ title: Skip html extension
2
+ href: index.md
3
+
4
+ items:
5
+ - name: Title 1
6
+ href: page1.md
7
+ - name: Title 2
8
+ href: page2.md
9
+ hidden: true
10
+ - name: Without href
11
+ hidden: true
12
+ items:
13
+ - name: Title 3
14
+ href: page3.md
15
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.12.3",
3
+ "version": "5.12.5",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },
@@ -1,7 +0,0 @@
1
- allowHTML: true
2
-
3
- hiddenPolicy:
4
- pdf: true
5
-
6
- docs-viewer:
7
- pdf: true
@@ -1,5 +0,0 @@
1
- # Page 2
2
-
3
- ## hash
4
-
5
- [External link](https://example.com)