@putout/processor-markdown 13.1.0 → 13.1.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.
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npm i @putout/processor-markdown -D
|
|
|
26
26
|
## Rules
|
|
27
27
|
|
|
28
28
|
- [Remove dependencies status badges](https://github.com/coderaiser/putout/tree/master/packages/processor-markdown/lib/rules/remove-dependencies-status-badge/README.md)
|
|
29
|
-
- [Split
|
|
29
|
+
- [Split link with title](https://github.com/coderaiser/putout/tree/master/packages/processor-markdown/lib/rules/split-link-with-title/README.md);
|
|
30
30
|
|
|
31
31
|
## License
|
|
32
32
|
|
package/lib/plugins.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as removeDependenciesStatusBadge from './rules/remove-dependencies-status-badge/index.js';
|
|
2
2
|
import * as removeTrailingWhitespacesFromHeading from './rules/remove-trailing-whitespaces-from-heading/index.js';
|
|
3
3
|
import * as mergeHeadingSpceces from './rules/merge-heading-spaces/index.js';
|
|
4
|
-
import * as
|
|
4
|
+
import * as splitLinkWithTitle from './rules/split-link-with-title/index.js';
|
|
5
5
|
|
|
6
6
|
export const plugins = [
|
|
7
7
|
removeDependenciesStatusBadge,
|
|
8
8
|
removeTrailingWhitespacesFromHeading,
|
|
9
9
|
mergeHeadingSpceces,
|
|
10
|
-
|
|
10
|
+
splitLinkWithTitle,
|
|
11
11
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Split link with title (split-link-with-title)
|
|
2
2
|
|
|
3
3
|
Add space between title and link.
|
|
4
4
|
|
|
@@ -8,4 +8,7 @@ Add space between title and link.
|
|
|
8
8
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-replace-all.svg?style=flat&longCache=true
|
|
9
9
|
-[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-replace-all"npm"
|
|
10
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")
|
|
11
14
|
```
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/processor-markdown",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.1",
|
|
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,33 +0,0 @@
|
|
|
1
|
-
export const name = 'split-npm-link';
|
|
2
|
-
|
|
3
|
-
export const report = () => 'Split npm link';
|
|
4
|
-
|
|
5
|
-
export const fix = (node) => {
|
|
6
|
-
const {url} = node;
|
|
7
|
-
|
|
8
|
-
node.url = url.replace('"npm"', '');
|
|
9
|
-
node.title = 'npm';
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const traverse = (tree, {push}) => {
|
|
13
|
-
for (const node of tree.children) {
|
|
14
|
-
const {
|
|
15
|
-
type,
|
|
16
|
-
identifier,
|
|
17
|
-
url,
|
|
18
|
-
title,
|
|
19
|
-
} = node;
|
|
20
|
-
|
|
21
|
-
if (type !== 'definition')
|
|
22
|
-
continue;
|
|
23
|
-
|
|
24
|
-
if (identifier !== 'npmurl')
|
|
25
|
-
continue;
|
|
26
|
-
|
|
27
|
-
if (title || !url.includes('"npm"'))
|
|
28
|
-
break;
|
|
29
|
-
|
|
30
|
-
push(node);
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
};
|