@diplodoc/cli-tests 5.36.0 → 5.36.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 (33) hide show
  1. package/e2e/__snapshots__/files.spec.ts.snap +1 -2
  2. package/e2e/__snapshots__/merge-includes.spec.ts.snap +241 -30
  3. package/e2e/__snapshots__/pdf-page.spec.ts.snap +151 -0
  4. package/e2e/__snapshots__/regression.test.ts.snap +215 -54
  5. package/e2e/merge-includes.spec.ts +45 -1
  6. package/e2e/pdf-page.spec.ts +27 -0
  7. package/mocks/merge-includes/hash-section-html/input/_includes/mixed.md +11 -0
  8. package/mocks/merge-includes/hash-section-html/input/index.md +3 -0
  9. package/mocks/merge-includes/hash-section-html/input/main.md +13 -0
  10. package/mocks/merge-includes/hash-section-html/input/toc.yaml +5 -0
  11. package/mocks/merge-includes/html-in-list/input/_includes/styles.md +7 -0
  12. package/mocks/merge-includes/html-in-list/input/index.md +3 -0
  13. package/mocks/merge-includes/html-in-list/input/main.md +11 -0
  14. package/mocks/merge-includes/html-in-list/input/toc.yaml +5 -0
  15. package/mocks/merge-includes/term-extract/input/_includes/chapter.md +7 -0
  16. package/mocks/merge-includes/term-extract/input/index.md +3 -0
  17. package/mocks/merge-includes/term-extract/input/main.md +7 -0
  18. package/mocks/merge-includes/term-extract/input/toc.yaml +5 -0
  19. package/mocks/merge-includes/yfm-table/input/_includes/cell-content.md +1 -0
  20. package/mocks/merge-includes/yfm-table/input/index.md +3 -0
  21. package/mocks/merge-includes/yfm-table/input/main.md +12 -0
  22. package/mocks/merge-includes/yfm-table/input/toc.yaml +5 -0
  23. package/mocks/pdf-page/custom-pdf-icon/input/.yfm +6 -0
  24. package/mocks/pdf-page/custom-pdf-icon/input/_assets/custom-pdf-icon.svg +1 -0
  25. package/mocks/pdf-page/custom-pdf-icon/input/index.md +1 -0
  26. package/mocks/pdf-page/custom-pdf-icon/input/pdf/output.pdf +0 -0
  27. package/mocks/pdf-page/custom-pdf-icon/input/toc.yaml +2 -0
  28. package/mocks/regression/input/autotitle.md +33 -1
  29. package/mocks/regression/input/includes/fragments.md +24 -0
  30. package/mocks/regression/input/includes/styles.md +8 -0
  31. package/mocks/regression/input/includes.md +6 -0
  32. package/mocks/regression/input/toc.yaml +2 -0
  33. package/package.json +1 -1
@@ -53,7 +53,7 @@ describe('Merge includes (md2md)', () => {
53
53
  await TestAdapter.testBuildPass(inputPath, outputPath, {
54
54
  md2md: true,
55
55
  md2html: false,
56
- args: '--merge-includes',
56
+ args: '--merge-includes --multiline-term-definitions',
57
57
  });
58
58
  await compareDirectories(outputPath);
59
59
  });
@@ -69,6 +69,50 @@ describe('Merge includes (md2md)', () => {
69
69
  await compareDirectories(outputPath);
70
70
  });
71
71
 
