@diplodoc/cli-tests 5.25.0 → 5.25.2
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__/assets.spec.ts.snap +0 -0
- package/e2e/__snapshots__/bundles.spec.ts.snap +1 -1
- package/e2e/__snapshots__/markdown-options.spec.ts.snap +209 -0
- package/e2e/__snapshots__/neuro-expert.test.ts.snap +1 -1
- package/e2e/__snapshots__/search.test.ts.snap +1 -1
- package/e2e/__snapshots__/skip-html-extension.spec.ts.snap +2 -2
- package/e2e/__snapshots__/toc-label.test.ts.snap +127 -0
- package/e2e/__snapshots__/vars-conditions.spec.ts.snap +1 -1
- package/e2e/load-custom-resources.spec.ts +4 -16
- package/e2e/markdown-options.spec.ts +17 -0
- package/e2e/metadata.spec.ts +7 -14
- package/e2e/rtl.spec.ts +4 -15
- package/e2e/skip-html-extension.spec.ts +4 -15
- package/e2e/toc-label.test.ts +23 -0
- package/fixtures/cliAdapter.ts +1 -1
- package/fixtures/utils/file.ts +18 -1
- package/mocks/assets/input/.yfm +1 -1
- package/mocks/bundles/input/.yfm +1 -1
- package/mocks/markdown-options/example-1/input/.yfm +5 -0
- package/mocks/markdown-options/example-1/input/breaks.md +5 -0
- package/mocks/markdown-options/example-1/input/linkify-tlds.md +7 -0
- package/mocks/markdown-options/example-1/input/linkify.md +3 -0
- package/mocks/markdown-options/example-1/input/toc.yaml +7 -0
- package/mocks/markdown-options/example-2/input/.yfm +3 -0
- package/mocks/markdown-options/example-2/input/breaks.md +5 -0
- package/mocks/markdown-options/example-2/input/linkify-tlds.md +7 -0
- package/mocks/markdown-options/example-2/input/linkify.md +3 -0
- package/mocks/markdown-options/example-2/input/toc.yaml +7 -0
- package/mocks/neuro-expert/input/.yfm +1 -1
- package/mocks/pdf-page/yfm-config/input/.yfm +1 -1
- package/mocks/search/input/.yfm +1 -1
- package/mocks/skip-html-extension/monolingual/input/.yfm +1 -1
- package/mocks/skip-html-extension/multilingual/input/.yfm +1 -1
- package/mocks/toc-label/input/.yfm +1 -0
- package/mocks/toc-label/input/index.md +3 -0
- package/mocks/toc-label/input/page1.md +3 -0
- package/mocks/toc-label/input/toc.yaml +10 -0
- package/mocks/vars-conditions/input/.yfm +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
".yfm",
|
|
6
|
+
"breaks.html",
|
|
7
|
+
"linkify-tlds.html",
|
|
8
|
+
"linkify.html",
|
|
9
|
+
"toc.js"
|
|
10
|
+
]"
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 1`] = `
|
|
14
|
+
"breaks: false
|
|
15
|
+
linkify: true
|
|
16
|
+
linkifyTlds:
|
|
17
|
+
- myext
|
|
18
|
+
- custom
|
|
19
|
+
"
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 2`] = `
|
|
23
|
+
"<!DOCTYPE html>
|
|
24
|
+
<html lang="ru" dir="ltr">
|
|
25
|
+
<head>
|
|
26
|
+
<meta charset="utf-8">
|
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
28
|
+
<base href="./" />
|
|
29
|
+
<title>Breaks test</title>
|
|
30
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
31
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
32
|
+
</head>
|
|
33
|
+
<body class="g-root g-root_theme_light">
|
|
34
|
+
<div id="root"></div>
|
|
35
|
+
<script type="application/json" id="diplodoc-state">
|
|
36
|
+
{"data":{"leading":false,"html":"<p>First sentence/nSecond sentence/nThird sentence</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"breaks.md"},"headings":[],"title":"Breaks test"},"router":{"pathname":"breaks","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
37
|
+
</script>
|
|
38
|
+
<script type="application/javascript">
|
|
39
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
40
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
41
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
42
|
+
})(data.innerText));
|
|
43
|
+
window.STATIC_CONTENT = false;
|
|
44
|
+
</script>
|
|
45
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
46
|
+
</body>
|
|
47
|
+
</html>"
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 3`] = `
|
|
51
|
+
"<!DOCTYPE html>
|
|
52
|
+
<html lang="ru" dir="ltr">
|
|
53
|
+
<head>
|
|
54
|
+
<meta charset="utf-8">
|
|
55
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
56
|
+
<base href="./" />
|
|
57
|
+
<title>Linkify TLDs test</title>
|
|
58
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
59
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
60
|
+
</head>
|
|
61
|
+
<body class="g-root g-root_theme_light">
|
|
62
|
+
<div id="root"></div>
|
|
63
|
+
<script type="application/json" id="diplodoc-state">
|
|
64
|
+
{"data":{"leading":false,"html":"<p>Visit <a href=\\"http://example.myext\\">example.myext</a> for custom TLD.</p>/n<p>Standard <a href=\\"http://example.com\\">example.com</a> link.</p>/n<p>Unknown example.faketld should not be linked.</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify-tlds.md"},"headings":[],"title":"Linkify TLDs test"},"router":{"pathname":"linkify-tlds","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
65
|
+
</script>
|
|
66
|
+
<script type="application/javascript">
|
|
67
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
68
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
69
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
70
|
+
})(data.innerText));
|
|
71
|
+
window.STATIC_CONTENT = false;
|
|
72
|
+
</script>
|
|
73
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
74
|
+
</body>
|
|
75
|
+
</html>"
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 4`] = `
|
|
79
|
+
"<!DOCTYPE html>
|
|
80
|
+
<html lang="ru" dir="ltr">
|
|
81
|
+
<head>
|
|
82
|
+
<meta charset="utf-8">
|
|
83
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
84
|
+
<base href="./" />
|
|
85
|
+
<title>Linkify test</title>
|
|
86
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
87
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
88
|
+
</head>
|
|
89
|
+
<body class="g-root g-root_theme_light">
|
|
90
|
+
<div id="root"></div>
|
|
91
|
+
<script type="application/json" id="diplodoc-state">
|
|
92
|
+
{"data":{"leading":false,"html":"<p>Visit <a href=\\"https://example.com\\" target=\\"_blank\\" rel=\\"noreferrer noopener\\">https://example.com</a> for more info.</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify.md"},"headings":[],"title":"Linkify test"},"router":{"pathname":"linkify","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
93
|
+
</script>
|
|
94
|
+
<script type="application/javascript">
|
|
95
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
96
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
97
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
98
|
+
})(data.innerText));
|
|
99
|
+
window.STATIC_CONTENT = false;
|
|
100
|
+
</script>
|
|
101
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
102
|
+
</body>
|
|
103
|
+
</html>"
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 1 5`] = `"window.__DATA__.data.toc = {"items":[{"name":"Breaks","href":"breaks.html","id":"UUID"},{"name":"Linkify","href":"linkify.html","id":"UUID"},{"name":"Linkify TLDs","href":"linkify-tlds.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
107
|
+
|
|
108
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 > filelist 1`] = `
|
|
109
|
+
"[
|
|
110
|
+
".yfm",
|
|
111
|
+
"breaks.html",
|
|
112
|
+
"linkify-tlds.html",
|
|
113
|
+
"linkify.html",
|
|
114
|
+
"toc.js"
|
|
115
|
+
]"
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 1`] = `
|
|
119
|
+
"breaks: true
|
|
120
|
+
linkify: false
|
|
121
|
+
|
|
122
|
+
"
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 2`] = `
|
|
126
|
+
"<!DOCTYPE html>
|
|
127
|
+
<html lang="ru" dir="ltr">
|
|
128
|
+
<head>
|
|
129
|
+
<meta charset="utf-8">
|
|
130
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
131
|
+
<base href="./" />
|
|
132
|
+
<title>Breaks test</title>
|
|
133
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
134
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
135
|
+
</head>
|
|
136
|
+
<body class="g-root g-root_theme_light">
|
|
137
|
+
<div id="root"></div>
|
|
138
|
+
<script type="application/json" id="diplodoc-state">
|
|
139
|
+
{"data":{"leading":false,"html":"<p>First sentence<br />/nSecond sentence<br />/nThird sentence</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"breaks.md"},"headings":[],"title":"Breaks test"},"router":{"pathname":"breaks","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
140
|
+
</script>
|
|
141
|
+
<script type="application/javascript">
|
|
142
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
143
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
144
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
145
|
+
})(data.innerText));
|
|
146
|
+
window.STATIC_CONTENT = false;
|
|
147
|
+
</script>
|
|
148
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
149
|
+
</body>
|
|
150
|
+
</html>"
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 3`] = `
|
|
154
|
+
"<!DOCTYPE html>
|
|
155
|
+
<html lang="ru" dir="ltr">
|
|
156
|
+
<head>
|
|
157
|
+
<meta charset="utf-8">
|
|
158
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
159
|
+
<base href="./" />
|
|
160
|
+
<title>Linkify TLDs test</title>
|
|
161
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
162
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
163
|
+
</head>
|
|
164
|
+
<body class="g-root g-root_theme_light">
|
|
165
|
+
<div id="root"></div>
|
|
166
|
+
<script type="application/json" id="diplodoc-state">
|
|
167
|
+
{"data":{"leading":false,"html":"<p>Visit example.myext for custom TLD.</p>/n<p>Standard example.com link.</p>/n<p>Unknown example.faketld should not be linked.</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify-tlds.md"},"headings":[],"title":"Linkify TLDs test"},"router":{"pathname":"linkify-tlds","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
168
|
+
</script>
|
|
169
|
+
<script type="application/javascript">
|
|
170
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
171
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
172
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
173
|
+
})(data.innerText));
|
|
174
|
+
window.STATIC_CONTENT = false;
|
|
175
|
+
</script>
|
|
176
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
177
|
+
</body>
|
|
178
|
+
</html>"
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 4`] = `
|
|
182
|
+
"<!DOCTYPE html>
|
|
183
|
+
<html lang="ru" dir="ltr">
|
|
184
|
+
<head>
|
|
185
|
+
<meta charset="utf-8">
|
|
186
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
187
|
+
<base href="./" />
|
|
188
|
+
<title>Linkify test</title>
|
|
189
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
190
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
191
|
+
</head>
|
|
192
|
+
<body class="g-root g-root_theme_light">
|
|
193
|
+
<div id="root"></div>
|
|
194
|
+
<script type="application/json" id="diplodoc-state">
|
|
195
|
+
{"data":{"leading":false,"html":"<p>Visit https://example.com for more info.</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"linkify.md"},"headings":[],"title":"Linkify test"},"router":{"pathname":"linkify","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
196
|
+
</script>
|
|
197
|
+
<script type="application/javascript">
|
|
198
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
199
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
200
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
201
|
+
})(data.innerText));
|
|
202
|
+
window.STATIC_CONTENT = false;
|
|
203
|
+
</script>
|
|
204
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
205
|
+
</body>
|
|
206
|
+
</html>"
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
exports[`Markdown options from .yfm config > Markdown options from .yfm config 2 5`] = `"window.__DATA__.data.toc = {"items":[{"name":"Breaks","href":"breaks.html","id":"UUID"},{"name":"Linkify","href":"linkify.html","id":"UUID"},{"name":"Linkify TLDs","href":"linkify-tlds.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -13,7 +13,7 @@ exports[`Skip html extension > correctly trims .html and index.html on monolingu
|
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
exports[`Skip html extension > correctly trims .html and index.html on monolingual docs 1`] = `
|
|
16
|
-
"
|
|
16
|
+
"allowHtml: true
|
|
17
17
|
"
|
|
18
18
|
`;
|
|
19
19
|
|
|
@@ -179,7 +179,7 @@ exports[`Skip html extension > correctly trims .html and index.html on multiling
|
|
|
179
179
|
`;
|
|
180
180
|
|
|
181
181
|
exports[`Skip html extension > correctly trims .html and index.html on multilingual docs 1`] = `
|
|
182
|
-
"
|
|
182
|
+
"allowHtml: true
|
|
183
183
|
langs: ['en','ru']
|
|
184
184
|
"
|
|
185
185
|
`;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Toc label > should pass TocLabel object through to toc output > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
".yfm",
|
|
6
|
+
"index.md",
|
|
7
|
+
"page1.md",
|
|
8
|
+
"toc.yaml"
|
|
9
|
+
]"
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
exports[`Toc label > should pass TocLabel object through to toc output > filelist 2`] = `
|
|
13
|
+
"[
|
|
14
|
+
".yfm",
|
|
15
|
+
"index.html",
|
|
16
|
+
"page1.html",
|
|
17
|
+
"toc.js"
|
|
18
|
+
]"
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Toc label > should pass TocLabel object through to toc output 1`] = `
|
|
22
|
+
"allowHtml: true
|
|
23
|
+
"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`Toc label > should pass TocLabel object through to toc output 2`] = `
|
|
27
|
+
"---
|
|
28
|
+
metadata:
|
|
29
|
+
- name: generator
|
|
30
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
31
|
+
vcsPath: index.md
|
|
32
|
+
---
|
|
33
|
+
# Toc Label Test
|
|
34
|
+
|
|
35
|
+
Content
|
|
36
|
+
"
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Toc label > should pass TocLabel object through to toc output 3`] = `
|
|
40
|
+
"---
|
|
41
|
+
metadata:
|
|
42
|
+
- name: generator
|
|
43
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
44
|
+
vcsPath: page1.md
|
|
45
|
+
---
|
|
46
|
+
# Page 1
|
|
47
|
+
|
|
48
|
+
Content
|
|
49
|
+
"
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`Toc label > should pass TocLabel object through to toc output 4`] = `
|
|
53
|
+
"title: Toc Label Test
|
|
54
|
+
href: index.md
|
|
55
|
+
label:
|
|
56
|
+
title: Preview
|
|
57
|
+
description: This service is in preview
|
|
58
|
+
theme: info
|
|
59
|
+
items:
|
|
60
|
+
- name: Page 1
|
|
61
|
+
href: page1.md
|
|
62
|
+
path: toc.yaml
|
|
63
|
+
"
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`Toc label > should pass TocLabel object through to toc output 5`] = `
|
|
67
|
+
"allowHtml: true
|
|
68
|
+
"
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
exports[`Toc label > should pass TocLabel object through to toc output 6`] = `
|
|
72
|
+
"<!DOCTYPE html>
|
|
73
|
+
<html lang="ru" dir="ltr">
|
|
74
|
+
<head>
|
|
75
|
+
<meta charset="utf-8">
|
|
76
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
77
|
+
<base href="./" />
|
|
78
|
+
<title>Toc Label Test | Toc Label Test</title>
|
|
79
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
80
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
81
|
+
</head>
|
|
82
|
+
<body class="g-root g-root_theme_light">
|
|
83
|
+
<div id="root"></div>
|
|
84
|
+
<script type="application/json" id="diplodoc-state">
|
|
85
|
+
{"data":{"leading":false,"html":"<p>Content</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Toc Label Test"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
86
|
+
</script>
|
|
87
|
+
<script type="application/javascript">
|
|
88
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
89
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
90
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
91
|
+
})(data.innerText));
|
|
92
|
+
window.STATIC_CONTENT = false;
|
|
93
|
+
</script>
|
|
94
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
95
|
+
</body>
|
|
96
|
+
</html>"
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`Toc label > should pass TocLabel object through to toc output 7`] = `
|
|
100
|
+
"<!DOCTYPE html>
|
|
101
|
+
<html lang="ru" dir="ltr">
|
|
102
|
+
<head>
|
|
103
|
+
<meta charset="utf-8">
|
|
104
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
105
|
+
<base href="./" />
|
|
106
|
+
<title>Page 1 | Toc Label Test</title>
|
|
107
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
108
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
109
|
+
</head>
|
|
110
|
+
<body class="g-root g-root_theme_light">
|
|
111
|
+
<div id="root"></div>
|
|
112
|
+
<script type="application/json" id="diplodoc-state">
|
|
113
|
+
{"data":{"leading":false,"html":"<p>Content</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}}
|
|
114
|
+
</script>
|
|
115
|
+
<script type="application/javascript">
|
|
116
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
117
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
118
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
119
|
+
})(data.innerText));
|
|
120
|
+
window.STATIC_CONTENT = false;
|
|
121
|
+
</script>
|
|
122
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>"
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
exports[`Toc label > should pass TocLabel object through to toc output 8`] = `"window.__DATA__.data.toc = {"title":"Toc Label Test","href":"index.html","label":{"title":"Preview","description":"This service is in preview","theme":"info"},"items":[{"name":"Page 1","href":"page1.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import {describe
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const generateMapTestTemplate = (
|
|
6
|
-
testTitle: string,
|
|
7
|
-
testRootPath: string,
|
|
8
|
-
{md2md = true, md2html = true, args = '--allow-custom-resources'},
|
|
9
|
-
) => {
|
|
10
|
-
test(testTitle, async () => {
|
|
11
|
-
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
12
|
-
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html, args});
|
|
13
|
-
await compareDirectories(outputPath);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
3
|
+
import {generateMapTestTemplate} from '../fixtures';
|
|
16
4
|
|
|
17
5
|
describe('Allow load custom resources', () => {
|
|
18
6
|
generateMapTestTemplate(
|
|
19
7
|
'md2md with custom resources',
|
|
20
8
|
'mocks/load-custom-resources/md2md-with-resources',
|
|
21
|
-
{md2html: false},
|
|
9
|
+
{md2html: false, args: '--allow-custom-resources'},
|
|
22
10
|
);
|
|
23
11
|
|
|
24
12
|
generateMapTestTemplate(
|
|
25
13
|
'md2html with custom resources',
|
|
26
14
|
'mocks/load-custom-resources/md2html-with-resources',
|
|
27
|
-
{md2md: false},
|
|
15
|
+
{md2md: false, args: '--allow-custom-resources'},
|
|
28
16
|
);
|
|
29
17
|
|
|
30
18
|
generateMapTestTemplate(
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {generateMapTestTemplate} from '../fixtures';
|
|
4
|
+
|
|
5
|
+
describe('Markdown options from .yfm config', () => {
|
|
6
|
+
generateMapTestTemplate(
|
|
7
|
+
'Markdown options from .yfm config 1',
|
|
8
|
+
'mocks/markdown-options/example-1',
|
|
9
|
+
{md2html: true, md2md: false, args: '-j2'},
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
generateMapTestTemplate(
|
|
13
|
+
'Markdown options from .yfm config 2',
|
|
14
|
+
'mocks/markdown-options/example-2',
|
|
15
|
+
{md2html: true, md2md: false, args: '-j2'},
|
|
16
|
+
);
|
|
17
|
+
});
|
package/e2e/metadata.spec.ts
CHANGED
|
@@ -2,15 +2,19 @@ import {readFileSync, readdirSync} from 'node:fs';
|
|
|
2
2
|
import {join} from 'node:path';
|
|
3
3
|
import {describe, expect, test} from 'vitest';
|
|
4
4
|
|
|
5
|
-
import {TestAdapter,
|
|
5
|
+
import {TestAdapter, generateMapTestTemplate, getTestPaths} from '../fixtures';
|
|
6
6
|
|
|
7
7
|
function findFile(dir: string, predicate: (name: string) => boolean): string | null {
|
|
8
8
|
try {
|
|
9
9
|
for (const name of readdirSync(dir, {withFileTypes: true})) {
|
|
10
10
|
const full = join(dir, name.name);
|
|
11
|
+
|
|
11
12
|
if (name.isDirectory()) {
|
|
12
13
|
const found = findFile(full, predicate);
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
if (found) {
|
|
16
|
+
return found;
|
|
17
|
+
}
|
|
14
18
|
} else if (predicate(name.name)) {
|
|
15
19
|
return full;
|
|
16
20
|
}
|
|
@@ -18,21 +22,10 @@ function findFile(dir: string, predicate: (name: string) => boolean): string | n
|
|
|
18
22
|
} catch {
|
|
19
23
|
return null;
|
|
20
24
|
}
|
|
25
|
+
|
|
21
26
|
return null;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
const generateMapTestTemplate = (
|
|
25
|
-
testTitle: string,
|
|
26
|
-
testRootPath: string,
|
|
27
|
-
{md2md = true, md2html = true},
|
|
28
|
-
) => {
|
|
29
|
-
test(testTitle, async () => {
|
|
30
|
-
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
31
|
-
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html});
|
|
32
|
-
await compareDirectories(outputPath);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
29
|
describe('Allow load custom resources', () => {
|
|
37
30
|
generateMapTestTemplate('md2md with metadata', 'mocks/metadata/md2md-with-metadata', {
|
|
38
31
|
md2html: false,
|
package/e2e/rtl.spec.ts
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {describe
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const generateMapTestTemplate = (
|
|
6
|
-
testTitle: string,
|
|
7
|
-
testRootPath: string,
|
|
8
|
-
{md2md = true, md2html = true, args = '--allow-custom-resources'},
|
|
9
|
-
) => {
|
|
10
|
-
test(testTitle, async () => {
|
|
11
|
-
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
12
|
-
await TestAdapter.testBuildPass(inputPath, outputPath, {md2md, md2html, args});
|
|
13
|
-
await compareDirectories(outputPath);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
3
|
+
import {generateMapTestTemplate} from '../fixtures';
|
|
16
4
|
|
|
17
5
|
describe('Generate html document with correct lang and dir attributes. Load correct bundles.', () => {
|
|
18
6
|
generateMapTestTemplate(
|
|
19
7
|
'documentation with rtl and ltr langs',
|
|
20
8
|
'mocks/rtl/multidirectional-languages',
|
|
21
|
-
{md2html: true, md2md: false},
|
|
9
|
+
{md2html: true, md2md: false, args: '--allow-custom-resources'},
|
|
22
10
|
);
|
|
23
11
|
|
|
24
12
|
generateMapTestTemplate('documentation with only one rtl lang', 'mocks/rtl/rtl-language', {
|
|
25
13
|
md2html: true,
|
|
26
14
|
md2md: false,
|
|
15
|
+
args: '--allow-custom-resources',
|
|
27
16
|
});
|
|
28
17
|
});
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {describe
|
|
1
|
+
import {describe} from 'vitest';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const generateMapTestTemplate = (testTitle: string, testRootPath: string) => {
|
|
6
|
-
test(testTitle, async () => {
|
|
7
|
-
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
8
|
-
|
|
9
|
-
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
10
|
-
md2md: false,
|
|
11
|
-
md2html: true,
|
|
12
|
-
args: '-j2 --skip-html-extension',
|
|
13
|
-
});
|
|
14
|
-
await compareDirectories(outputPath);
|
|
15
|
-
});
|
|
16
|
-
};
|
|
3
|
+
import {generateMapTestTemplate} from '../fixtures';
|
|
17
4
|
|
|
18
5
|
describe('Skip html extension', () => {
|
|
19
6
|
generateMapTestTemplate(
|
|
20
7
|
'correctly trims .html and index.html on multilingual docs',
|
|
21
8
|
'mocks/skip-html-extension/multilingual',
|
|
9
|
+
{md2md: false, md2html: true, args: '-j2 --skip-html-extension'},
|
|
22
10
|
);
|
|
23
11
|
|
|
24
12
|
generateMapTestTemplate(
|
|
25
13
|
'correctly trims .html and index.html on monolingual docs',
|
|
26
14
|
'mocks/skip-html-extension/monolingual',
|
|
15
|
+
{md2md: false, md2html: true, args: '-j2 --skip-html-extension'},
|
|
27
16
|
);
|
|
28
17
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
4
|
+
|
|
5
|
+
describe('Toc label', () => {
|
|
6
|
+
it('should pass TocLabel object through to toc output', async () => {
|
|
7
|
+
const {inputPath, outputPath} = getTestPaths('mocks/toc-label');
|
|
8
|
+
|
|
9
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
10
|
+
md2md: true,
|
|
11
|
+
md2html: false,
|
|
12
|
+
args: '-j2',
|
|
13
|
+
});
|
|
14
|
+
await TestAdapter.testBuildPass(outputPath, outputPath + '-html', {
|
|
15
|
+
md2md: false,
|
|
16
|
+
md2html: true,
|
|
17
|
+
args: '-j2',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await compareDirectories(outputPath);
|
|
21
|
+
await compareDirectories(outputPath + '-html');
|
|
22
|
+
});
|
|
23
|
+
});
|
package/fixtures/cliAdapter.ts
CHANGED
|
@@ -26,7 +26,7 @@ class Build {
|
|
|
26
26
|
|
|
27
27
|
run(input: string, output: string, args: string[], env?: Record<string, string>) {
|
|
28
28
|
return this.runner.runYfmDocs(
|
|
29
|
-
['--input', input, '--output', output, '--quiet', '--
|
|
29
|
+
['--input', input, '--output', output, '--quiet', '--allowHtml', ...args],
|
|
30
30
|
env,
|
|
31
31
|
);
|
|
32
32
|
}
|
package/fixtures/utils/file.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type {BuildRunArgs} from '../cliAdapter';
|
|
2
|
+
|
|
1
3
|
import {readFileSync} from 'node:fs';
|
|
2
4
|
import {rm} from 'node:fs/promises';
|
|
3
5
|
import {join, resolve} from 'node:path';
|
|
4
6
|
import {glob} from 'glob';
|
|
5
|
-
import {expect} from 'vitest';
|
|
7
|
+
import {expect, test} from 'vitest';
|
|
8
|
+
|
|
9
|
+
import {TestAdapter} from '../cliAdapter';
|
|
6
10
|
|
|
7
11
|
import {bundleless, hashless, platformless} from './test';
|
|
8
12
|
|
|
@@ -119,3 +123,16 @@ export function getTestPaths(testRootPath: string): TestPaths {
|
|
|
119
123
|
export function cleanupDirectory(path: string) {
|
|
120
124
|
return rm(path, {recursive: true, force: true});
|
|
121
125
|
}
|
|
126
|
+
|
|
127
|
+
export function generateMapTestTemplate(
|
|
128
|
+
testTitle: string,
|
|
129
|
+
testRootPath: string,
|
|
130
|
+
options: BuildRunArgs = {},
|
|
131
|
+
) {
|
|
132
|
+
test(testTitle, async () => {
|
|
133
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
134
|
+
|
|
135
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, options);
|
|
136
|
+
await compareDirectories(outputPath);
|
|
137
|
+
});
|
|
138
|
+
}
|
package/mocks/assets/input/.yfm
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
package/mocks/bundles/input/.yfm
CHANGED
package/mocks/search/input/.yfm
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|
|
2
2
|
langs: ['en','ru']
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
allowHtml: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
allowHtml: true
|