remark-lint-no-repeat-punctuation
Advanced tools
Comparing version 0.1.2 to 0.1.3
15
index.js
const rule = require('unified-lint-rule'); | ||
const remove = require('unist-util-remove'); | ||
const map = require('unist-util-map'); | ||
const toList = require('unist-util-to-list-of-char'); | ||
@@ -33,5 +33,12 @@ | ||
} | ||
const withoutCode = remove(tree, 'inlineCode'); | ||
toList(withoutCode, 'paragraph', callback); | ||
toList(withoutCode, 'heading', callback); | ||
const inlineCodeReplaced = map(tree, (node) => { | ||
if (node.type !== 'inlineCode') return node; | ||
/** | ||
* Change the value of code, so that lint rule won't throw error for anything inside. | ||
* However, don't change the position info, so that warning still shows the correct position. | ||
*/ | ||
return Object.assign({}, node, { value: '\u200b' }); | ||
}); | ||
toList(inlineCodeReplaced, 'paragraph', callback); | ||
toList(inlineCodeReplaced, 'heading', callback); | ||
} | ||
@@ -38,0 +45,0 @@ |
{ | ||
"name": "remark-lint-no-repeat-punctuation", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "LaySent <laysent@gmail.com>", | ||
@@ -24,3 +24,3 @@ "bugs": { | ||
"unified-lint-rule": "^1.0.3", | ||
"unist-util-remove": "^1.0.1", | ||
"unist-util-map": "^1.0.4", | ||
"unist-util-to-list-of-char": "^0.1.2" | ||
@@ -41,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "a507c63dbeca9cc31353211b28b364842a639b6f" | ||
"gitHead": "bdd2e9ee95a135999f91655ebb9dde9a0310772f" | ||
} |
5267
42
+ Addedunist-util-map@^1.0.4
+ Addedobject-assign@4.1.1(transitive)
+ Addedunist-util-map@1.0.5(transitive)
- Removedunist-util-remove@^1.0.1
- Removedunist-util-remove@1.0.3(transitive)