72
+ test('term-extract: dep with terms → terms extracted, content inlined (Step 4)', async () => {
73
+ const {inputPath, outputPath} = getTestPaths('mocks/merge-includes/term-extract');
74
+
75
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
76
+ md2md: true,
77
+ md2html: false,
78
+ args: '--merge-includes --multiline-term-definitions',
79
+ });
80
+ await compareDirectories(outputPath);
81
+ });
82
+
83
+ test('yfm-table: include followed by || separator is inlined', async () => {
84
+ const {inputPath, outputPath} = getTestPaths('mocks/merge-includes/yfm-table');
85
+
86
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
87
+ md2md: true,
88
+ md2html: false,
89
+ args: '--merge-includes',
90
+ });
91
+ await compareDirectories(outputPath);
92
+ });
93
+
94
+ test('html-in-list: include with <style> in list (any indent) uses fallback', async () => {
95
+ const {inputPath, outputPath} = getTestPaths('mocks/merge-includes/html-in-list');
96
+
97
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
98
+ md2md: true,
99
+ md2html: false,
100
+ args: '--merge-includes',
101
+ });
102
+ await compareDirectories(outputPath);
103
+ });
104
+
105
+ test('hash-section-html: hash-section include in list is inlined when only other section has <style>', async () => {
106
+ const {inputPath, outputPath} = getTestPaths('mocks/merge-includes/hash-section-html');
107
+
108
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
109
+ md2md: true,
110
+ md2html: false,
111
+ args: '--merge-includes',
112
+ });
113
+ await compareDirectories(outputPath);
114
+ });
115
+
72
116
  test('without flag: includes are NOT merged', async () => {
73
117
  const {inputPath, outputPath} = getTestPaths('mocks/merge-includes/basic');
74
118
 
@@ -98,3 +98,30 @@ describe('Pdf generation with md2md phase, only files structure', () => {
98
98
  'mocks/pdf-page/title-pages',
99
99
  );
100
100
  });
101
+
102
+ describe('Pdf page with custom icon', () => {
103
+ test('md2md copies custom pdf icon asset to output', async () => {
104
+ const {inputPath, outputPath} = getTestPaths('mocks/pdf-page/custom-pdf-icon');
105
+
106
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
107
+ md2md: true,
108
+ md2html: false,
109
+ args: '--allow-custom-resources',
110
+ });
111
+
112
+ await compareDirectories(outputPath, true);
113
+ await cleanupDirectory(outputPath);
114
+ });
115
+
116
+ test('md2html copies all files and produces correct pdfIconConfig in __DATA__', async () => {
117
+ const {inputPath, outputPath} = getTestPaths('mocks/pdf-page/custom-pdf-icon');
118
+
119
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
120
+ md2md: false,
121
+ md2html: true,
122
+ });
123
+
124
+ await compareDirectories(outputPath);
125
+ await cleanupDirectory(outputPath);
126
+ });
127
+ });
@@ -0,0 +1,11 @@
1
+ ## Section with style {#with-style}
2
+
3
+ <style>
4
+ .highlight { background: yellow; }
5
+ </style>
6
+
7
+ Some styled content.
8
+
9
+ ## Section without style {#no-style}
10
+
11
+ Just plain text content without any HTML blocks.
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ Welcome page.
@@ -0,0 +1,13 @@
1
+ # Main Document
2
+
3
+ Content before list.
4
+
5
+ 1. First item
6
+
7
+ 2. Second item with hash-section include (section has no HTML, but other section in same file does):
8
+
9
+ {% include notitle [no-style](_includes/mixed.md#no-style) %}
10
+
11
+ 3. Third item
12
+
13
+ Content after list.
@@ -0,0 +1,5 @@
1
+ title: Merge Includes Hash Section HTML
2
+ href: index.md
3
+ items:
4
+ - name: Main
5
+ href: main.md
@@ -0,0 +1,7 @@
1
+ <style>
2
+
3
+ .yfm .highlight {
4
+ background: yellow;
5
+ }
6
+
7
+ </style>
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ Welcome page.
@@ -0,0 +1,11 @@
1
+ # Main Document
2
+
3
+ Content before list.
4
+
5
+ - List item with inline include (any non-zero indent → HTML block must use fallback)
6
+
7
+ {% include [styles](_includes/styles.md) %}
8
+
9
+ - Another list item
10
+
11
+ Content after list.
@@ -0,0 +1,5 @@
1
+ title: Merge Includes HTML in List
2
+ href: index.md
3
+ items:
4
+ - name: Main
5
+ href: main.md
@@ -0,0 +1,7 @@
1
+ ## Chapter
2
+
3
+ Chapter content with [link](./local.md).
4
+
5
+ [*api]: Application Programming Interface
6
+
7
+ [*sdk]: Software Development Kit
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ Welcome page.
@@ -0,0 +1,7 @@
1
+ # API Docs
2
+
3
+ Use the [API](*api) and [SDK](*sdk) to build apps.
4
+
5
+ {% include [chapter](_includes/chapter.md) %}
6
+
7
+ [*api]: Application Programming Interface
@@ -0,0 +1,5 @@
1
+ title: Merge Includes Term Extract
2
+ href: index.md
3
+ items:
4
+ - name: Main
5
+ href: main.md
@@ -0,0 +1 @@
1
+ Buy now at [our store](https://example.com/store).
@@ -0,0 +1,3 @@
1
+ # Index
2
+
3
+ Welcome page.
@@ -0,0 +1,12 @@
1
+ # Main Document
2
+
3
+ #|
4
+ || **Option** | **Details** ||
5
+ || Option A |
6
+ Some description of option A.
7
+
8
+ {% include [cell](_includes/cell-content.md) %}||
9
+ || Option B | Plain text cell. ||
10
+ |#
11
+
12
+ Content after table.
@@ -0,0 +1,5 @@
1
+ title: Merge Includes YFM Table
2
+ href: index.md
3
+ items:
4
+ - name: Main
5
+ href: main.md
@@ -0,0 +1,6 @@
1
+ pdf:
2
+ enabled: true
3
+ size: M
4
+ position: header
5
+ icon: _assets/custom-pdf-icon.svg
6
+ pdfFileUrl: pdf/output.pdf
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" aria-hidden="true" class="g-icon Item-module__gn-composite-bar-item__collapse-item-icon___CD-ao"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16"><path fill="#657B8F" d="M7.181 13.318h3.887v2.045H5.136V5.341h2.045zm7.774-6.955h-3.683v4.705H9.227v-6.75h3.682V2.682h-9.41V5.34H1.456V.637h13.5z"/></svg></svg>
@@ -0,0 +1 @@
1
+ # PDF mock index
@@ -0,0 +1,2 @@
1
+ title: Pdf custom link
2
+ href: index.md
@@ -21,6 +21,38 @@ Special local title
21
21
  Circular title
22
22
  [{#T}](./autotitle.md#header)
23
23
 
24
+ Autotitle from include
25
+ <!-- [{#T}](includes/fragments.md#f3) -->
26
+
27
+ Include with autotitle
28
+ <!-- {% include [test](includes/fragments.md#f4) %} -->
29
+
30
+ link with [some local term1](*term1-1)
31
+
32
+ {% list tabs %}
33
+
34
+ - Название таба 1
35
+
36
+ Текст таба 1.
37
+
38
+ * Можно использовать списки.
39
+ * И **другую** разметку.
40
+
41
+ - Название таба 2
42
+
43
+ Текст таба 2.
44
+
45
+ {% endlist %}
46
+
47
+ All fragments
48
+
49
+ {% include [test](includes/fragments.md) %}
50
+
51
+
24
52
  ## Header {#header}
25
53
 
26
- Content
54
+ Content2
55
+
56
+ {% include [test](includes/styles.md) %}
57
+
58
+ [*term1-1]: {% include [test](includes/fragments.md#f3) %}
@@ -15,3 +15,27 @@ Some paragraph with anchor {#p1}
15
15
  Some paragraph without anchor
16
16
 
17
17
  Some paragraph with anchor {#p2}
18
+
19
+ ## F4 {#f4}
20
+ Content F4
21
+ [{#T}](../autotitle.md#header)
22
+
23
+ ### F4.1 {#f4.1}
24
+ link with [some term1](*term1)
25
+
26
+ {% list tabs %}
27
+
28
+ - Название таба 1
29
+
30
+ Текст таба 1.
31
+
32
+ * Можно использовать списки.
33
+ * И **другую** разметку.
34
+
35
+ - Название таба 2
36
+
37
+ Текст таба 2.
38
+
39
+ {% endlist %}
40
+
41
+ [*term1]: Some description
@@ -0,0 +1,8 @@
1
+ <style>
2
+
3
+ .yfm .border-yes {
4
+ border: 1px solid #ccc;
5
+ border-radius: 10px;
6
+ }
7
+
8
+ </style>
@@ -15,10 +15,16 @@ Text
15
15
 
16
16
  [[?](*term)](http://ya.ru)
17
17
 
18
+ [Term 1](*term1) [Term 2](*term2)
18
19
 
19
20
  Link after include
20
21
  [{#T}](./1.md#subtitle)
21
22
 
23
+ Autotitle include
24
+ <!-- [{#T}](includes/fragments.md#f3) -->
25
+
22
26
  Link after include
23
27
 
24
28
  [*term]: Test terms
29
+ [*term1]: {% include [test](includes/fragments.md#f3) %}
30
+ [*term2]: {% include [test](includes/fragments.md#f3) %}
@@ -11,6 +11,8 @@ items:
11
11
  href:
12
12
  - name: Multitoc item
13
13
  href: ./merge/merged.md
14
+ - name: Fragments
15
+ href: ./includes/fragments.md
14
16
  - include: {path: toc-i.yaml}
15
17
  - include: {path: sub/toc.yaml, mode: link}
16
18
  - href: ./mermaid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.36.0",
3
+ "version": "5.36.1",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },