@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,54 @@
|
|
|
1
|
+
import {Rule} from 'markdownlint';
|
|
2
|
+
|
|
3
|
+
export const yfm009: Rule = {
|
|
4
|
+
names: ['YFM009', 'no-term-definition-in-content'],
|
|
5
|
+
description: 'Term definition should be placed at the end of file',
|
|
6
|
+
tags: ['term'],
|
|
7
|
+
function: function YFM009(params, onError) {
|
|
8
|
+
const {config} = params;
|
|
9
|
+
if (!config) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let lastCloseIndex = -1;
|
|
14
|
+
const size = params.tokens.length;
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < size; i++) {
|
|
17
|
+
if (params.tokens[i].type === 'template_close') {
|
|
18
|
+
lastCloseIndex = i;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (params.tokens[i].type !== 'template_close') {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (i === size - 1) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (params.tokens[i + 1].type === 'template_open') {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (i < size - 2 && params.tokens[i + 2].type === 'template_open') {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onError({
|
|
38
|
+
lineNumber: params.tokens[i + 1].lineNumber,
|
|
39
|
+
detail: 'There is a content between term definition. All term defitions should be placed at the end of file.',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (lastCloseIndex === -1) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (lastCloseIndex !== size - 1) {
|
|
48
|
+
onError({
|
|
49
|
+
lineNumber: params.tokens[lastCloseIndex + 1].lineNumber,
|
|
50
|
+
detail: 'The file must end with term only.',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {Dictionary} from 'lodash';
|
|
2
|
+
import {Plugin, Rule} from 'markdownlint';
|
|
3
|
+
import {LintConfig, PluginOptions} from '.';
|
|
4
|
+
|
|
5
|
+
export interface Options {
|
|
6
|
+
input: string;
|
|
7
|
+
plugins?: Function[] | Plugin;
|
|
8
|
+
pluginOptions: PluginOptions;
|
|
9
|
+
defaultLintConfig?: LintConfig;
|
|
10
|
+
lintConfig?: LintConfig;
|
|
11
|
+
customLintRules?: Rule[];
|
|
12
|
+
sourceMap?: Dictionary<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {LogLevels} from '../log';
|
|
2
|
+
import {LintError} from 'markdownlint';
|
|
3
|
+
import {Dictionary} from 'lodash';
|
|
4
|
+
import {sep} from 'path';
|
|
5
|
+
|
|
6
|
+
export function errorToString(path: string, error: LintError, sourceMap?: Dictionary<string>) {
|
|
7
|
+
const ruleMoniker = error.ruleNames
|
|
8
|
+
? error.ruleNames.join(sep)
|
|
9
|
+
: // @ts-expect-error bad markdownlint typings
|
|
10
|
+
error.ruleName + sep + error.ruleAlias;
|
|
11
|
+
const lineNumber = sourceMap ? sourceMap[error.lineNumber] : error.lineNumber;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
`${path}${lineNumber ? `: ${lineNumber}:` : ':'} ${ruleMoniker} ${error.ruleDescription}` +
|
|
15
|
+
(error.errorDetail ? ` [${error.errorDetail}]` : '') +
|
|
16
|
+
(error.errorContext ? ` [Context: "${error.errorContext}"]` : '')
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getLogLevel(opts: {
|
|
21
|
+
ruleNames: string[];
|
|
22
|
+
logLevelsConfig: Record<string, LogLevels>;
|
|
23
|
+
defaultLevel: LogLevels;
|
|
24
|
+
}) {
|
|
25
|
+
const {ruleNames, logLevelsConfig, defaultLevel} = opts;
|
|
26
|
+
const ruleName = ruleNames.filter(
|
|
27
|
+
(ruleName) => ruleName in logLevelsConfig,
|
|
28
|
+
)[0] as keyof typeof logLevelsConfig;
|
|
29
|
+
|
|
30
|
+
return logLevelsConfig[ruleName] || defaultLevel;
|
|
31
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {LintConfig} from '.';
|
|
2
|
+
import {LogLevels} from '../log';
|
|
3
|
+
|
|
4
|
+
const index: LintConfig = {
|
|
5
|
+
// Default state for all rules
|
|
6
|
+
default: true,
|
|
7
|
+
|
|
8
|
+
'log-levels': {
|
|
9
|
+
MD001: LogLevels.DISABLED, // Heading levels should only increment by one level at a time
|
|
10
|
+
MD002: LogLevels.DISABLED, // First heading should be a top-level heading~~
|
|
11
|
+
MD003: LogLevels.DISABLED, // Heading style
|
|
12
|
+
MD004: LogLevels.DISABLED, // Unordered list style
|
|
13
|
+
MD005: LogLevels.DISABLED, // Inconsistent indentation for list items at the same level
|
|
14
|
+
MD006: LogLevels.DISABLED, // Consider starting bulleted lists at the beginning of the line~~
|
|
15
|
+
MD007: LogLevels.DISABLED, // Unordered list indentation
|
|
16
|
+
MD009: LogLevels.DISABLED, // Trailing spaces
|
|
17
|
+
MD010: LogLevels.DISABLED, // Hard tabs
|
|
18
|
+
MD011: LogLevels.DISABLED, // Reversed link syntax
|
|
19
|
+
MD012: LogLevels.DISABLED, // Multiple consecutive blank lines
|
|
20
|
+
MD013: LogLevels.DISABLED, // Line length
|
|
21
|
+
MD014: LogLevels.DISABLED, // Dollar signs used before commands without showing output
|
|
22
|
+
MD018: LogLevels.DISABLED, // No space after hash on atx style heading
|
|
23
|
+
MD019: LogLevels.DISABLED, // Multiple spaces after hash on atx style heading
|
|
24
|
+
MD020: LogLevels.DISABLED, // No space inside hashes on closed atx style heading
|
|
25
|
+
MD021: LogLevels.DISABLED, // Multiple spaces inside hashes on closed atx style heading
|
|
26
|
+
MD022: LogLevels.DISABLED, // Headings should be surrounded by blank lines
|
|
27
|
+
MD023: LogLevels.DISABLED, // Headings must start at the beginning of the line
|
|
28
|
+
MD024: LogLevels.DISABLED, // Multiple headings with the same content
|
|
29
|
+
MD025: LogLevels.DISABLED, // Multiple top-level headings in the same document
|
|
30
|
+
MD026: LogLevels.DISABLED, // Trailing punctuation in heading
|
|
31
|
+
MD027: LogLevels.DISABLED, // Multiple spaces after blockquote symbol
|
|
32
|
+
MD028: LogLevels.DISABLED, // Blank line inside blockquote
|
|
33
|
+
MD029: LogLevels.DISABLED, // Ordered list item prefix
|
|
34
|
+
MD030: LogLevels.DISABLED, // Spaces after list markers
|
|
35
|
+
MD031: LogLevels.DISABLED, // Fenced code blocks should be surrounded by blank lines
|
|
36
|
+
MD032: LogLevels.DISABLED, // Lists should be surrounded by blank lines
|
|
37
|
+
MD033: LogLevels.DISABLED, // Inline HTML
|
|
38
|
+
MD034: LogLevels.DISABLED, // Bare URL used
|
|
39
|
+
MD035: LogLevels.DISABLED, // Horizontal rule style
|
|
40
|
+
MD036: LogLevels.DISABLED, // Emphasis used instead of a heading
|
|
41
|
+
MD037: LogLevels.DISABLED, // Spaces inside emphasis markers
|
|
42
|
+
MD038: LogLevels.DISABLED, // Spaces inside code span elements
|
|
43
|
+
MD039: LogLevels.DISABLED, // Spaces inside link text
|
|
44
|
+
MD040: LogLevels.DISABLED, // Fenced code blocks should have a language specified
|
|
45
|
+
MD041: LogLevels.DISABLED, // First line in a file should be a top-level heading
|
|
46
|
+
MD042: LogLevels.DISABLED, // No empty links
|
|
47
|
+
MD043: LogLevels.DISABLED, // Required heading structure
|
|
48
|
+
MD044: LogLevels.DISABLED, // Proper names should have the correct capitalization
|
|
49
|
+
MD045: LogLevels.DISABLED, // Images should have alternate text (alt text)
|
|
50
|
+
MD046: LogLevels.DISABLED, // Code block style
|
|
51
|
+
MD047: LogLevels.DISABLED, // Files should end with a single newline character
|
|
52
|
+
MD048: LogLevels.DISABLED, // Code fence style
|
|
53
|
+
MD049: LogLevels.DISABLED, // Emphasis style should be consistent
|
|
54
|
+
MD050: LogLevels.DISABLED, // Strong style should be consistent
|
|
55
|
+
|
|
56
|
+
YFM001: LogLevels.WARN, // Inline code length
|
|
57
|
+
YFM002: LogLevels.WARN, // No header found in the file for the link text
|
|
58
|
+
YFM003: LogLevels.ERROR, // Link is unreachable
|
|
59
|
+
YFM004: LogLevels.ERROR, // Table not closed
|
|
60
|
+
YFM005: LogLevels.ERROR, // Tab list not closed
|
|
61
|
+
YFM006: LogLevels.WARN, // Term definition duplicated
|
|
62
|
+
YFM007: LogLevels.WARN, // Term used without definition
|
|
63
|
+
YFM008: LogLevels.WARN, // Term inside definition not allowed
|
|
64
|
+
YFM009: LogLevels.ERROR, // Term definition used not at the end of file
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
// Inline code length
|
|
68
|
+
YFM001: {
|
|
69
|
+
maximum: 100,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export = index;
|