@putout/processor-markdown 14.0.0 → 14.0.3
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/plugins.js +0 -4
- package/package.json +1 -1
- package/lib/rules/remove-dependencies-status-badge/README.md +0 -14
- package/lib/rules/remove-dependencies-status-badge/index.js +0 -43
- package/lib/rules/split-link-with-title/README.md +0 -14
- package/lib/rules/split-link-with-title/index.js +0 -33
package/lib/plugins.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import * as removeDependenciesStatusBadge from './rules/remove-dependencies-status-badge/index.js';
|
|
2
1
|
import * as removeTrailingWhitespacesFromHeading from './rules/remove-trailing-whitespaces-from-heading/index.js';
|
|
3
|
-
import * as splitLinkWithTitle from './rules/split-link-with-title/index.js';
|
|
4
2
|
|
|
5
3
|
export const plugins = [
|
|
6
|
-
removeDependenciesStatusBadge,
|
|
7
4
|
removeTrailingWhitespacesFromHeading,
|
|
8
|
-
splitLinkWithTitle,
|
|
9
5
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/processor-markdown",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
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 JavaScript, JSX, TypeScript and JSON snippets",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Remove dependencies status badge (remove-dependencies-status-badge)
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
```diff
|
|
6
|
-
-# @putout/plugin-apply-replace-all [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
|
|
7
|
-
+# @putout/plugin-apply-replace-all [![NPM version][NPMIMGURL]][NPMURL]
|
|
8
|
-
|
|
9
|
-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-replace-all.svg?style=flat&longCache=true
|
|
10
|
-
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-replace-all "npm"
|
|
11
|
-
-
|
|
12
|
-
-[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-apply-replace-all
|
|
13
|
-
-[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-apply-replace-all
|
|
14
|
-
```
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export const name = 'remove-dependencies-status-badge';
|
|
2
|
-
|
|
3
|
-
export const report = () => 'Remove dependencies status badge';
|
|
4
|
-
|
|
5
|
-
const noop = () => {};
|
|
6
|
-
|
|
7
|
-
export const fix = (node, tree) => {
|
|
8
|
-
const children = tree.children.filter(isDependencyStatus());
|
|
9
|
-
|
|
10
|
-
tree.children = children;
|
|
11
|
-
|
|
12
|
-
const [heading] = children;
|
|
13
|
-
|
|
14
|
-
if (heading.type !== 'heading')
|
|
15
|
-
return;
|
|
16
|
-
|
|
17
|
-
const headingChildren = heading.children.filter(isDependencyLink);
|
|
18
|
-
|
|
19
|
-
tree.children[0].children = headingChildren;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const traverse = (tree, {push}) => {
|
|
23
|
-
tree.children.filter(isDependencyStatus(push));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const isDependencyStatus = (push = noop) => (child) => {
|
|
27
|
-
if (child.type !== 'definition')
|
|
28
|
-
return true;
|
|
29
|
-
|
|
30
|
-
if (child.label === 'DependencyStatusURL') {
|
|
31
|
-
push(child);
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return child.label !== 'DependencyStatusIMGURL';
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const isDependencyLink = (child) => {
|
|
39
|
-
if (child.type !== 'linkReference')
|
|
40
|
-
return true;
|
|
41
|
-
|
|
42
|
-
return child.children[0].label !== 'DependencyStatusIMGURL';
|
|
43
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Split link with title (split-link-with-title)
|
|
2
|
-
|
|
3
|
-
Add space between title and link.
|
|
4
|
-
|
|
5
|
-
```diff
|
|
6
|
-
# @putout/plugin-apply-replace-all [![NPM version][NPMIMGURL]][NPMURL]
|
|
7
|
-
|
|
8
|
-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-replace-all.svg?style=flat&longCache=true
|
|
9
|
-
-[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-replace-all"npm"
|
|
10
|
-
+[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-replace-all "npm"
|
|
11
|
-
|
|
12
|
-
-[hello](https://google.com"Google")
|
|
13
|
-
+[hello](https://google.com "Google")
|
|
14
|
-
```
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const name = 'split-link-with-title';
|
|
2
|
-
|
|
3
|
-
export const report = () => 'Split link with title';
|
|
4
|
-
|
|
5
|
-
export const fix = (node) => {
|
|
6
|
-
const [url, title] = node.url.split('"');
|
|
7
|
-
|
|
8
|
-
node.url = url;
|
|
9
|
-
node.title = title;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const traverse = (tree, {push}) => {
|
|
13
|
-
for (const node of tree.children) {
|
|
14
|
-
const {
|
|
15
|
-
type,
|
|
16
|
-
url,
|
|
17
|
-
title,
|
|
18
|
-
} = node;
|
|
19
|
-
|
|
20
|
-
if (type === 'paragraph')
|
|
21
|
-
traverse(node, {
|
|
22
|
-
push,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if (!/^(link|definition)$/.test(type))
|
|
26
|
-
continue;
|
|
27
|
-
|
|
28
|
-
if (title || !url.includes('"'))
|
|
29
|
-
continue;
|
|
30
|
-
|
|
31
|
-
push(node);
|
|
32
|
-
}
|
|
33
|
-
};
|