remark-lint-no-html
Advanced tools
Comparing version
export default remarkLintNoHtml | ||
export type Root = import('mdast').Root | ||
declare const remarkLintNoHtml: 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 |
17
index.js
/** | ||
* ## When should I use this? | ||
* | ||
* You can use this package to check that no HTML (other than comments) is used. | ||
* | ||
* ## API | ||
* | ||
* There are no options. | ||
* | ||
* @module no-html | ||
* @summary | ||
* remark-lint rule to warn when HTML is used. | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module no-html | ||
* @fileoverview | ||
* Warn when HTML nodes are used. | ||
* | ||
* Ignores comments, because they are used by `remark`, `remark-lint`, other | ||
* Markdown tools, and because Markdown doesn’t have native comments. | ||
* | ||
* @example | ||
@@ -13,0 +18,0 @@ * {"name": "ok.md"} |
{ | ||
"name": "remark-lint-no-html", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "remark-lint rule to warn when HTML nodes are used", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
165
readme.md
@@ -13,58 +13,85 @@ <!--This file is generated--> | ||
Warn when HTML nodes are used. | ||
[`remark-lint`][mono] rule to warn when HTML is used. | ||
Ignores comments, because they are used by `remark`, `remark-lint`, other | ||
Markdown tools, and because Markdown doesn’t have native comments. | ||
## Contents | ||
## Presets | ||
* [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(remarkLintNoHtml[, config])`](#unifieduseremarklintnohtml-config) | ||
* [Examples](#examples) | ||
* [Compatibility](#compatibility) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
This rule is not included in any default preset | ||
## What is this? | ||
## Example | ||
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint` | ||
rule. | ||
Lint rules check markdown code style. | ||
##### `ok.md` | ||
## When should I use this? | ||
###### In | ||
You can use this package to check that no HTML (other than comments) is used. | ||
```markdown | ||
# Hello | ||
## Presets | ||
<!--Comments are also OK--> | ||
``` | ||
This rule is not included in a preset maintained here. | ||
###### Out | ||
## Install | ||
No messages. | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
##### `not-ok.md` | ||
```sh | ||
npm install remark-lint-no-html | ||
``` | ||
###### In | ||
In Deno with [Skypack][]: | ||
```markdown | ||
<h1>Hello</h1> | ||
```js | ||
import remarkLintNoHtml from 'https://cdn.skypack.dev/remark-lint-no-html@3?dts' | ||
``` | ||
###### Out | ||
In browsers with [Skypack][]: | ||
```text | ||
1:1-1:15: Do not use HTML in markdown | ||
```html | ||
<script type="module"> | ||
import remarkLintNoHtml from 'https://cdn.skypack.dev/remark-lint-no-html@3?min' | ||
</script> | ||
``` | ||
## Install | ||
## Use | ||
This package is [ESM only][esm]: | ||
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d. | ||
On the API: | ||
[npm][]: | ||
```js | ||
import {read} from 'to-vfile' | ||
import {reporter} from 'vfile-reporter' | ||
import {remark} from 'remark' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintNoHtml from 'remark-lint-no-html' | ||
```sh | ||
npm install remark-lint-no-html | ||
main() | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkLint) | ||
.use(remarkLintNoHtml) | ||
.process(await read('example.md')) | ||
console.error(reporter(file)) | ||
} | ||
``` | ||
This package exports no identifiers. | ||
The default export is `remarkLintNoHtml`. | ||
On the CLI: | ||
## Use | ||
```sh | ||
remark --use remark-lint --use remark-lint-no-html example.md | ||
``` | ||
You probably want to use it on the CLI through a config file: | ||
On the CLI in a config file (here a `package.json`): | ||
@@ -76,4 +103,4 @@ ```diff | ||
… | ||
"lint", | ||
+ "lint-no-html", | ||
"remark-lint", | ||
+ "remark-lint-no-html", | ||
… | ||
@@ -85,25 +112,51 @@ ] | ||
Or use it on the CLI directly | ||
## API | ||
```sh | ||
remark -u lint -u lint-no-html readme.md | ||
This package exports no identifiers. | ||
The default export is `remarkLintNoHtml`. | ||
### `unified().use(remarkLintNoHtml[, 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. | ||
## Examples | ||
##### `ok.md` | ||
###### In | ||
```markdown | ||
# Hello | ||
<!--Comments are also OK--> | ||
``` | ||
Or use this on the API: | ||
###### Out | ||
```diff | ||
import {remark} from 'remark' | ||
import {reporter} from 'vfile-reporter' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintNoHtml from 'remark-lint-no-html' | ||
No messages. | ||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintNoHtml) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
##### `not-ok.md` | ||
###### In | ||
```markdown | ||
<h1>Hello</h1> | ||
``` | ||
###### Out | ||
```text | ||
1:1-1:15: Do not use HTML in markdown | ||
``` | ||
## Compatibility | ||
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. | ||
## Contribute | ||
@@ -149,4 +202,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 | ||
@@ -156,7 +217,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 | ||
@@ -163,0 +224,0 @@ [license]: https://github.com/remarkjs/remark-lint/blob/main/license |
7737
23.89%70
7.69%222
37.89%