remark-lint-strong-marker
Advanced tools
Comparing version 1.0.3 to 1.0.4
39
index.js
@@ -25,29 +25,29 @@ /** | ||
* | ||
* @example {"name": "valid.md"} | ||
* @example {"name": "ok.md"} | ||
* | ||
* **foo** and **bar**. | ||
* | ||
* @example {"name": "also-valid.md"} | ||
* @example {"name": "also-ok.md"} | ||
* | ||
* __foo__ and __bar__. | ||
* | ||
* @example {"name": "valid.md", "setting": "*"} | ||
* @example {"name": "ok.md", "setting": "*"} | ||
* | ||
* **foo**. | ||
* | ||
* @example {"name": "valid.md", "setting": "_"} | ||
* @example {"name": "ok.md", "setting": "_"} | ||
* | ||
* __foo__. | ||
* | ||
* @example {"name": "invalid.md", "label": "input"} | ||
* @example {"name": "not-ok.md", "label": "input"} | ||
* | ||
* **foo** and __bar__. | ||
* | ||
* @example {"name": "invalid.md", "label": "output"} | ||
* @example {"name": "not-ok.md", "label": "output"} | ||
* | ||
* 1:13-1:20: Strong should use `*` as a marker | ||
* | ||
* @example {"name": "invalid.md", "label": "output", "setting": "!", "config": {"positionless": true}} | ||
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} | ||
* | ||
* 1:1: Invalid strong marker `!`: use either `'consistent'`, `'*'`, or `'_'` | ||
* 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` | ||
*/ | ||
@@ -66,11 +66,11 @@ | ||
function strongMarker(tree, file, pref) { | ||
function strongMarker(tree, file, option) { | ||
var contents = String(file) | ||
var preferred = | ||
typeof option === 'string' && option !== 'consistent' ? option : null | ||
pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null | ||
if (markers[pref] !== true) { | ||
if (markers[preferred] !== true) { | ||
file.fail( | ||
'Invalid strong marker `' + | ||
pref + | ||
'Incorrect strong marker `' + | ||
preferred + | ||
"`: use either `'consistent'`, `'*'`, or `'_'`" | ||
@@ -86,8 +86,11 @@ ) | ||
if (!generated(node)) { | ||
if (pref) { | ||
if (marker !== pref) { | ||
file.message('Strong should use `' + pref + '` as a marker', node) | ||
if (preferred) { | ||
if (marker !== preferred) { | ||
file.message( | ||
'Strong should use `' + preferred + '` as a marker', | ||
node | ||
) | ||
} | ||
} else { | ||
pref = marker | ||
preferred = marker | ||
} | ||
@@ -94,0 +97,0 @@ } |
{ | ||
"name": "remark-lint-strong-marker", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "remark-lint rule to warn when importance (strong) markers violate the given style", | ||
@@ -10,2 +10,3 @@ "license": "MIT", | ||
"rule", | ||
"remark-lint-rule", | ||
"strong", | ||
@@ -17,2 +18,6 @@ "marker", | ||
"bugs": "https://github.com/remarkjs/remark-lint/issues", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/unified" | ||
}, | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
@@ -19,0 +24,0 @@ "contributors": [ |
@@ -42,3 +42,3 @@ <!--This file is generated--> | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -55,3 +55,3 @@ ###### In | ||
##### `also-valid.md` | ||
##### `also-ok.md` | ||
@@ -68,3 +68,3 @@ ###### In | ||
##### `invalid.md` | ||
##### `not-ok.md` | ||
@@ -83,3 +83,3 @@ ###### In | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -98,3 +98,3 @@ When configured with `'*'`. | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -113,5 +113,5 @@ When configured with `'_'`. | ||
##### `invalid.md` | ||
##### `not-ok.md` | ||
When configured with `'!'`. | ||
When configured with `'💩'`. | ||
@@ -121,3 +121,3 @@ ###### Out | ||
```text | ||
1:1: Invalid strong marker `!`: use either `'consistent'`, `'*'`, or `'_'` | ||
1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'` | ||
``` | ||
@@ -138,12 +138,12 @@ | ||
```diff | ||
... | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
... | ||
… | ||
"lint", | ||
+ "lint-strong-marker", | ||
... | ||
… | ||
] | ||
} | ||
... | ||
… | ||
``` | ||
@@ -160,4 +160,4 @@ | ||
```diff | ||
var remark = require('remark'); | ||
var report = require('vfile-reporter'); | ||
var remark = require('remark') | ||
var report = require('vfile-reporter') | ||
@@ -168,4 +168,4 @@ remark() | ||
.process('_Emphasis_ and **importance**', function (err, file) { | ||
console.error(report(err || file)); | ||
}); | ||
console.error(report(err || file)) | ||
}) | ||
``` | ||
@@ -179,4 +179,4 @@ | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -210,3 +210,3 @@ | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg | ||
@@ -213,0 +213,0 @@ [chat]: https://spectrum.chat/unified/remark |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8020
87