remark-lint-blockquote-indentation
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -7,8 +7,8 @@ export default remarkLintBlockquoteIndentation | ||
| void[] | ||
| [number | 'warn' | 'on' | 'off' | 'error' | 'consistent' | undefined] | ||
| [number | 'consistent' | 'warn' | 'on' | 'off' | 'error' | undefined] | ||
| [ | ||
( | ||
| boolean | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
), | ||
@@ -15,0 +15,0 @@ Options | undefined |
48
index.js
/** | ||
* ## When should I use this? | ||
* | ||
* You can use this package to check that the “indent” of block quotes is | ||
* consistent. | ||
* Indent here is the `>` (greater than) marker and the spaces before content. | ||
* | ||
* ## API | ||
* | ||
* The following options (default: `'consistent'`) are accepted: | ||
* | ||
* * `number` (example: `2`) | ||
* — preferred indent of `>` and spaces before content | ||
* * `'consistent'` | ||
* — detect the first used style and warn when further block quotes differ | ||
* | ||
* ## Recommendation | ||
* | ||
* CommonMark specifies that when block quotes are used the `>` markers can be | ||
* followed by an optional space. | ||
* No space at all arguably looks rather ugly: | ||
* | ||
* ```markdown | ||
* >Mars and | ||
* >Venus. | ||
* ``` | ||
* | ||
* There is no specific handling of more that one space, so if 5 spaces were | ||
* used after `>`, then indented code kicks in: | ||
* | ||
* ```markdown | ||
* > neptune() | ||
* ``` | ||
* | ||
* Due to this, it’s recommended to configure this rule with `2`. | ||
* | ||
* @module blockquote-indentation | ||
* @summary | ||
* remark-lint rule to warn when block quotes are indented too much or | ||
* too little. | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module blockquote-indentation | ||
* @fileoverview | ||
* Warn when block quotes are indented too much or too little. | ||
* | ||
* Options: `number` or `'consistent'`, default: `'consistent'`. | ||
* | ||
* `'consistent'` detects the first used indentation and will warn when | ||
* other block quotes use a different indentation. | ||
* | ||
* @example | ||
@@ -15,0 +45,0 @@ * {"name": "ok.md", "setting": 4} |
{ | ||
"name": "remark-lint-blockquote-indentation", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "remark-lint rule to warn when block quotes are either indented too much or too little", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
208
readme.md
@@ -13,9 +13,32 @@ <!--This file is generated--> | ||
Warn when block quotes are indented too much or too little. | ||
[`remark-lint`][mono] rule to warn when block quotes are indented too much or | ||
too little. | ||
Options: `number` or `'consistent'`, default: `'consistent'`. | ||
## Contents | ||
`'consistent'` detects the first used indentation and will warn when | ||
other block quotes use a different indentation. | ||
* [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(remarkLintBlockquoteIndentation[, config])`](#unifieduseremarklintblockquoteindentation-config) | ||
* [Recommendation](#recommendation) | ||
* [Examples](#examples) | ||
* [Compatibility](#compatibility) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
## What is this? | ||
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint` | ||
rule. | ||
Lint rules check markdown code style. | ||
## When should I use this? | ||
You can use this package to check that the “indent” of block quotes is | ||
consistent. | ||
Indent here is the `>` (greater than) marker and the spaces before content. | ||
## Presets | ||
@@ -30,4 +53,108 @@ | ||
## 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-blockquote-indentation | ||
``` | ||
In Deno with [Skypack][]: | ||
```js | ||
import remarkLintBlockquoteIndentation from 'https://cdn.skypack.dev/remark-lint-blockquote-indentation@3?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import remarkLintBlockquoteIndentation from 'https://cdn.skypack.dev/remark-lint-blockquote-indentation@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 remarkLintBlockquoteIndentation from 'remark-lint-blockquote-indentation' | ||
main() | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkLint) | ||
.use(remarkLintBlockquoteIndentation) | ||
.process(await read('example.md')) | ||
console.error(reporter(file)) | ||
} | ||
``` | ||
On the CLI: | ||
```sh | ||
remark --use remark-lint --use remark-lint-blockquote-indentation example.md | ||
``` | ||
On the CLI in a config file (here a `package.json`): | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"remark-lint", | ||
+ "remark-lint-blockquote-indentation", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
## API | ||
This package exports no identifiers. | ||
The default export is `remarkLintBlockquoteIndentation`. | ||
### `unified().use(remarkLintBlockquoteIndentation[, 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: | ||
* `number` (example: `2`) | ||
— preferred indent of `>` and spaces before content | ||
* `'consistent'` | ||
— detect the first used style and warn when further block quotes differ | ||
## Recommendation | ||
CommonMark specifies that when block quotes are used the `>` markers can be | ||
followed by an optional space. | ||
No space at all arguably looks rather ugly: | ||
```markdown | ||
>Mars and | ||
>Venus. | ||
``` | ||
There is no specific handling of more that one space, so if 5 spaces were | ||
used after `>`, then indented code kicks in: | ||
```markdown | ||
> neptune() | ||
``` | ||
Due to this, it’s recommended to configure this rule with `2`. | ||
## Examples | ||
##### `ok.md` | ||
@@ -92,56 +219,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-blockquote-indentation | ||
``` | ||
This package exports no identifiers. | ||
The default export is `remarkLintBlockquoteIndentation`. | ||
## Use | ||
You probably want to use it on the CLI through a config file: | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"lint", | ||
+ "lint-blockquote-indentation", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
Or use it on the CLI directly | ||
```sh | ||
remark -u lint -u lint-blockquote-indentation readme.md | ||
``` | ||
Or use this on the API: | ||
```diff | ||
import {remark} from 'remark' | ||
import {reporter} from 'vfile-reporter' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintBlockquoteIndentation from 'remark-lint-blockquote-indentation' | ||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintBlockquoteIndentation) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
``` | ||
## Contribute | ||
@@ -187,4 +267,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 | ||
@@ -194,7 +282,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 | ||
@@ -201,0 +289,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
11729
146
287