@diplodoc/transform 4.36.0 → 4.37.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 (44) hide show
  1. package/README.md +61 -0
  2. package/README.ru.md +61 -0
  3. package/dist/css/_yfm-only.css.map +1 -1
  4. package/dist/css/_yfm-only.min.css.map +1 -1
  5. package/dist/css/base.css.map +1 -1
  6. package/dist/css/base.min.css.map +1 -1
  7. package/dist/css/print.css.map +1 -1
  8. package/dist/css/yfm.css.map +1 -1
  9. package/dist/css/yfm.min.css.map +1 -1
  10. package/lib/md.js +4 -6
  11. package/lib/md.js.map +1 -1
  12. package/lib/plugins/includes/collect.js +8 -7
  13. package/lib/plugins/includes/collect.js.map +1 -1
  14. package/lib/plugins/includes/index.js +9 -9
  15. package/lib/plugins/includes/index.js.map +1 -1
  16. package/lib/plugins/includes/types.d.ts +1 -1
  17. package/lib/plugins/links/index.js +10 -7
  18. package/lib/plugins/links/index.js.map +1 -1
  19. package/lib/preprocessors/included/index.js +8 -3
  20. package/lib/preprocessors/included/index.js.map +1 -1
  21. package/lib/preprocessors/index.d.ts +7 -0
  22. package/lib/preprocessors/index.js +18 -0
  23. package/lib/preprocessors/index.js.map +1 -0
  24. package/lib/utilsFS.d.ts +2 -1
  25. package/lib/utilsFS.js +14 -3
  26. package/lib/utilsFS.js.map +1 -1
  27. package/lib/yfmlint/index.js +4 -5
  28. package/lib/yfmlint/index.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/transform/md.ts +3 -6
  31. package/src/transform/plugins/file/README.md +0 -54
  32. package/src/transform/plugins/includes/collect.ts +10 -8
  33. package/src/transform/plugins/includes/index.ts +12 -14
  34. package/src/transform/plugins/includes/types.ts +1 -1
  35. package/src/transform/plugins/links/index.ts +29 -14
  36. package/src/transform/preprocessors/included/index.ts +9 -3
  37. package/src/transform/preprocessors/index.ts +25 -0
  38. package/src/transform/utilsFS.ts +19 -3
  39. package/src/transform/yfmlint/index.ts +4 -11
  40. package/lib/preprocessors.d.ts +0 -3
  41. package/lib/preprocessors.js +0 -8
  42. package/lib/preprocessors.js.map +0 -1
  43. package/src/scss/_cut.scss +0 -55
  44. package/src/transform/preprocessors.ts +0 -7
@@ -6,7 +6,7 @@ import union from 'lodash/union';
6
6
  import attrs from 'markdown-it-attrs';
7
7
 
8
8
  import {LogLevels, Logger} from '../log';
9
- import defaultPreprocessors from '../preprocessors';
9
+ import {preprocess} from '../preprocessors';
10
10
 
11
11
  import baseDefaultLintConfig from './yfmlint';
12
12
  import {
@@ -29,13 +29,7 @@ const lintCache = new Set();
29
29
 
30
30
  function yfmlint(opts: Options) {
31
31
  let {input} = opts;
32
- const {
33
- plugins: customPlugins,
34
- preprocessors = defaultPreprocessors,
35
- pluginOptions,
36
- customLintRules,
37
- sourceMap,
38
- } = opts;
32
+ const {plugins: customPlugins, pluginOptions, customLintRules, sourceMap} = opts;
39
33
  const {path = 'input', log} = pluginOptions;
40
34
 
41
35
  pluginOptions.isLintRun = true;
@@ -65,9 +59,8 @@ function yfmlint(opts: Options) {
65
59
  const plugins = customPlugins && [attrs, ...customPlugins];
66
60
  const preparedPlugins = plugins && plugins.map((plugin) => [plugin, pluginOptions]);
67
61
 
68
- for (const preprocessor of preprocessors) {
69
- input = preprocessor(input, pluginOptions);
70
- }
62
+ // Run preprocessor
63
+ input = preprocess(input, pluginOptions, opts);
71
64
 
72
65
  let result;
73
66
  try {
@@ -1,3 +0,0 @@
1
- import type { MarkdownItPreprocessorCb } from './plugins/typings';
2
- declare const defaultPreprocessors: MarkdownItPreprocessorCb<{}>[];
3
- export = defaultPreprocessors;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- const included_1 = __importDefault(require("./preprocessors/included"));
6
- const defaultPreprocessors = [included_1.default];
7
- module.exports = defaultPreprocessors;
8
- //# sourceMappingURL=preprocessors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preprocessors.js","sourceRoot":"","sources":["../src/transform/preprocessors.ts"],"names":[],"mappings":";;;;AAEA,wEAAgD;AAEhD,MAAM,oBAAoB,GAAG,CAAC,kBAAQ,CAA+B,CAAC;AAEtE,iBAAS,oBAAoB,CAAC"}
@@ -1,55 +0,0 @@
1
- .yfm-cut {
2
- $class: &;
3
- margin-bottom: 15px;
4
-
5
- &-title {
6
- list-style: none;
7
- cursor: pointer;
8
- position: relative;
9
- user-select: none;
10
- padding: 5px 0 5px 30px;
11
-
12
- &::-webkit-details-marker {
13
- display: none;
14
- }
15
-
16
- &:focus {
17
- outline-color: var(--yfm-color-accent);
18
- }
19
-
20
- &:before {
21
- content: '';
22
- z-index: 1;
23
- left: 0;
24
- top: 50%;
25
- background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+CiAgICA8cGF0aCBzdHJva2U9ImN1cnJlbnRDb2xvciIgZmlsbD0ibm9uZSIgZD0iTTMgNmw1IDUgNS01Ii8+Cjwvc3ZnPgo=');
26
- transform: translateY(-50%) rotate(-90deg);
27
- transition: transform 0.3s ease;
28
- height: 20px;
29
- width: 20px;
30
- position: absolute;
31
- }
32
- }
33
-
34
- &-content {
35
- padding: 5px 0 15px 30px;
36
- }
37
-
38
- &.open {
39
- > #{$class}-title:before {
40
- transform: translateY(-50%);
41
- }
42
- }
43
-
44
- .yfm:not(.yfm_no-list-reset) & ol {
45
- counter-reset: cut-list;
46
-
47
- & > li {
48
- counter-increment: cut-list;
49
-
50
- &::before {
51
- content: counters(cut-list, '.') '. ';
52
- }
53
- }
54
- }
55
- }
@@ -1,7 +0,0 @@
1
- import type {MarkdownItPreprocessorCb} from './plugins/typings';
2
-
3
- import included from './preprocessors/included';
4
-
5
- const defaultPreprocessors = [included] as MarkdownItPreprocessorCb[];
6
-
7
- export = defaultPreprocessors;