@diplodoc/cli-tests 5.7.0 → 5.8.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.
- package/e2e/__snapshots__/skip-html-extension.spec.ts.snap +211 -0
- package/e2e/skip-html-extension.spec.ts +15 -0
- package/mocks/skip-html-extension/input/.yfm +1 -0
- package/mocks/skip-html-extension/input/folder/index.md +1 -0
- package/mocks/skip-html-extension/input/index-test-html/index.md +4 -0
- package/mocks/skip-html-extension/input/index.md +6 -0
- package/mocks/skip-html-extension/input/page1.md +3 -0
- package/mocks/skip-html-extension/input/page2.md +6 -0
- package/mocks/skip-html-extension/input/toc.yaml +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Skip html extension > transforms links correctly > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
".yfm",
|
|
6
|
+
"_bundle/app-css-1",
|
|
7
|
+
"_bundle/app-js-2",
|
|
8
|
+
"_bundle/latex-extension.css",
|
|
9
|
+
"_bundle/latex-extension.js",
|
|
10
|
+
"_bundle/mermaid-extension.js",
|
|
11
|
+
"_bundle/page-constructor-extension.css",
|
|
12
|
+
"_bundle/page-constructor-extension.js",
|
|
13
|
+
"_bundle/search-async-0",
|
|
14
|
+
"_bundle/search-async-1",
|
|
15
|
+
"_bundle/search-css-0",
|
|
16
|
+
"_bundle/search-css-1",
|
|
17
|
+
"_bundle/search-css-2",
|
|
18
|
+
"_bundle/search-css-3",
|
|
19
|
+
"_bundle/search-css-4",
|
|
20
|
+
"_bundle/search-js-0",
|
|
21
|
+
"_bundle/search-js-1",
|
|
22
|
+
"_bundle/search-js-2",
|
|
23
|
+
"folder/index.html",
|
|
24
|
+
"index-test-html/index.html",
|
|
25
|
+
"index.html",
|
|
26
|
+
"page1.html",
|
|
27
|
+
"page2.html",
|
|
28
|
+
"toc.js"
|
|
29
|
+
]"
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
exports[`Skip html extension > transforms links correctly 1`] = `
|
|
33
|
+
"allowHTML: true
|
|
34
|
+
"
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
exports[`Skip html extension > transforms links correctly 2`] = `
|
|
38
|
+
"<!DOCTYPE html>
|
|
39
|
+
<html lang="ru" dir="ltr">
|
|
40
|
+
<head>
|
|
41
|
+
<meta charset="utf-8">
|
|
42
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
43
|
+
<base href="../" />
|
|
44
|
+
<title>Page 3 | Skip html extension</title>
|
|
45
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
46
|
+
|
|
47
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
51
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
52
|
+
</head>
|
|
53
|
+
<body class="g-root g-root_theme_light">
|
|
54
|
+
<div id="root"></div>
|
|
55
|
+
<script type="application/json" id="diplodoc-state">
|
|
56
|
+
{"data":{"leading":false,"html":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Page 3"},"router":{"pathname":"folder/index","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
57
|
+
</script>
|
|
58
|
+
<script type="application/javascript">
|
|
59
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
60
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
61
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
62
|
+
})(data.innerText));
|
|
63
|
+
window.STATIC_CONTENT = false;
|
|
64
|
+
</script>
|
|
65
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
66
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
67
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
68
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
69
|
+
|
|
70
|
+
</body>
|
|
71
|
+
</html>"
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
exports[`Skip html extension > transforms links correctly 3`] = `
|
|
75
|
+
"<!DOCTYPE html>
|
|
76
|
+
<html lang="ru" dir="ltr">
|
|
77
|
+
<head>
|
|
78
|
+
<meta charset="utf-8">
|
|
79
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
80
|
+
<base href="../" />
|
|
81
|
+
<title>Folder | Skip html extension</title>
|
|
82
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
83
|
+
|
|
84
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
88
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
89
|
+
</head>
|
|
90
|
+
<body class="g-root g-root_theme_light">
|
|
91
|
+
<div id="root"></div>
|
|
92
|
+
<script type="application/json" id="diplodoc-state">
|
|
93
|
+
{"data":{"leading":false,"html":"<p><a href=\\"page1\\">Link 1</a><br />/n<a href=\\"page2\\">Link 2</a></p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Folder"},"router":{"pathname":"index-test-html/index","depth":2,"base":"../"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
94
|
+
</script>
|
|
95
|
+
<script type="application/javascript">
|
|
96
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
97
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
98
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
99
|
+
})(data.innerText));
|
|
100
|
+
window.STATIC_CONTENT = false;
|
|
101
|
+
</script>
|
|
102
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
103
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
104
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
105
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
106
|
+
|
|
107
|
+
</body>
|
|
108
|
+
</html>"
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
exports[`Skip html extension > transforms links correctly 4`] = `
|
|
112
|
+
"<!DOCTYPE html>
|
|
113
|
+
<html lang="ru" dir="ltr">
|
|
114
|
+
<head>
|
|
115
|
+
<meta charset="utf-8">
|
|
116
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
117
|
+
<base href="./" />
|
|
118
|
+
<title>Redirect to ./ru</title>
|
|
119
|
+
<meta http-equiv="refresh" content="0; url=./ru">
|
|
120
|
+
|
|
121
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
122
|
+
|
|
123
|
+
<script type="application/javascript">
|
|
124
|
+
window.location.replace("./ru");
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
</head>
|
|
128
|
+
<body class="g-root g-root_theme_light">
|
|
129
|
+
If you are not redirected automatically, follow this <a href="./ru">link</a>.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
</body>
|
|
134
|
+
</html>"
|
|
135
|
+
`;
|
|
136
|
+
|
|
137
|
+
exports[`Skip html extension > transforms links correctly 5`] = `
|
|
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>Page 1 | Skip html extension</title>
|
|
145
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
146
|
+
|
|
147
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
151
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
152
|
+
</head>
|
|
153
|
+
<body class="g-root g-root_theme_light">
|
|
154
|
+
<div id="root"></div>
|
|
155
|
+
<script type="application/json" id="diplodoc-state">
|
|
156
|
+
{"data":{"leading":false,"html":"<p><a href=\\"page2#hash\\">Link</a></p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Page 1"},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
157
|
+
</script>
|
|
158
|
+
<script type="application/javascript">
|
|
159
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
160
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
161
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
162
|
+
})(data.innerText));
|
|
163
|
+
window.STATIC_CONTENT = false;
|
|
164
|
+
</script>
|
|
165
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
166
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
167
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
168
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
169
|
+
|
|
170
|
+
</body>
|
|
171
|
+
</html>"
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
exports[`Skip html extension > transforms links correctly 6`] = `
|
|
175
|
+
"<!DOCTYPE html>
|
|
176
|
+
<html lang="ru" dir="ltr">
|
|
177
|
+
<head>
|
|
178
|
+
<meta charset="utf-8">
|
|
179
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
180
|
+
<base href="./" />
|
|
181
|
+
<title>Page 2 | Skip html extension</title>
|
|
182
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
183
|
+
|
|
184
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0"/>
|
|
188
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1"/>
|
|
189
|
+
</head>
|
|
190
|
+
<body class="g-root g-root_theme_light">
|
|
191
|
+
<div id="root"></div>
|
|
192
|
+
<script type="application/json" id="diplodoc-state">
|
|
193
|
+
{"data":{"leading":false,"html":"<h2 id=\\"hash\\"><a href=\\"page2#hash\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">hash</span></a>hash</h2>/n<p><a href=\\"folder/\\">Link</a><br />/n<a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">External link</a></p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"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}}
|
|
194
|
+
</script>
|
|
195
|
+
<script type="application/javascript">
|
|
196
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
197
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
198
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
199
|
+
})(data.innerText));
|
|
200
|
+
window.STATIC_CONTENT = false;
|
|
201
|
+
</script>
|
|
202
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
203
|
+
<script type="application/javascript" defer src="_bundle/search-js-1"></script>
|
|
204
|
+
<script type="application/javascript" defer src="_bundle/search-js-2"></script>
|
|
205
|
+
<script type="application/javascript" defer src="_bundle/app-js-2"></script>
|
|
206
|
+
|
|
207
|
+
</body>
|
|
208
|
+
</html>"
|
|
209
|
+
`;
|
|
210
|
+
|
|
211
|
+
exports[`Skip html extension > transforms links correctly 7`] = `"window.__DATA__.data.toc = {"title":"Skip html extension","href":".","items":[{"name":"Title 1","href":"page1","id":"UUID"},{"name":"Title 2","href":"page2","id":"UUID"},{"name":"Title 3","href":"folder/","id":"UUID"},{"name":"Title 4","href":"index-test-html/","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
|
|
4
|
+
describe('Skip html extension', () => {
|
|
5
|
+
it('transforms links correctly', async () => {
|
|
6
|
+
const {inputPath, outputPath} = getTestPaths('mocks/skip-html-extension');
|
|
7
|
+
|
|
8
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
9
|
+
md2md: false,
|
|
10
|
+
md2html: true,
|
|
11
|
+
args: '-j2 --skip-html-extension',
|
|
12
|
+
});
|
|
13
|
+
await compareDirectories(outputPath);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
allowHTML: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Page 3
|