@diplodoc/cli-tests 5.25.4 → 5.26.1

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 (24) hide show
  1. package/e2e/__snapshots__/alternates.test.ts.snap +3 -3
  2. package/e2e/__snapshots__/pdf-page.spec.ts.snap +18 -0
  3. package/e2e/__snapshots__/rtl.spec.ts.snap +4 -4
  4. package/e2e/errors.spec.ts +20 -1
  5. package/e2e/pdf-page.spec.ts +8 -0
  6. package/mocks/errors/unreachable-link-in-include/input/_includes/chapter.md +1 -0
  7. package/mocks/errors/unreachable-link-in-include/input/index.md +5 -0
  8. package/mocks/errors/unreachable-link-in-include/input/toc.yaml +1 -0
  9. package/mocks/errors/unreachable-link-in-nested-include/input/_includes/chapter.md +3 -0
  10. package/mocks/errors/unreachable-link-in-nested-include/input/_includes/details.md +1 -0
  11. package/mocks/errors/unreachable-link-in-nested-include/input/index.md +3 -0
  12. package/mocks/errors/unreachable-link-in-nested-include/input/toc.yaml +1 -0
  13. package/mocks/errors/valid-link-in-include/input/_includes/content.md +1 -0
  14. package/mocks/errors/valid-link-in-include/input/index.md +3 -0
  15. package/mocks/errors/valid-link-in-include/input/page.md +3 -0
  16. package/mocks/errors/valid-link-in-include/input/toc.yaml +4 -0
  17. package/mocks/pdf-page/multiple-tocs/input/.yfm +2 -0
  18. package/mocks/pdf-page/multiple-tocs/input/section1/index.md +5 -0
  19. package/mocks/pdf-page/multiple-tocs/input/section1/page1.md +3 -0
  20. package/mocks/pdf-page/multiple-tocs/input/section1/toc.yaml +6 -0
  21. package/mocks/pdf-page/multiple-tocs/input/section2/index.md +5 -0
  22. package/mocks/pdf-page/multiple-tocs/input/section2/page1.md +3 -0
  23. package/mocks/pdf-page/multiple-tocs/input/section2/toc.yaml +6 -0
  24. package/package.json +1 -1
@@ -178,8 +178,8 @@ metadata:
178
178
  alternate:
179
179
  - az/about
180
180
  - en/about
181
- - ru/about
182
181
  - https://my-other-site.com/about
182
+ - ru/about
183
183
  canonical: ru/about.html
184
184
  vcsPath: ru/about.md
185
185
  ---
@@ -476,7 +476,7 @@ exports[`Alternates > internal 24`] = `
476
476
  <body class="g-root g-root_theme_light">
477
477
  <div id="root"></div>
478
478
  <script type="application/json" id="diplodoc-state">
479
- {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"az/about.html","hreflang":"az"},{"href":"en/about.html","hreflang":"en"},{"href":"ru/about.html","hreflang":"ru"},{"href":"https://my-other-site.com/about"}],"canonical":"ru/about.html","vcsPath":"ru/about.md"},"headings":[],"title":"About"},"router":{"pathname":"ru/about","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
479
+ {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"az/about.html","hreflang":"az"},{"href":"en/about.html","hreflang":"en"},{"href":"https://my-other-site.com/about"},{"href":"ru/about.html","hreflang":"ru"}],"canonical":"ru/about.html","vcsPath":"ru/about.md"},"headings":[],"title":"About"},"router":{"pathname":"ru/about","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
480
480
  </script>
481
481
  <script type="application/javascript">
482
482
  const data = document.querySelector('script#diplodoc-state');
@@ -815,7 +815,7 @@ exports[`Alternates > skip-html-extension 11`] = `
815
815
  <body class="g-root g-root_theme_light">
816
816
  <div id="root"></div>
817
817
  <script type="application/json" id="diplodoc-state">
818
- {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"az/about","hreflang":"az"},{"href":"en/about","hreflang":"en"},{"href":"ru/about","hreflang":"ru"},{"href":"https://my-other-site.com/about"}],"canonical":"ru/about","vcsPath":"ru/about.md"},"headings":[],"title":"About"},"router":{"pathname":"ru/about","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
818
+ {"data":{"leading":false,"html":"&lt;p&gt;Content&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"az/about","hreflang":"az"},{"href":"en/about","hreflang":"en"},{"href":"https://my-other-site.com/about"},{"href":"ru/about","hreflang":"ru"}],"canonical":"ru/about","vcsPath":"ru/about.md"},"headings":[],"title":"About"},"router":{"pathname":"ru/about","depth":2,"base":"../"},"lang":"ru","langs":["ru","en",{"lang":"az","tld":"az"}],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
819
819
  </script>
820
820
  <script type="application/javascript">
821
821
  const data = document.querySelector('script#diplodoc-state');
@@ -110,6 +110,24 @@ exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 2
110
110
 
111
111
  exports[`Pdf page mode > creates a pdf folder when the --pdf flag is specified 3`] = `"{"data":{"leading":false,"pdfTitlePages":{"content":"","pageCount":0},"cssLink":["_bundle/search-css-0","_bundle/app-css-1","_bundle/search-css-2","_bundle/search-css-3","_bundle/search-css-4"],"html":"<div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><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</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><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</div><div class=\\"pdf-page-wrapper\\" data-page-break=\\"true\\"><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</div>","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}}"`;
112
112
 
113
+ exports[`Pdf page mode > creates pdf-page.json for each standalone toc > filelist 1`] = `
114
+ "[
115
+ ".yfm",
116
+ "section1/index.html",
117
+ "section1/page1.html",
118
+ "section1/pdf/pdf-page-toc.js",
119
+ "section1/pdf/pdf-page.html",
120
+ "section1/pdf/pdf-page.json",
121
+ "section1/toc.js",
122
+ "section2/index.html",
123
+ "section2/page1.html",
124
+ "section2/pdf/pdf-page-toc.js",
125
+ "section2/pdf/pdf-page.html",
126
+ "section2/pdf/pdf-page.json",
127
+ "section2/toc.js"
128
+ ]"
129
+ `;
130
+
113
131
  exports[`Pdf page with titles > Generates content for pdf genrator with title pages > filelist 1`] = `
114
132
  "[
115
133
  "pdf-page-toc.js",
@@ -101,7 +101,7 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
101
101
  <body class="g-root g-root_theme_light">
102
102
  <div id="root"></div>
103
103
  <script type="application/json" id="diplodoc-state">
104
- {"data":{"leading":true,"data":{"title":"Documentation","links":[{"title":"Documentation","href":"ar/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"en/index.html","hreflang":"en"},{"href":"ar/index.html","hreflang":"ar"}],"canonical":"ar/index.html","vcsPath":"ar/index.yaml"},"title":"Documentation"},"router":{"pathname":"ar/index","depth":2,"base":"../"},"lang":"ar","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
104
+ {"data":{"leading":true,"data":{"title":"Documentation","links":[{"title":"Documentation","href":"ar/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"ar/index.html","hreflang":"ar"},{"href":"en/index.html","hreflang":"en"}],"canonical":"ar/index.html","vcsPath":"ar/index.yaml"},"title":"Documentation"},"router":{"pathname":"ar/index","depth":2,"base":"../"},"lang":"ar","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
105
105
  </script>
106
106
  <script type="application/javascript">
107
107
  const data = document.querySelector('script#diplodoc-state');
@@ -132,7 +132,7 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
132
132
  <body class="g-root g-root_theme_light">
133
133
  <div id="root"></div>
134
134
  <script type="application/json" id="diplodoc-state">
135
- {"data":{"leading":false,"html":"&lt;p&gt;توثيق&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"en/page.html","hreflang":"en"},{"href":"ar/page.html","hreflang":"ar"}],"canonical":"ar/page.html","vcsPath":"ar/page.md"},"headings":[],"title":""},"router":{"pathname":"ar/page","depth":2,"base":"../"},"lang":"ar","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
135
+ {"data":{"leading":false,"html":"&lt;p&gt;توثيق&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"ar/page.html","hreflang":"ar"},{"href":"en/page.html","hreflang":"en"}],"canonical":"ar/page.html","vcsPath":"ar/page.md"},"headings":[],"title":""},"router":{"pathname":"ar/page","depth":2,"base":"../"},"lang":"ar","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
136
136
  </script>
137
137
  <script type="application/javascript">
138
138
  const data = document.querySelector('script#diplodoc-state');
@@ -165,7 +165,7 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
165
165
  <body class="g-root g-root_theme_light">
166
166
  <div id="root"></div>
167
167
  <script type="application/json" id="diplodoc-state">
168
- {"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":"en/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"en/index.html","hreflang":"en"},{"href":"ar/index.html","hreflang":"ar"}],"canonical":"en/index.html","title":"Documentation","noIndex":true,"vcsPath":"en/index.yaml"},"title":"Documentation"},"router":{"pathname":"en/index","depth":2,"base":"../"},"lang":"en","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
168
+ {"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":"en/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"alternate":[{"href":"ar/index.html","hreflang":"ar"},{"href":"en/index.html","hreflang":"en"}],"canonical":"en/index.html","title":"Documentation","noIndex":true,"vcsPath":"en/index.yaml"},"title":"Documentation"},"router":{"pathname":"en/index","depth":2,"base":"../"},"lang":"en","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
169
169
  </script>
170
170
  <script type="application/javascript">
171
171
  const data = document.querySelector('script#diplodoc-state');
@@ -197,7 +197,7 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
197
197
  <body class="g-root g-root_theme_light">
198
198
  <div id="root"></div>
199
199
  <script type="application/json" id="diplodoc-state">
200
- {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder"}],"alternate":[{"href":"en/page.html","hreflang":"en"},{"href":"ar/page.html","hreflang":"ar"}],"canonical":"en/page.html","vcsPath":"en/page.md"},"headings":[],"title":""},"router":{"pathname":"en/page","depth":2,"base":"../"},"lang":"en","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
200
+ {"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder"}],"alternate":[{"href":"ar/page.html","hreflang":"ar"},{"href":"en/page.html","hreflang":"en"}],"canonical":"en/page.html","vcsPath":"en/page.md"},"headings":[],"title":""},"router":{"pathname":"en/page","depth":2,"base":"../"},"lang":"en","langs":["ar","en"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
201
201
  </script>
202
202
  <script type="application/javascript">
203
203
  const data = document.querySelector('script#diplodoc-state');
@@ -92,10 +92,29 @@ describe('Errors', () => {
92
92
  });
93
93
  });
94
94
 
95
+ describe('Include chain errors', () => {
96
+ test('mocks/errors/unreachable-link-in-include', ({html}: TestResult) => {
97
+ expectErrors(html, [
98
+ 'ERR index.md: 5: YFM003 / unreachable-link Link is unreachable [Context: "index.md:5 → _includes/chapter.md:1 ↛ _includes/nonexistent.html; Reason: File is not declared in toc"]',
99
+ ]);
100
+ });
101
+
102
+ test('mocks/errors/unreachable-link-in-nested-include', ({html}: TestResult) => {
103
+ expectErrors(html, [
104
+ 'ERR index.md: 3: YFM003 / unreachable-link Link is unreachable [Context: "index.md:3 → _includes/chapter.md:3 → _includes/details.md:1 ↛ _includes/nonexistent.html; Reason: File is not declared in toc"]',
105
+ ]);
106
+ });
107
+
108
+ test('mocks/errors/valid-link-in-include', ({html}: TestResult) => {
109
+ const yfm003 = html.errors.filter((e: string) => e.includes('YFM003'));
110
+ expect(yfm003).toEqual([]);
111
+ });
112
+ });
113
+
95
114
  describe('Warnings', () => {
96
115
  test('mocks/warning/unreachable-autotitle', ({html}: TestResult) => {
97
116
  expectWarnings(html, [
98
- 'WARN index.md: 1: YFM010 / unreachable-autotitle-anchor Auto title anchor is unreachable [Context: "[Unreachable autotitle anchor: "link.html#unknown_yfm010"] [{#T}](./link.md#unknown_yfm010)"]',
117
+ 'WARN index.md: 1: YFM010 / unreachable-autotitle-anchor Auto title anchor is unreachable [Context: "Unreachable autotitle anchor: "link.html#unknown_yfm010"; Line: 1"]',
99
118
  ]);
100
119
  });
101
120
  });
@@ -66,6 +66,14 @@ describe('Pdf page mode', () => {
66
66
  'mocks/pdf-page/yfm-config',
67
67
  '-j2',
68
68
  );
69
+
70
+ generateMapTestTemplate(
71
+ 'creates pdf-page.json for each standalone toc',
72
+ 'mocks/pdf-page/multiple-tocs',
73
+ '--pdf',
74
+ '',
75
+ true,
76
+ );
69
77
  });
70
78
 
71
79
  describe('Pdf page with titles', () => {
@@ -0,0 +1 @@
1
+ [broken link](nonexistent.md)
@@ -0,0 +1,5 @@
1
+ # Main page
2
+
3
+ Some content here.
4
+
5
+ {% include [chapter](_includes/chapter.md) %}
@@ -0,0 +1 @@
1
+ href: index.md
@@ -0,0 +1,3 @@
1
+ # Chapter
2
+
3
+ {% include [details](details.md) %}
@@ -0,0 +1 @@
1
+ [broken link](nonexistent.md)
@@ -0,0 +1,3 @@
1
+ # Main page
2
+
3
+ {% include [chapter](_includes/chapter.md) %}
@@ -0,0 +1 @@
1
+ Check out [the page](../page.md) for details.
@@ -0,0 +1,3 @@
1
+ # Main page
2
+
3
+ {% include [content](_includes/content.md) %}
@@ -0,0 +1,3 @@
1
+ # Page
2
+
3
+ Some page content.
@@ -0,0 +1,4 @@
1
+ href: index.md
2
+ items:
3
+ - name: Page
4
+ href: page.md
@@ -0,0 +1,2 @@
1
+ pdf:
2
+ enabled: true
@@ -0,0 +1,5 @@
1
+ # Section 1
2
+
3
+ Content
4
+
5
+ [Page 1](page1.md)
@@ -0,0 +1,3 @@
1
+ # Page 1
2
+
3
+ Content
@@ -0,0 +1,6 @@
1
+ title: Section 1
2
+ href: index.md
3
+
4
+ items:
5
+ - name: Page 1
6
+ href: page1.md
@@ -0,0 +1,5 @@
1
+ # Section 2
2
+
3
+ Content
4
+
5
+ [Page 1](page1.md)
@@ -0,0 +1,3 @@
1
+ # Page 1
2
+
3
+ Content
@@ -0,0 +1,6 @@
1
+ title: Section 2
2
+ href: index.md
3
+
4
+ items:
5
+ - name: Page 1
6
+ href: page1.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.25.4",
3
+ "version": "5.26.1",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },