remark-lint-no-table-indentation
Advanced tools
Comparing version 4.1.0 to 4.1.1
export default remarkLintNoTableIndentation | ||
export type Root = import('mdast').Root | ||
declare const remarkLintNoTableIndentation: import('unified').Plugin< | ||
| void[] | ||
| [unknown] | ||
| void[] | ||
| [ | ||
( | ||
| boolean | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
), | ||
@@ -12,0 +12,0 @@ unknown |
34
index.js
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module no-table-indentation | ||
* @fileoverview | ||
* Warn when tables are indented. | ||
* ## When should I use this? | ||
* | ||
* ## Fix | ||
* You can use this package to check that tables are not indented. | ||
* Tables are a GFM feature enabled with | ||
* [`remark-gfm`](https://github.com/remarkjs/remark-gfm). | ||
* | ||
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
* removes all unneeded indentation before tables. | ||
* ## API | ||
* | ||
* 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. | ||
* There are no options. | ||
* | ||
* ## Recommendation | ||
* | ||
* There is no specific handling of indented tables (or anything else) in | ||
* markdown. | ||
* Hence, it’s recommended to not indent tables and to turn this rule on. | ||
* | ||
* ## Fix | ||
* | ||
* [`remark-gfm`](https://github.com/remarkjs/remark-gfm) | ||
* formats all tables without indent. | ||
* | ||
* @module no-table-indentation | ||
* @summary | ||
* remark-lint rule to warn when tables are indented. | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @example | ||
@@ -18,0 +30,0 @@ * {"name": "ok.md", "gfm": true} |
{ | ||
"name": "remark-lint-no-table-indentation", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "remark-lint rule to warn when tables are indented", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
209
readme.md
@@ -13,12 +13,32 @@ <!--This file is generated--> | ||
Warn when tables are indented. | ||
[`remark-lint`][mono] rule to warn when tables are indented. | ||
## Fix | ||
## Contents | ||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
removes all unneeded indentation before tables. | ||
* [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(remarkLintNoTableIndentation[, config])`](#unifieduseremarklintnotableindentation-config) | ||
* [Recommendation](#recommendation) | ||
* [Fix](#fix) | ||
* [Examples](#examples) | ||
* [Compatibility](#compatibility) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
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. | ||
## 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 tables are not indented. | ||
Tables are a GFM feature enabled with | ||
[`remark-gfm`](https://github.com/remarkjs/remark-gfm). | ||
## Presets | ||
@@ -32,4 +52,94 @@ | ||
## 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-no-table-indentation | ||
``` | ||
In Deno with [Skypack][]: | ||
```js | ||
import remarkLintNoTableIndentation from 'https://cdn.skypack.dev/remark-lint-no-table-indentation@4?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import remarkLintNoTableIndentation from 'https://cdn.skypack.dev/remark-lint-no-table-indentation@4?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 remarkLintNoTableIndentation from 'remark-lint-no-table-indentation' | ||
main() | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkLint) | ||
.use(remarkLintNoTableIndentation) | ||
.process(await read('example.md')) | ||
console.error(reporter(file)) | ||
} | ||
``` | ||
On the CLI: | ||
```sh | ||
remark --use remark-lint --use remark-lint-no-table-indentation example.md | ||
``` | ||
On the CLI in a config file (here a `package.json`): | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"remark-lint", | ||
+ "remark-lint-no-table-indentation", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
## API | ||
This package exports no identifiers. | ||
The default export is `remarkLintNoTableIndentation`. | ||
### `unified().use(remarkLintNoTableIndentation[, 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). | ||
There are no options. | ||
## Recommendation | ||
There is no specific handling of indented tables (or anything else) in | ||
markdown. | ||
Hence, it’s recommended to not indent tables and to turn this rule on. | ||
## Fix | ||
[`remark-gfm`](https://github.com/remarkjs/remark-gfm) | ||
formats all tables without indent. | ||
## Examples | ||
##### `ok.md` | ||
@@ -39,3 +149,3 @@ | ||
Note: this example uses [GFM][]. | ||
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]). | ||
@@ -58,5 +168,5 @@ ```markdown | ||
Note: this example uses [GFM][]. | ||
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]). | ||
Note: `·` represents a space. | ||
> 👉 **Note**: `·` represents a space. | ||
@@ -83,5 +193,5 @@ ```markdown | ||
Note: this example uses [GFM][]. | ||
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]). | ||
Note: `·` represents a space. | ||
> 👉 **Note**: `·` represents a space. | ||
@@ -103,5 +213,5 @@ ```markdown | ||
Note: this example uses [GFM][]. | ||
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]). | ||
Note: `·` represents a space. | ||
> 👉 **Note**: `·` represents a space. | ||
@@ -121,56 +231,9 @@ ```markdown | ||
## 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-no-table-indentation | ||
``` | ||
This package exports no identifiers. | ||
The default export is `remarkLintNoTableIndentation`. | ||
## Use | ||
You probably want to use it on the CLI through a config file: | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"lint", | ||
+ "lint-no-table-indentation", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
Or use it on the CLI directly | ||
```sh | ||
remark -u lint -u lint-no-table-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 remarkLintNoTableIndentation from 'remark-lint-no-table-indentation' | ||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintNoTableIndentation) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
``` | ||
## Contribute | ||
@@ -216,4 +279,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 | ||
@@ -223,7 +294,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 | ||
@@ -230,0 +301,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
11950
151
297