@diplodoc/transform 4.0.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/CHANGELOG.diplodoc.md +38 -0
- package/CHANGELOG.md +404 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/README.ru.md +36 -0
- package/dist/css/yfm.css +736 -0
- package/dist/css/yfm.css.map +7 -0
- package/dist/css/yfm.min.css +2 -0
- package/dist/css/yfm.min.css.map +7 -0
- package/dist/js/code.d.ts +1 -0
- package/dist/js/cut.d.ts +1 -0
- package/dist/js/index.d.ts +5 -0
- package/dist/js/polyfill.d.ts +1 -0
- package/dist/js/tabs.d.ts +1 -0
- package/dist/js/term/index.d.ts +1 -0
- package/dist/js/term/utils.d.ts +10 -0
- package/dist/js/utils.d.ts +2 -0
- package/dist/js/yfm.js +432 -0
- package/dist/js/yfm.js.map +7 -0
- package/dist/js/yfm.min.js +2 -0
- package/dist/js/yfm.min.js.map +7 -0
- package/lib/getObject.d.ts +2 -0
- package/lib/getObject.js +11 -0
- package/lib/getObject.js.map +1 -0
- package/lib/headings.d.ts +4 -0
- package/lib/headings.js +73 -0
- package/lib/headings.js.map +1 -0
- package/lib/highlight.d.ts +3 -0
- package/lib/highlight.js +29 -0
- package/lib/highlight.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +35 -0
- package/lib/index.js.map +1 -0
- package/lib/liquid/conditions.d.ts +4 -0
- package/lib/liquid/conditions.js +181 -0
- package/lib/liquid/conditions.js.map +1 -0
- package/lib/liquid/cycles.d.ts +4 -0
- package/lib/liquid/cycles.js +160 -0
- package/lib/liquid/cycles.js.map +1 -0
- package/lib/liquid/errors.d.ts +3 -0
- package/lib/liquid/errors.js +13 -0
- package/lib/liquid/errors.js.map +1 -0
- package/lib/liquid/evaluation.d.ts +3 -0
- package/lib/liquid/evaluation.js +138 -0
- package/lib/liquid/evaluation.js.map +1 -0
- package/lib/liquid/filters.d.ts +9 -0
- package/lib/liquid/filters.js +22 -0
- package/lib/liquid/filters.js.map +1 -0
- package/lib/liquid/index.d.ts +9 -0
- package/lib/liquid/index.js +87 -0
- package/lib/liquid/index.js.map +1 -0
- package/lib/liquid/lexical.d.ts +14 -0
- package/lib/liquid/lexical.js +79 -0
- package/lib/liquid/lexical.js.map +1 -0
- package/lib/liquid/services/argv.d.ts +15 -0
- package/lib/liquid/services/argv.js +17 -0
- package/lib/liquid/services/argv.js.map +1 -0
- package/lib/liquid/sourceMap.d.ts +24 -0
- package/lib/liquid/sourceMap.js +56 -0
- package/lib/liquid/sourceMap.js.map +1 -0
- package/lib/liquid/substitutions.d.ts +2 -0
- package/lib/liquid/substitutions.js +36 -0
- package/lib/liquid/substitutions.js.map +1 -0
- package/lib/liquid/utils.d.ts +8 -0
- package/lib/liquid/utils.js +24 -0
- package/lib/liquid/utils.js.map +1 -0
- package/lib/log.d.ts +18 -0
- package/lib/log.js +54 -0
- package/lib/log.js.map +1 -0
- package/lib/md.d.ts +14 -0
- package/lib/md.js +96 -0
- package/lib/md.js.map +1 -0
- package/lib/plugins/anchors/collect.d.ts +5 -0
- package/lib/plugins/anchors/collect.js +81 -0
- package/lib/plugins/anchors/collect.js.map +1 -0
- package/lib/plugins/anchors/constants.d.ts +2 -0
- package/lib/plugins/anchors/constants.js +6 -0
- package/lib/plugins/anchors/constants.js.map +1 -0
- package/lib/plugins/anchors/index.d.ts +7 -0
- package/lib/plugins/anchors/index.js +134 -0
- package/lib/plugins/anchors/index.js.map +1 -0
- package/lib/plugins/changelog/collect.d.ts +8 -0
- package/lib/plugins/changelog/collect.js +50 -0
- package/lib/plugins/changelog/collect.js.map +1 -0
- package/lib/plugins/changelog/index.d.ts +6 -0
- package/lib/plugins/changelog/index.js +131 -0
- package/lib/plugins/changelog/index.js.map +1 -0
- package/lib/plugins/changelog/types.d.ts +10 -0
- package/lib/plugins/changelog/types.js +3 -0
- package/lib/plugins/changelog/types.js.map +1 -0
- package/lib/plugins/checkbox/checkbox.d.ts +7 -0
- package/lib/plugins/checkbox/checkbox.js +91 -0
- package/lib/plugins/checkbox/checkbox.js.map +1 -0
- package/lib/plugins/checkbox/index.d.ts +8 -0
- package/lib/plugins/checkbox/index.js +12 -0
- package/lib/plugins/checkbox/index.js.map +1 -0
- package/lib/plugins/code.d.ts +3 -0
- package/lib/plugins/code.js +61 -0
- package/lib/plugins/code.js.map +1 -0
- package/lib/plugins/cut.d.ts +3 -0
- package/lib/plugins/cut.js +70 -0
- package/lib/plugins/cut.js.map +1 -0
- package/lib/plugins/deflist.d.ts +3 -0
- package/lib/plugins/deflist.js +8 -0
- package/lib/plugins/deflist.js.map +1 -0
- package/lib/plugins/file/const.d.ts +27 -0
- package/lib/plugins/file/const.js +47 -0
- package/lib/plugins/file/const.js.map +1 -0
- package/lib/plugins/file/file.d.ts +8 -0
- package/lib/plugins/file/file.js +63 -0
- package/lib/plugins/file/file.js.map +1 -0
- package/lib/plugins/file/index.d.ts +4 -0
- package/lib/plugins/file/index.js +9 -0
- package/lib/plugins/file/index.js.map +1 -0
- package/lib/plugins/images/collect.d.ts +8 -0
- package/lib/plugins/images/collect.js +43 -0
- package/lib/plugins/images/collect.js.map +1 -0
- package/lib/plugins/images/index.d.ts +10 -0
- package/lib/plugins/images/index.js +81 -0
- package/lib/plugins/images/index.js.map +1 -0
- package/lib/plugins/imsize/const.d.ts +7 -0
- package/lib/plugins/imsize/const.js +12 -0
- package/lib/plugins/imsize/const.js.map +1 -0
- package/lib/plugins/imsize/helpers.d.ts +6 -0
- package/lib/plugins/imsize/helpers.js +64 -0
- package/lib/plugins/imsize/helpers.js.map +1 -0
- package/lib/plugins/imsize/index.d.ts +8 -0
- package/lib/plugins/imsize/index.js +12 -0
- package/lib/plugins/imsize/index.js.map +1 -0
- package/lib/plugins/imsize/plugin.d.ts +3 -0
- package/lib/plugins/imsize/plugin.js +188 -0
- package/lib/plugins/imsize/plugin.js.map +1 -0
- package/lib/plugins/includes/collect.d.ts +8 -0
- package/lib/plugins/includes/collect.js +49 -0
- package/lib/plugins/includes/collect.js.map +1 -0
- package/lib/plugins/includes/index.d.ts +8 -0
- package/lib/plugins/includes/index.js +98 -0
- package/lib/plugins/includes/index.js.map +1 -0
- package/lib/plugins/links/collect.d.ts +7 -0
- package/lib/plugins/links/collect.js +74 -0
- package/lib/plugins/links/collect.js.map +1 -0
- package/lib/plugins/links/constants.d.ts +1 -0
- package/lib/plugins/links/constants.js +5 -0
- package/lib/plugins/links/constants.js.map +1 -0
- package/lib/plugins/links/index.d.ts +24 -0
- package/lib/plugins/links/index.js +178 -0
- package/lib/plugins/links/index.js.map +1 -0
- package/lib/plugins/meta.d.ts +3 -0
- package/lib/plugins/meta.js +8 -0
- package/lib/plugins/meta.js.map +1 -0
- package/lib/plugins/monospace.d.ts +3 -0
- package/lib/plugins/monospace.js +109 -0
- package/lib/plugins/monospace.js.map +1 -0
- package/lib/plugins/notes.d.ts +3 -0
- package/lib/plugins/notes.js +103 -0
- package/lib/plugins/notes.js.map +1 -0
- package/lib/plugins/sup.d.ts +3 -0
- package/lib/plugins/sup.js +8 -0
- package/lib/plugins/sup.js.map +1 -0
- package/lib/plugins/table/index.d.ts +3 -0
- package/lib/plugins/table/index.js +215 -0
- package/lib/plugins/table/index.js.map +1 -0
- package/lib/plugins/tabs.d.ts +4 -0
- package/lib/plugins/tabs.js +4 -0
- package/lib/plugins/tabs.js.map +1 -0
- package/lib/plugins/term/constants.d.ts +1 -0
- package/lib/plugins/term/constants.js +5 -0
- package/lib/plugins/term/constants.js.map +1 -0
- package/lib/plugins/term/index.d.ts +3 -0
- package/lib/plugins/term/index.js +108 -0
- package/lib/plugins/term/index.js.map +1 -0
- package/lib/plugins/term/termDefinitions.d.ts +4 -0
- package/lib/plugins/term/termDefinitions.js +125 -0
- package/lib/plugins/term/termDefinitions.js.map +1 -0
- package/lib/plugins/typings.d.ts +12 -0
- package/lib/plugins/typings.js +3 -0
- package/lib/plugins/typings.js.map +1 -0
- package/lib/plugins/utils.d.ts +6 -0
- package/lib/plugins/utils.js +30 -0
- package/lib/plugins/utils.js.map +1 -0
- package/lib/plugins/video/const.d.ts +10 -0
- package/lib/plugins/video/const.js +22 -0
- package/lib/plugins/video/const.js.map +1 -0
- package/lib/plugins/video/index.d.ts +8 -0
- package/lib/plugins/video/index.js +104 -0
- package/lib/plugins/video/index.js.map +1 -0
- package/lib/plugins/video/parsers.d.ts +6 -0
- package/lib/plugins/video/parsers.js +64 -0
- package/lib/plugins/video/parsers.js.map +1 -0
- package/lib/plugins/video/types.d.ts +34 -0
- package/lib/plugins/video/types.js +3 -0
- package/lib/plugins/video/types.js.map +1 -0
- package/lib/plugins/video/utils.d.ts +2 -0
- package/lib/plugins/video/utils.js +25 -0
- package/lib/plugins/video/utils.js.map +1 -0
- package/lib/plugins.d.ts +3 -0
- package/lib/plugins.js +36 -0
- package/lib/plugins.js.map +1 -0
- package/lib/sanitize.d.ts +12 -0
- package/lib/sanitize.js +572 -0
- package/lib/sanitize.js.map +1 -0
- package/lib/title.d.ts +7 -0
- package/lib/title.js +18 -0
- package/lib/title.js.map +1 -0
- package/lib/typings.d.ts +57 -0
- package/lib/typings.js +3 -0
- package/lib/typings.js.map +1 -0
- package/lib/utils.d.ts +13 -0
- package/lib/utils.js +79 -0
- package/lib/utils.js.map +1 -0
- package/lib/utilsFS.d.ts +27 -0
- package/lib/utilsFS.js +89 -0
- package/lib/utilsFS.js.map +1 -0
- package/lib/yfmlint/index.d.ts +26 -0
- package/lib/yfmlint/index.js +72 -0
- package/lib/yfmlint/index.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.d.ts +9 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.js +22 -0
- package/lib/yfmlint/markdownlint-custom-rule/index.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm001.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.js +33 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm002.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.js +33 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm003.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm004.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm005.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm006.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.js +29 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm007.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.js +28 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm008.js.map +1 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.d.ts +2 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.js +47 -0
- package/lib/yfmlint/markdownlint-custom-rule/yfm009.js.map +1 -0
- package/lib/yfmlint/typings.d.ts +12 -0
- package/lib/yfmlint/typings.js +3 -0
- package/lib/yfmlint/typings.js.map +1 -0
- package/lib/yfmlint/utils.d.ts +9 -0
- package/lib/yfmlint/utils.js +22 -0
- package/lib/yfmlint/utils.js.map +1 -0
- package/lib/yfmlint/yfmlint.d.ts +3 -0
- package/lib/yfmlint/yfmlint.js +69 -0
- package/lib/yfmlint/yfmlint.js.map +1 -0
- package/package.json +106 -0
- package/src/.eslintrc +10 -0
- package/src/js/code.ts +65 -0
- package/src/js/cut.ts +57 -0
- package/src/js/index.ts +6 -0
- package/src/js/polyfill.js +27 -0
- package/src/js/term/index.ts +79 -0
- package/src/js/term/utils.ts +151 -0
- package/src/js/utils.ts +9 -0
- package/src/scss/_anchor.scss +33 -0
- package/src/scss/_code.scss +23 -0
- package/src/scss/_common.scss +407 -0
- package/src/scss/_cut.scss +42 -0
- package/src/scss/_file.scss +35 -0
- package/src/scss/_highlight.scss +96 -0
- package/src/scss/_note.scss +73 -0
- package/src/scss/_print.scss +20 -0
- package/src/scss/_term.scss +79 -0
- package/src/scss/_variables.scss +16 -0
- package/src/scss/yfm.scss +11 -0
- package/src/transform/getObject.ts +10 -0
- package/src/transform/headings.ts +88 -0
- package/src/transform/highlight.ts +33 -0
- package/src/transform/index.ts +50 -0
- package/src/transform/liquid/conditions.ts +259 -0
- package/src/transform/liquid/cycles.ts +244 -0
- package/src/transform/liquid/errors.ts +10 -0
- package/src/transform/liquid/evaluation.ts +145 -0
- package/src/transform/liquid/filters.ts +19 -0
- package/src/transform/liquid/index.ts +141 -0
- package/src/transform/liquid/lexical.ts +86 -0
- package/src/transform/liquid/services/argv.ts +23 -0
- package/src/transform/liquid/sourceMap.ts +72 -0
- package/src/transform/liquid/substitutions.ts +40 -0
- package/src/transform/liquid/utils.ts +30 -0
- package/src/transform/log.ts +60 -0
- package/src/transform/md.ts +123 -0
- package/src/transform/plugins/anchors/collect.ts +101 -0
- package/src/transform/plugins/anchors/constants.ts +2 -0
- package/src/transform/plugins/anchors/index.ts +166 -0
- package/src/transform/plugins/changelog/collect.ts +66 -0
- package/src/transform/plugins/changelog/index.ts +164 -0
- package/src/transform/plugins/changelog/types.ts +10 -0
- package/src/transform/plugins/checkbox/checkbox.ts +107 -0
- package/src/transform/plugins/checkbox/index.ts +15 -0
- package/src/transform/plugins/code.ts +79 -0
- package/src/transform/plugins/cut.ts +98 -0
- package/src/transform/plugins/deflist.ts +5 -0
- package/src/transform/plugins/file/README.md +34 -0
- package/src/transform/plugins/file/const.ts +46 -0
- package/src/transform/plugins/file/file.ts +82 -0
- package/src/transform/plugins/file/index.ts +10 -0
- package/src/transform/plugins/images/collect.ts +60 -0
- package/src/transform/plugins/images/index.ts +119 -0
- package/src/transform/plugins/imsize/const.ts +7 -0
- package/src/transform/plugins/imsize/helpers.ts +75 -0
- package/src/transform/plugins/imsize/index.ts +14 -0
- package/src/transform/plugins/imsize/plugin.ts +214 -0
- package/src/transform/plugins/includes/collect.ts +73 -0
- package/src/transform/plugins/includes/index.ts +127 -0
- package/src/transform/plugins/links/collect.ts +92 -0
- package/src/transform/plugins/links/constants.ts +1 -0
- package/src/transform/plugins/links/index.ts +218 -0
- package/src/transform/plugins/meta.ts +5 -0
- package/src/transform/plugins/monospace.ts +141 -0
- package/src/transform/plugins/notes.ts +134 -0
- package/src/transform/plugins/sup.ts +5 -0
- package/src/transform/plugins/table/index.ts +290 -0
- package/src/transform/plugins/tabs.ts +3 -0
- package/src/transform/plugins/term/constants.ts +1 -0
- package/src/transform/plugins/term/index.ts +139 -0
- package/src/transform/plugins/term/termDefinitions.ts +177 -0
- package/src/transform/plugins/typings.ts +14 -0
- package/src/transform/plugins/utils.ts +38 -0
- package/src/transform/plugins/video/const.ts +20 -0
- package/src/transform/plugins/video/index.ts +134 -0
- package/src/transform/plugins/video/parsers.ts +65 -0
- package/src/transform/plugins/video/types.ts +27 -0
- package/src/transform/plugins/video/utils.ts +24 -0
- package/src/transform/plugins.ts +35 -0
- package/src/transform/sanitize.ts +596 -0
- package/src/transform/title.ts +22 -0
- package/src/transform/typings.ts +64 -0
- package/src/transform/utils.ts +91 -0
- package/src/transform/utilsFS.ts +128 -0
- package/src/transform/yfmlint/README.md +48 -0
- package/src/transform/yfmlint/index.ts +124 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/index.ts +9 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm001.ts +36 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm002.ts +33 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm003.ts +33 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm004.ts +27 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm005.ts +27 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm006.ts +26 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm007.ts +28 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm008.ts +26 -0
- package/src/transform/yfmlint/markdownlint-custom-rule/yfm009.ts +54 -0
- package/src/transform/yfmlint/typings.ts +13 -0
- package/src/transform/yfmlint/utils.ts +31 -0
- package/src/transform/yfmlint/yfmlint.ts +73 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@import 'variables';
|
|
2
|
+
|
|
3
|
+
.yfm {
|
|
4
|
+
.hljs {
|
|
5
|
+
display: block;
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
padding: 16px;
|
|
8
|
+
background: $codeBackgroundColor;
|
|
9
|
+
background: var(--yfm-color-hljs-background);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.hljs,
|
|
13
|
+
.hljs-subst {
|
|
14
|
+
color: #444;
|
|
15
|
+
color: var(--yfm-color-hljs-subst);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.hljs-comment {
|
|
19
|
+
color: #888888;
|
|
20
|
+
color: var(--yfm-color-hljs-comment);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
.hljs-keyword,
|
|
25
|
+
.hljs-attribute,
|
|
26
|
+
.hljs-selector-tag,
|
|
27
|
+
.hljs-meta-keyword,
|
|
28
|
+
.hljs-doctag,
|
|
29
|
+
.hljs-name {
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.hljs-type,
|
|
34
|
+
.hljs-string,
|
|
35
|
+
.hljs-number,
|
|
36
|
+
.hljs-selector-id,
|
|
37
|
+
.hljs-selector-class,
|
|
38
|
+
.hljs-quote,
|
|
39
|
+
.hljs-template-tag,
|
|
40
|
+
.hljs-deletion {
|
|
41
|
+
color: #880000;
|
|
42
|
+
color: var(--yfm-color-hljs-deletion);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.hljs-title,
|
|
46
|
+
.hljs-section {
|
|
47
|
+
color: #880000;
|
|
48
|
+
color: var(--yfm-color-hljs-section);
|
|
49
|
+
font-weight: bold;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.hljs-regexp,
|
|
53
|
+
.hljs-symbol,
|
|
54
|
+
.hljs-variable,
|
|
55
|
+
.hljs-template-variable,
|
|
56
|
+
.hljs-link,
|
|
57
|
+
.hljs-selector-attr,
|
|
58
|
+
.hljs-selector-pseudo {
|
|
59
|
+
color: #BC6060;
|
|
60
|
+
color: var(--yfm-color-hljs-pseudo);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
.hljs-literal {
|
|
65
|
+
color: #78A960;
|
|
66
|
+
color: var(--yfm-color-hljs-literal);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.hljs-built_in,
|
|
70
|
+
.hljs-bullet,
|
|
71
|
+
.hljs-code,
|
|
72
|
+
.hljs-addition {
|
|
73
|
+
color: #397300;
|
|
74
|
+
color: var(--yfm-color-hljs-addition);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
.hljs-meta {
|
|
79
|
+
color: #1f7199;
|
|
80
|
+
color: var(--yfm-color-hljs-meta);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.hljs-meta-string {
|
|
84
|
+
color: #4d99bf;
|
|
85
|
+
color: var(--yfm-color-hljs-meta-string);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
.hljs-emphasis {
|
|
90
|
+
font-style: italic;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.hljs-strong {
|
|
94
|
+
font-weight: bold;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@import 'variables';
|
|
2
|
+
|
|
3
|
+
$infoColor: $accentColor;
|
|
4
|
+
$tipColor: #56bd67;
|
|
5
|
+
$warningColor: #f19518;
|
|
6
|
+
$importantColor: #ff4645;
|
|
7
|
+
|
|
8
|
+
$infoBackgroundColor: rgba(2, 123, 243, 0.08);
|
|
9
|
+
$tipBackgroundColor: rgba(63, 201, 46, 0.1);
|
|
10
|
+
$warningBackgroundColor: rgba(255, 136, 0, 0.15);
|
|
11
|
+
$importantBackgroundColor: rgba(235, 50, 38, 0.08);
|
|
12
|
+
|
|
13
|
+
.yfm .yfm-note {
|
|
14
|
+
max-width: 1296px;
|
|
15
|
+
margin: 20px 0;
|
|
16
|
+
padding: 20px 20px 20px 64px;
|
|
17
|
+
border-radius: 10px;
|
|
18
|
+
|
|
19
|
+
.yfm-note-title {
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
& > p {
|
|
24
|
+
margin: 0 0 10px 0;
|
|
25
|
+
|
|
26
|
+
&:first-child {
|
|
27
|
+
&::before {
|
|
28
|
+
box-sizing: content-box;
|
|
29
|
+
display: block;
|
|
30
|
+
width: 24px;
|
|
31
|
+
height: 24px;
|
|
32
|
+
margin-top: -2px;
|
|
33
|
+
margin-left: -44px;
|
|
34
|
+
padding-right: 20px;
|
|
35
|
+
float: left;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:last-child {
|
|
40
|
+
margin-bottom: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
$colors: (
|
|
45
|
+
yfm-accent-info: $infoColor,
|
|
46
|
+
yfm-accent-tip: $tipColor,
|
|
47
|
+
yfm-accent-alert: $importantColor,
|
|
48
|
+
yfm-accent-warning: $warningColor
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
@each $type, $color in $colors {
|
|
52
|
+
&.#{$type} > p:first-child::before {
|
|
53
|
+
$r: red($color);
|
|
54
|
+
$g: green($color);
|
|
55
|
+
$b: blue($color);
|
|
56
|
+
$rgbColor: 'rgb(' + $r + ',' + $g + ',' + $b + ')';
|
|
57
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="' + $rgbColor + '"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
$backgroundColors: (
|
|
62
|
+
yfm-accent-info: $infoBackgroundColor,
|
|
63
|
+
yfm-accent-tip: $tipBackgroundColor,
|
|
64
|
+
yfm-accent-alert: $importantBackgroundColor,
|
|
65
|
+
yfm-accent-warning: $warningBackgroundColor
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
@each $type, $color in $backgroundColors {
|
|
69
|
+
&.#{$type} {
|
|
70
|
+
background: $color;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@media print {
|
|
2
|
+
.tab-list {
|
|
3
|
+
display: none !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.tab-panel:before {
|
|
7
|
+
content: attr(data-title);
|
|
8
|
+
margin-bottom: -1px;
|
|
9
|
+
margin-right: 20px;
|
|
10
|
+
border-bottom: 2px solid transparent;
|
|
11
|
+
line-height: 33px;
|
|
12
|
+
font-weight: 700;
|
|
13
|
+
outline: 0;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tab-panel {
|
|
18
|
+
display: block !important;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.yfm-term {
|
|
2
|
+
&_title {
|
|
3
|
+
color: #027bf3;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
|
|
6
|
+
border-bottom: 1px dotted;
|
|
7
|
+
|
|
8
|
+
font-size: inherit;
|
|
9
|
+
line-height: inherit;
|
|
10
|
+
font-style: normal;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
color: #004080;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&_dfn {
|
|
18
|
+
position: absolute;
|
|
19
|
+
z-index: 1000;
|
|
20
|
+
|
|
21
|
+
width: fit-content;
|
|
22
|
+
max-width: 450px;
|
|
23
|
+
|
|
24
|
+
@media screen and (max-width: 600px) {
|
|
25
|
+
& {
|
|
26
|
+
max-width: 80%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
visibility: hidden;
|
|
31
|
+
opacity: 0;
|
|
32
|
+
|
|
33
|
+
padding: 10px;
|
|
34
|
+
|
|
35
|
+
background-color: rgb(255, 255, 255);
|
|
36
|
+
|
|
37
|
+
font-size: inherit;
|
|
38
|
+
line-height: inherit;
|
|
39
|
+
font-style: normal;
|
|
40
|
+
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
|
|
43
|
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
|
44
|
+
outline: none;
|
|
45
|
+
|
|
46
|
+
&::before {
|
|
47
|
+
content: '';
|
|
48
|
+
position: absolute;
|
|
49
|
+
z-index: -1;
|
|
50
|
+
top: 0;
|
|
51
|
+
right: 0;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
|
|
55
|
+
border-radius: inherit;
|
|
56
|
+
box-shadow: 0 0 0 1px rgb(229, 229, 229);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.open {
|
|
60
|
+
visibility: visible;
|
|
61
|
+
|
|
62
|
+
animation-name: popup;
|
|
63
|
+
animation-duration: 0.1s;
|
|
64
|
+
animation-timing-function: ease-out;
|
|
65
|
+
animation-fill-mode: forwards;
|
|
66
|
+
|
|
67
|
+
@keyframes popup {
|
|
68
|
+
0% {
|
|
69
|
+
opacity: 0;
|
|
70
|
+
transform: translateY(10px);
|
|
71
|
+
}
|
|
72
|
+
100% {
|
|
73
|
+
opacity: 1;
|
|
74
|
+
transform: translateY(0);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
$baseColor: #ffffff;
|
|
2
|
+
$accentColor: #027bf3;
|
|
3
|
+
|
|
4
|
+
$textColor: rgba(0, 0, 0, 0.7);
|
|
5
|
+
$borderColor: rgba(0, 0, 0, 0.07);
|
|
6
|
+
$backgroundColor: rgba(0, 0, 0, 0.02);
|
|
7
|
+
|
|
8
|
+
$inlineCodeColor: rgba(59, 96, 128, 1);
|
|
9
|
+
$inlineCodeBackgroundColor: rgba(107, 132, 153, 0.12);
|
|
10
|
+
|
|
11
|
+
$codeBackgroundColor: rgba(107, 132, 153, 0.12);
|
|
12
|
+
|
|
13
|
+
$tableRowBackgroundColor: rgba(0, 0, 0, 0.02);
|
|
14
|
+
|
|
15
|
+
$linkColor: $accentColor;
|
|
16
|
+
$linkHoverColor: #004080;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export = function getObject(path: string, obj: Object) {
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
return path.split('.').reduce((acc: any | undefined, item) => {
|
|
4
|
+
if (!acc || !Object.getOwnPropertyNames(acc).includes(item)) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return acc[item];
|
|
9
|
+
}, obj);
|
|
10
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Token from 'markdown-it/lib/token';
|
|
2
|
+
import {Heading} from './typings';
|
|
3
|
+
|
|
4
|
+
function getTitle(token: Token) {
|
|
5
|
+
return (
|
|
6
|
+
token.children?.reduce((acc, tok) => {
|
|
7
|
+
if (tok.type === 'text' || tok.type === 'code_inline') {
|
|
8
|
+
return acc + tok.content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return acc;
|
|
12
|
+
}, '') || ''
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getHref(token: Token) {
|
|
17
|
+
return '#' + (token.attrGet('id') || '');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export = function getHeadings(tokens: Token[], needFlatListHeadings?: boolean) {
|
|
21
|
+
return needFlatListHeadings ? getFlatListHeadings(tokens) : getFilteredHeadings(tokens);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function getFilteredHeadings(tokens: Token[]) {
|
|
25
|
+
const headings: Heading[] = [];
|
|
26
|
+
let parents = [headings];
|
|
27
|
+
let prevLevel;
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
30
|
+
const isHeading = tokens[i].type === 'heading_open';
|
|
31
|
+
const level = Number.parseInt(tokens[i].tag.slice(1), 10);
|
|
32
|
+
|
|
33
|
+
if (isHeading && level >= 2) {
|
|
34
|
+
const entry = {
|
|
35
|
+
title: getTitle(tokens[i + 1]),
|
|
36
|
+
href: getHref(tokens[i]),
|
|
37
|
+
level,
|
|
38
|
+
};
|
|
39
|
+
let closestParent = parents[parents.length - 1];
|
|
40
|
+
|
|
41
|
+
if ((!prevLevel && level === 2) || prevLevel === level) {
|
|
42
|
+
closestParent.push(entry);
|
|
43
|
+
prevLevel = level;
|
|
44
|
+
// skip if nested heading level is lower than for previous by 2 or more
|
|
45
|
+
} else if (prevLevel && level - prevLevel === 1) {
|
|
46
|
+
const lastItemInClosestParent = closestParent[closestParent.length - 1];
|
|
47
|
+
const newParent = (lastItemInClosestParent.items = [entry]);
|
|
48
|
+
|
|
49
|
+
parents.push(newParent);
|
|
50
|
+
prevLevel = level;
|
|
51
|
+
} else if (prevLevel && level < prevLevel) {
|
|
52
|
+
const levelDiff = prevLevel - level;
|
|
53
|
+
const closestParentIndex = parents.length - levelDiff - 1;
|
|
54
|
+
|
|
55
|
+
if (closestParentIndex < 0) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
closestParent = parents[closestParentIndex];
|
|
60
|
+
closestParent.push(entry);
|
|
61
|
+
parents = parents.slice(0, closestParentIndex + 1);
|
|
62
|
+
prevLevel = level;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return headings;
|
|
68
|
+
}
|
|
69
|
+
function getFlatListHeadings(tokens: Token[]) {
|
|
70
|
+
const headings: Heading[] = [];
|
|
71
|
+
|
|
72
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
73
|
+
const isHeading = tokens[i].type === 'heading_open';
|
|
74
|
+
const level = Number.parseInt(tokens[i].tag.slice(1), 10);
|
|
75
|
+
|
|
76
|
+
if (!isHeading) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
headings.push({
|
|
81
|
+
title: getTitle(tokens[i + 1]),
|
|
82
|
+
href: getHref(tokens[i]),
|
|
83
|
+
level,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return headings;
|
|
88
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {escapeHtml} from 'markdown-it/lib/common/utils';
|
|
2
|
+
import {HighlightLangMap} from './typings';
|
|
3
|
+
|
|
4
|
+
export = function makeHighlight(langs: HighlightLangMap = {}) {
|
|
5
|
+
try {
|
|
6
|
+
// Important require.
|
|
7
|
+
// Because we want to have a posibility to run in projects without hljs dependency
|
|
8
|
+
const hljs = require('highlight.js');
|
|
9
|
+
|
|
10
|
+
Object.keys(langs).forEach((lang) => {
|
|
11
|
+
hljs.registerLanguage(lang, langs[lang]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return function highlight(str: string, lang: string) {
|
|
15
|
+
let highlightedStr;
|
|
16
|
+
const classNames = ['hljs'];
|
|
17
|
+
|
|
18
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
19
|
+
classNames.push(lang);
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
highlightedStr = hljs.highlight(lang, str, true).value;
|
|
23
|
+
} catch (_) {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
highlightedStr = highlightedStr || escapeHtml(str);
|
|
27
|
+
|
|
28
|
+
return `<pre><code class="${classNames.join(' ')}">${highlightedStr}</code></pre>`;
|
|
29
|
+
};
|
|
30
|
+
} catch {
|
|
31
|
+
return (str: string) => escapeHtml(str);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {OptionsType, OutputType, EnvType} from './typings';
|
|
2
|
+
import {bold} from 'chalk';
|
|
3
|
+
import {log} from './log';
|
|
4
|
+
import liquid from './liquid';
|
|
5
|
+
import initMarkdownit from './md';
|
|
6
|
+
|
|
7
|
+
function applyLiquid(input: string, options: OptionsType) {
|
|
8
|
+
const {
|
|
9
|
+
vars = {},
|
|
10
|
+
path,
|
|
11
|
+
conditionsInCode = false,
|
|
12
|
+
disableLiquid = false,
|
|
13
|
+
isLiquided = false,
|
|
14
|
+
} = options;
|
|
15
|
+
|
|
16
|
+
return disableLiquid || isLiquided ? input : liquid(input, vars, path, {conditionsInCode});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function handleError(error: unknown, path?: string): never {
|
|
20
|
+
log.error(`Error occurred${path ? ` in ${bold(path)}` : ''}`);
|
|
21
|
+
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function emitResult(html: string, env: EnvType): OutputType {
|
|
26
|
+
return {
|
|
27
|
+
result: {...env, html},
|
|
28
|
+
logs: log.get(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line consistent-return
|
|
33
|
+
function transform(originInput: string, options: OptionsType = {}) {
|
|
34
|
+
const input = applyLiquid(originInput, options);
|
|
35
|
+
const {parse, compile, env} = initMarkdownit(options);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
return emitResult(compile(parse(input)), env);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
handleError(error, options.path);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export = transform;
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace -- backward compatibility
|
|
47
|
+
namespace transform {
|
|
48
|
+
export type Options = OptionsType;
|
|
49
|
+
export type Output = OutputType;
|
|
50
|
+
}
|