@putout/processor-markdown 7.0.0 → 7.1.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/lib/markdown.js CHANGED
@@ -1,8 +1,21 @@
1
- import jsonProcessor from '@putout/processor-json';
1
+ import {
2
+ toJS,
3
+ fromJS,
4
+ } from '@putout/processor-json';
2
5
  import stringify from 'remark-stringify';
3
6
  import preset from 'remark-preset-lint-consistent';
4
7
 
5
- import {run} from './rules/index.mjs';
8
+ import removeDependenciesStatusBadge from './rules/remove-dependencies-status-badge.js';
9
+ import removeTrailingWhitespacesFromHeading from './rules/remove-trailing-whitespaces-from-heading.js';
10
+ import mergeHeadingSpceces from './rules/merge-heading-spaces.js';
11
+
12
+ const plugins = [
13
+ removeDependenciesStatusBadge,
14
+ removeTrailingWhitespacesFromHeading,
15
+ mergeHeadingSpceces,
16
+ ];
17
+
18
+ import {run} from './rules/index.js';
6
19
  import {visit} from 'unist-util-visit';
7
20
  import {unified} from 'unified';
8
21
 
@@ -32,7 +45,7 @@ export const find = async (rawSource) => {
32
45
  const {messages} = await unified()
33
46
  .use(parseStore)
34
47
  .use(preset)
35
- .use(run, {fix: false})
48
+ .use(run, {plugins, fix: false})
36
49
  .use(stringify, stringifyOptions)
37
50
  .process(rawSource);
38
51
 
@@ -46,7 +59,7 @@ export const fix = async (rawSource) => {
46
59
  const {value} = await unified()
47
60
  .use(parseStore)
48
61
  .use(preset)
49
- .use(run, {fix: true})
62
+ .use(run, {plugins, fix: true})
50
63
  .use(stringify, stringifyOptions)
51
64
  .process(rawSource);
52
65
 
@@ -112,7 +125,7 @@ const collect = ({list, visit}) => (node) => {
112
125
  }
113
126
 
114
127
  if (lang === 'json') {
115
- const source = jsonProcessor.toJS(value);
128
+ const source = toJS(value);
116
129
 
117
130
  list.push({
118
131
  startLine,
@@ -140,7 +153,7 @@ const apply = ({list, visit}) => (node) => {
140
153
  if (lang === 'json') {
141
154
  const code = list.shift();
142
155
 
143
- node.value = jsonProcessor.fromJS(code);
156
+ node.value = fromJS(code);
144
157
  }
145
158
  });
146
159
  };
@@ -1,16 +1,7 @@
1
1
  import {lintRule} from 'unified-lint-rule';
2
- import removeDependenciesStatusBadge from './remove-dependencies-status-badge.mjs';
3
- import removeTrailingWhitespacesFromHeading from './remove-trailing-whitespaces-from-heading.mjs';
4
- import mergeHeadingSpceces from './merge-heading-spaces.mjs';
5
-
6
- const plugins = [
7
- removeDependenciesStatusBadge,
8
- removeTrailingWhitespacesFromHeading,
9
- mergeHeadingSpceces,
10
- ];
11
2
 
12
3
  export const run = lintRule('remark-lint:run', (tree, file, options) => {
13
- for (const {fix, traverse, report, name} of plugins) {
4
+ for (const {fix, traverse, report, name} of options.plugins) {
14
5
  const nodes = [];
15
6
  const push = nodes.push.bind(nodes);
16
7
 
@@ -30,7 +21,3 @@ export const run = lintRule('remark-lint:run', (tree, file, options) => {
30
21
  }
31
22
  });
32
23
 
33
- export const rules = {
34
- plugins,
35
- };
36
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/processor-markdown",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout processor adds ability to parse markdown files and lint js snippets",
@@ -24,7 +24,7 @@
24
24
  "report": "madrun report"
25
25
  },
26
26
  "dependencies": {
27
- "@putout/processor-json": "^3.0.0",
27
+ "@putout/processor-json": "^5.0.0",
28
28
  "once": "^1.4.0",
29
29
  "remark-parse": "^10.0.0",
30
30
  "remark-preset-lint-consistent": "^5.0.0",
@@ -51,7 +51,7 @@
51
51
  "supertape": "^7.0.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "putout": ">=25"
54
+ "putout": ">=26"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=16"