remark-lint-fenced-code-marker
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -8,5 +8,5 @@ export default remarkLintFencedCodeMarker | ||
| [ | ||
| Options | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
| Options | ||
| undefined | ||
@@ -17,4 +17,4 @@ ] | ||
| boolean | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
), | ||
@@ -21,0 +21,0 @@ Options | undefined |
45
index.js
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module fenced-code-marker | ||
* @fileoverview | ||
* Warn for violating fenced code markers. | ||
* ## When should I use this? | ||
* | ||
* Options: `` '`' ``, `'~'`, or `'consistent'`, default: `'consistent'`. | ||
* You can use this package to check that fenced code markers are consistent. | ||
* | ||
* `'consistent'` detects the first used fenced code marker style and warns | ||
* when subsequent fenced code blocks use different styles. | ||
* ## API | ||
* | ||
* ## Fix | ||
* The following options (default: `'consistent'`) are accepted: | ||
* | ||
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
* formats fences using ``'`'`` (grave accent) by default. | ||
* Pass | ||
* [`fence: '~'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfence) | ||
* to use `~` (tilde) instead. | ||
* * ``'`'`` | ||
* — prefer grave accents | ||
* * `'~'` | ||
* — prefer tildes | ||
* * `'consistent'` | ||
* — detect the first used style and warn when further fenced code differs | ||
* | ||
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) | ||
* on how to automatically fix warnings for this rule. | ||
* ## Recommendation | ||
* | ||
* Tildes are extremely uncommon. | ||
* Due to this, it’s recommended to configure this rule with ``'`'``. | ||
* | ||
* ## Fix | ||
* | ||
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) | ||
* formats fenced code with grave accents by default. | ||
* Pass | ||
* [`fence: '~'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsfence) | ||
* to always use tildes. | ||
* | ||
* @module fenced-code-marker | ||
* @summary | ||
* remark-lint rule to warn when fenced code markers are inconsistent. | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @example | ||
@@ -26,0 +37,0 @@ * {"name": "ok.md"} |
{ | ||
"name": "remark-lint-fenced-code-marker", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "remark-lint rule to warn when fenced code markers violate the given style", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
206
readme.md
@@ -13,20 +13,30 @@ <!--This file is generated--> | ||
Warn for violating fenced code markers. | ||
[`remark-lint`][mono] rule to warn when fenced code markers are inconsistent. | ||
Options: ``'`'``, `'~'`, or `'consistent'`, default: `'consistent'`. | ||
## Contents | ||
`'consistent'` detects the first used fenced code marker style and warns | ||
when subsequent fenced code blocks use different styles. | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Presets](#presets) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`unified().use(remarkLintFencedCodeMarker[, config])`](#unifieduseremarklintfencedcodemarker-config) | ||
* [Recommendation](#recommendation) | ||
* [Fix](#fix) | ||
* [Examples](#examples) | ||
* [Compatibility](#compatibility) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
## Fix | ||
## What is this? | ||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
formats fences using ``'`'`` (grave accent) by default. | ||
Pass | ||
[`fence: '~'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsfence) | ||
to use `~` (tilde) instead. | ||
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint` | ||
rule. | ||
Lint rules check markdown code style. | ||
See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) | ||
on how to automatically fix warnings for this rule. | ||
## When should I use this? | ||
You can use this package to check that fenced code markers are consistent. | ||
## Presets | ||
@@ -41,4 +51,103 @@ | ||
## Example | ||
## Install | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
```sh | ||
npm install remark-lint-fenced-code-marker | ||
``` | ||
In Deno with [Skypack][]: | ||
```js | ||
import remarkLintFencedCodeMarker from 'https://cdn.skypack.dev/remark-lint-fenced-code-marker@3?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import remarkLintFencedCodeMarker from 'https://cdn.skypack.dev/remark-lint-fenced-code-marker@3?min' | ||
</script> | ||
``` | ||
## Use | ||
On the API: | ||
```js | ||
import {read} from 'to-vfile' | ||
import {reporter} from 'vfile-reporter' | ||
import {remark} from 'remark' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintFencedCodeMarker from 'remark-lint-fenced-code-marker' | ||
main() | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkLint) | ||
.use(remarkLintFencedCodeMarker) | ||
.process(await read('example.md')) | ||
console.error(reporter(file)) | ||
} | ||
``` | ||
On the CLI: | ||
```sh | ||
remark --use remark-lint --use remark-lint-fenced-code-marker example.md | ||
``` | ||
On the CLI in a config file (here a `package.json`): | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"remark-lint", | ||
+ "remark-lint-fenced-code-marker", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
## API | ||
This package exports no identifiers. | ||
The default export is `remarkLintFencedCodeMarker`. | ||
### `unified().use(remarkLintFencedCodeMarker[, config])` | ||
This rule supports standard configuration that all remark lint rules accept | ||
(such as `false` to turn it off or `[1, options]` to configure it). | ||
The following options (default: `'consistent'`) are accepted: | ||
* ``'`'`` | ||
— prefer grave accents | ||
* `'~'` | ||
— prefer tildes | ||
* `'consistent'` | ||
— detect the first used style and warn when further fenced code differs | ||
## Recommendation | ||
Tildes are extremely uncommon. | ||
Due to this, it’s recommended to configure this rule with ``'`'``. | ||
## Fix | ||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) | ||
formats fenced code with grave accents by default. | ||
Pass | ||
[`fence: '~'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsfence) | ||
to always use tildes. | ||
## Examples | ||
##### `ok.md` | ||
@@ -148,56 +257,9 @@ | ||
## Install | ||
## Compatibility | ||
This package is [ESM only][esm]: | ||
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d. | ||
Projects maintained by the unified collective are compatible with all maintained | ||
versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
Our projects sometimes work with older versions, but this is not guaranteed. | ||
[npm][]: | ||
```sh | ||
npm install remark-lint-fenced-code-marker | ||
``` | ||
This package exports no identifiers. | ||
The default export is `remarkLintFencedCodeMarker`. | ||
## Use | ||
You probably want to use it on the CLI through a config file: | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"lint", | ||
+ "lint-fenced-code-marker", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
Or use it on the CLI directly | ||
```sh | ||
remark -u lint -u lint-fenced-code-marker readme.md | ||
``` | ||
Or use this on the API: | ||
```diff | ||
import {remark} from 'remark' | ||
import {reporter} from 'vfile-reporter' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintFencedCodeMarker from 'remark-lint-fenced-code-marker' | ||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintFencedCodeMarker) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
``` | ||
## Contribute | ||
@@ -243,4 +305,12 @@ | ||
[unified]: https://github.com/unifiedjs/unified | ||
[remark]: https://github.com/remarkjs/remark | ||
[mono]: https://github.com/remarkjs/remark-lint | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[skypack]: https://www.skypack.dev | ||
[npm]: https://docs.npmjs.com/cli/install | ||
@@ -250,7 +320,7 @@ | ||
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md | ||
[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md | ||
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md | ||
[support]: https://github.com/remarkjs/.github/blob/main/support.md | ||
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md | ||
[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md | ||
@@ -257,0 +327,0 @@ [license]: https://github.com/remarkjs/remark-lint/blob/main/license |
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
12439
172
325