@diplodoc/transform 4.32.4 → 4.34.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/dist/css/_yfm-only.css +164 -0
- package/dist/css/_yfm-only.css.map +7 -0
- package/dist/css/_yfm-only.min.css +2 -0
- package/dist/css/_yfm-only.min.css.map +7 -0
- package/dist/css/base.css +580 -0
- package/dist/css/base.css.map +7 -0
- package/dist/css/base.min.css +2 -0
- package/dist/css/base.min.css.map +7 -0
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css +73 -73
- package/dist/css/yfm.css.map +3 -3
- package/dist/css/yfm.min.css +1 -1
- package/dist/css/yfm.min.css.map +3 -3
- package/dist/js/_yfm-only.js +223 -0
- package/dist/js/_yfm-only.js.map +7 -0
- package/dist/js/_yfm-only.min.js +2 -0
- package/dist/js/_yfm-only.min.js.map +7 -0
- package/dist/js/base.js +138 -0
- package/dist/js/base.js.map +7 -0
- package/dist/js/base.min.js +2 -0
- package/dist/js/base.min.js.map +7 -0
- package/lib/plugins/includes/collect.js +14 -11
- package/lib/plugins/includes/collect.js.map +1 -1
- package/lib/plugins/includes/types.d.ts +1 -0
- package/lib/preprocessors/included/index.js +1 -1
- package/lib/preprocessors/included/index.js.map +1 -1
- package/package.json +1 -1
- package/src/js/_yfm-only.ts +1 -0
- package/src/js/base.ts +2 -0
- package/src/js/index.ts +2 -3
- package/src/scss/_yfm-only.scss +12 -0
- package/src/scss/base.scss +4 -0
- package/src/scss/yfm.scss +2 -9
- package/src/transform/plugins/includes/collect.ts +16 -23
- package/src/transform/plugins/includes/types.ts +1 -0
- package/src/transform/preprocessors/included/index.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './term';
|
package/src/js/base.ts
ADDED
package/src/js/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Note: This file excludes "cut" and "tabs" as they are handled separately
|
|
3
|
+
in dedicated extensions (packages). In the future, "note", "file", "term"
|
|
4
|
+
and "table" will also be excluded from this file and moved to yfm.scss,
|
|
5
|
+
once they are moved to separate packages. Direct usage is not recommended,
|
|
6
|
+
as the file is subject to changes without prior notice.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
@import 'note';
|
|
10
|
+
@import 'file';
|
|
11
|
+
@import 'table';
|
|
12
|
+
@import 'term';
|
package/src/scss/yfm.scss
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
@import '
|
|
2
|
-
@import '
|
|
3
|
-
@import 'anchor';
|
|
4
|
-
@import 'highlight';
|
|
5
|
-
@import 'code';
|
|
6
|
-
@import 'file';
|
|
7
|
-
@import 'term';
|
|
8
|
-
@import 'table';
|
|
1
|
+
@import 'base';
|
|
2
|
+
@import 'yfm-only';
|
|
9
3
|
@import 'modal';
|
|
10
|
-
|
|
11
4
|
@import '@diplodoc/cut-extension/runtime';
|
|
12
5
|
@import '@diplodoc/tabs-extension/runtime';
|
|
@@ -12,7 +12,6 @@ function processRecursive(
|
|
|
12
12
|
includePath: string,
|
|
13
13
|
targetDestPath: string,
|
|
14
14
|
options: IncludeCollectOpts,
|
|
15
|
-
appendix: Map<string, string>,
|
|
16
15
|
) {
|
|
17
16
|
const {path, log, copyFile, includedParentPath: includedParentPathNullable, included} = options;
|
|
18
17
|
const includedParentPath = includedParentPathNullable || path;
|
|
@@ -34,20 +33,16 @@ function processRecursive(
|
|
|
34
33
|
const includedRelativePath = getRelativePath(includedParentPath, includePath);
|
|
35
34
|
|
|
36
35
|
// The appendix is the map that protects from multiple include files
|
|
37
|
-
if (!appendix
|
|
36
|
+
if (!options.appendix?.has(includedRelativePath)) {
|
|
38
37
|
// Recursive function to include the depth structure
|
|
39
|
-
const includeContent = collectRecursive(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
includedParentPath,
|
|
45
|
-
},
|
|
46
|
-
appendix,
|
|
47
|
-
);
|
|
38
|
+
const includeContent = collectRecursive(content, {
|
|
39
|
+
...options,
|
|
40
|
+
path: includePath,
|
|
41
|
+
includedParentPath,
|
|
42
|
+
});
|
|
48
43
|
|
|
49
44
|
// Add to appendix set structure
|
|
50
|
-
appendix
|
|
45
|
+
options.appendix?.set(
|
|
51
46
|
includedRelativePath,
|
|
52
47
|
`{% included (${includedRelativePath}) %}\n${includeContent}\n{% endincluded %}`,
|
|
53
48
|
);
|
|
@@ -59,11 +54,7 @@ function processRecursive(
|
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
function collectRecursive(
|
|
63
|
-
result: string,
|
|
64
|
-
options: IncludeCollectOpts,
|
|
65
|
-
appendix: Map<string, string>,
|
|
66
|
-
) {
|
|
57
|
+
function collectRecursive(result: string, options: IncludeCollectOpts) {
|
|
67
58
|
const {root, path, destPath = '', log, singlePage} = options;
|
|
68
59
|
|
|
69
60
|
const INCLUDE_REGEXP = /{%\s*include\s*(notitle)?\s*\[(.+?)]\((.+?)\)\s*%}/g;
|
|
@@ -100,7 +91,7 @@ function collectRecursive(
|
|
|
100
91
|
|
|
101
92
|
includesPaths.push(includePath);
|
|
102
93
|
|
|
103
|
-
processRecursive(includePath, targetDestPath, options
|
|
94
|
+
processRecursive(includePath, targetDestPath, options);
|
|
104
95
|
|
|
105
96
|
includesPaths.pop();
|
|
106
97
|
}
|
|
@@ -109,14 +100,16 @@ function collectRecursive(
|
|
|
109
100
|
}
|
|
110
101
|
|
|
111
102
|
function collect(input: string, options: IncludeCollectOpts) {
|
|
112
|
-
const
|
|
103
|
+
const shouldWriteAppendix = !options.appendix;
|
|
104
|
+
|
|
105
|
+
options.appendix = options.appendix ?? new Map();
|
|
113
106
|
|
|
114
|
-
input = collectRecursive(input, options
|
|
107
|
+
input = collectRecursive(input, options);
|
|
115
108
|
|
|
116
|
-
if (
|
|
109
|
+
if (shouldWriteAppendix) {
|
|
117
110
|
// Appendix should be appended to the end of the file (it supports depth structure, so the included files will have included as well)
|
|
118
|
-
if (appendix.size > 0) {
|
|
119
|
-
input += '\n' + [...appendix.values()].join('\n');
|
|
111
|
+
if (options.appendix.size > 0) {
|
|
112
|
+
input += '\n' + [...options.appendix.values()].join('\n');
|
|
120
113
|
}
|
|
121
114
|
}
|
|
122
115
|
|
|
@@ -74,7 +74,7 @@ const index: MarkdownItPreprocessorCb<{
|
|
|
74
74
|
|
|
75
75
|
// To reduce file reading we can include the file content into the generated content
|
|
76
76
|
if (included) {
|
|
77
|
-
const lines = input
|
|
77
|
+
const lines = input?.split('\n') || [];
|
|
78
78
|
|
|
79
79
|
// The finction reads the files from bottom to top(!). It stops the loop if it does not have anything to swap.
|
|
80
80
|
// If the function finds something to process then it restarts the loop because the position of the last element has been moved.
|