@diplodoc/cli-tests 5.12.2 → 5.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/e2e/__snapshots__/alternates.test.ts.snap +2 -2
- package/e2e/__snapshots__/pdf-page.spec.ts.snap +137 -0
- package/e2e/__snapshots__/rtl.spec.ts.snap +4 -4
- package/e2e/pdf-page.spec.ts +16 -0
- package/mocks/pdf-page/input/.yfm +7 -0
- package/mocks/pdf-page/input/index.md +6 -0
- package/mocks/pdf-page/input/page1.md +3 -0
- package/mocks/pdf-page/input/page2.md +5 -0
- package/mocks/pdf-page/input/page3.md +1 -0
- package/mocks/pdf-page/input/toc.yaml +15 -0
- package/package.json +1 -1
|
@@ -468,8 +468,8 @@ exports[`Alternates > internal 24`] = `
|
|
|
468
468
|
<link rel="canonical" href="ru/about.html">
|
|
469
469
|
<link rel="alternate" href="az/about.html" hreflang="az" />
|
|
470
470
|
<link rel="alternate" href="en/about.html" hreflang="en" />
|
|
471
|
-
<link rel="alternate" href="ru/about.html" hreflang="ru" />
|
|
472
471
|
<link rel="alternate" href="https://my-other-site.com/about" />
|
|
472
|
+
<link rel="alternate" href="ru/about.html" hreflang="ru" />
|
|
473
473
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
474
474
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
475
475
|
</head>
|
|
@@ -807,8 +807,8 @@ exports[`Alternates > skip-html-extension 11`] = `
|
|
|
807
807
|
<link rel="canonical" href="ru/about">
|
|
808
808
|
<link rel="alternate" href="az/about" hreflang="az" />
|
|
809
809
|
<link rel="alternate" href="en/about" hreflang="en" />
|
|
810
|
-
<link rel="alternate" href="ru/about" hreflang="ru" />
|
|
811
810
|
<link rel="alternate" href="https://my-other-site.com/about" />
|
|
811
|
+
<link rel="alternate" href="ru/about" hreflang="ru" />
|
|
812
812
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
813
813
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
814
814
|
</head>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Pdf page mode > transforms links correctly > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
".yfm",
|
|
6
|
+
"index.html",
|
|
7
|
+
"page1.html",
|
|
8
|
+
"page2.html",
|
|
9
|
+
"page3.html",
|
|
10
|
+
"toc.js"
|
|
11
|
+
]"
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`Pdf page mode > transforms links correctly 1`] = `
|
|
15
|
+
"allowHTML: true
|
|
16
|
+
|
|
17
|
+
hiddenPolicy:
|
|
18
|
+
pdf: true
|
|
19
|
+
|
|
20
|
+
docs-viewer:
|
|
21
|
+
pdf: true
|
|
22
|
+
"
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`Pdf page mode > transforms links correctly 2`] = `
|
|
26
|
+
"<!DOCTYPE html>
|
|
27
|
+
<html lang="ru" dir="ltr">
|
|
28
|
+
<head>
|
|
29
|
+
<meta charset="utf-8">
|
|
30
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
31
|
+
<base href="./" />
|
|
32
|
+
<title>Header | Skip html extension</title>
|
|
33
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
34
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body class="g-root g-root_theme_light">
|
|
37
|
+
<div id="root"></div>
|
|
38
|
+
<script type="application/json" id="diplodoc-state">
|
|
39
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n<p><a href=\\"page1.html\\">Link 1</a><br />/n<a href=\\"page2.html\\">Link 2</a></p>/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}}
|
|
40
|
+
</script>
|
|
41
|
+
<script type="application/javascript">
|
|
42
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
43
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
44
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
45
|
+
})(data.innerText));
|
|
46
|
+
window.STATIC_CONTENT = false;
|
|
47
|
+
</script>
|
|
48
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
49
|
+
</body>
|
|
50
|
+
</html>"
|
|
51
|
+
`;
|
|
52
|
+
|
|
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":"<p><a href=\\"page2.html#hash\\">Link</a></p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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
|
+
`;
|
|
80
|
+
|
|
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":"<h2 id=\\"hash\\"><a href=\\"page2.html#hash\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">hash</span></a>hash</h2>/n<p><a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">External link</a></p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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>"
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
exports[`Pdf page mode > transforms links correctly 5`] = `
|
|
110
|
+
"<!DOCTYPE html>
|
|
111
|
+
<html lang="ru" dir="ltr">
|
|
112
|
+
<head>
|
|
113
|
+
<meta charset="utf-8">
|
|
114
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
115
|
+
<base href="./" />
|
|
116
|
+
<title>Page 3 | Skip html extension</title>
|
|
117
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
118
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
119
|
+
</head>
|
|
120
|
+
<body class="g-root g-root_theme_light">
|
|
121
|
+
<div id="root"></div>
|
|
122
|
+
<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}}
|
|
124
|
+
</script>
|
|
125
|
+
<script type="application/javascript">
|
|
126
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
127
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
128
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
129
|
+
})(data.innerText));
|
|
130
|
+
window.STATIC_CONTENT = false;
|
|
131
|
+
</script>
|
|
132
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
133
|
+
</body>
|
|
134
|
+
</html>"
|
|
135
|
+
`;
|
|
136
|
+
|
|
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"};"`;
|
|
@@ -93,8 +93,8 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
|
|
|
93
93
|
<base href="../" />
|
|
94
94
|
<title>Documentation | Documentation</title>
|
|
95
95
|
<link rel="canonical" href="ar/index.html">
|
|
96
|
-
<link rel="alternate" href="en/index.html" hreflang="en" />
|
|
97
96
|
<link rel="alternate" href="ar/index.html" hreflang="ar" />
|
|
97
|
+
<link rel="alternate" href="en/index.html" hreflang="en" />
|
|
98
98
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
99
99
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
100
100
|
</head>
|
|
@@ -124,8 +124,8 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
|
|
|
124
124
|
<base href="../" />
|
|
125
125
|
<title>Documentation</title>
|
|
126
126
|
<link rel="canonical" href="ar/page.html">
|
|
127
|
-
<link rel="alternate" href="en/page.html" hreflang="en" />
|
|
128
127
|
<link rel="alternate" href="ar/page.html" hreflang="ar" />
|
|
128
|
+
<link rel="alternate" href="en/page.html" hreflang="en" />
|
|
129
129
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
130
130
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
131
131
|
</head>
|
|
@@ -157,8 +157,8 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
|
|
|
157
157
|
<base href="../" />
|
|
158
158
|
<title>Documentation | Documentation</title>
|
|
159
159
|
<link rel="canonical" href="en/index.html">
|
|
160
|
-
<link rel="alternate" href="en/index.html" hreflang="en" />
|
|
161
160
|
<link rel="alternate" href="ar/index.html" hreflang="ar" />
|
|
161
|
+
<link rel="alternate" href="en/index.html" hreflang="en" />
|
|
162
162
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
163
163
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
164
164
|
</head>
|
|
@@ -188,8 +188,8 @@ exports[`Generate html document with correct lang and dir attributes. Load corre
|
|
|
188
188
|
<base href="../" />
|
|
189
189
|
<title>Documentation</title>
|
|
190
190
|
<link rel="canonical" href="en/page.html">
|
|
191
|
-
<link rel="alternate" href="en/page.html" hreflang="en" />
|
|
192
191
|
<link rel="alternate" href="ar/page.html" hreflang="ar" />
|
|
192
|
+
<link rel="alternate" href="en/page.html" hreflang="en" />
|
|
193
193
|
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
194
194
|
<meta name="yfm" content="builder">
|
|
195
195
|
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
4
|
+
|
|
5
|
+
describe('Pdf page mode', () => {
|
|
6
|
+
it('transforms links correctly', async () => {
|
|
7
|
+
const {inputPath, outputPath} = getTestPaths('mocks/pdf-page');
|
|
8
|
+
|
|
9
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
10
|
+
md2md: false,
|
|
11
|
+
md2html: true,
|
|
12
|
+
args: '-j2',
|
|
13
|
+
});
|
|
14
|
+
await compareDirectories(outputPath);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Page 3
|