Registry / testing / remark-lint-no-html

remark-lint-no-html

JSON →
library4.0.1jsnpmunverified

A remark-lint rule that warns when raw HTML is used in Markdown documents. Version 4.0.1 is the current stable release, compatible with Node.js 16+. It is part of the remark-lint monorepo, which is maintained by the unified collective and releases updates alongside other lint rules. This rule helps enforce a pure Markdown writing style by disallowing inline HTML elements and comments, with an option to allow or disallow HTML comments. It is ESM-only and ships TypeScript types.

npm install remark-lint-no-html
INSTALL
IMPORT
SIG · REMARK-LINT-NO-HTM
R
remark-lint-no-html
testingjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

remarkLintNoHtml
import remarkLintNoHtml from 'remark-lint-no-html'
const remarkLintNoHtml = require('remark-lint-no-html')
This package is ESM-only since version 4 and does not provide a CommonJS export. Use import syntax.
Options
import type { Options } from 'remark-lint-no-html'
import { Options } from 'remark-lint-no-html'
Options is a TypeScript type, not a runtime value. Use import type for type-only imports.
remarkLintNoHtml (default export)
import remarkLintNoHtml from 'remark-lint-no-html'
import { remarkLintNoHtml } from 'remark-lint-no-html'
The package exports a single default function. Named import is not supported and will result in undefined.

Shows how to set up a unified pipeline with remark-lint-no-html, disallowing HTML comments, and process a Markdown string.

import { unified } from 'unified'; import remarkParse from 'remark-parse'; import remarkLint from 'remark-lint'; import remarkLintNoHtml from 'remark-lint-no-html'; import remarkStringify from 'remark-stringify'; import { reporter } from 'vfile-reporter'; const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintNoHtml, { allowComments: false }) .use(remarkStringify) .process('<h1>Hello</h1> <!-- comment -->'); console.error(reporter(file)); // 1:1-1:20: Unexpected HTML, use markdown instead // 1:21-1:34: Unexpected HTML, use markdown instead
remark --version
Debug
Known issues
breakingVersion 4 is ESM-only, dropping CommonJS support.
fix
Switch to dynamic import() or migrate to an ESM project. Older versions can use require('remark-lint-no-html')
affects: >=4.0.0
deprecatedThe option `allowComments` was renamed from `allowComment` in a previous version? (Not documented but check changelog).
fix
Use `allowComments` (boolean).
affects: >=4.0.0
gotchaThis rule is not included in any default remark-lint preset; you must add it manually.
fix
Add 'remark-lint-no-html' to your plugin list in unified or remark-cli config.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/remark-lint-no-html/index.js from /path/to/project not supported.
The package is ESM-only (v4+), but you are using require() to load it in a CommonJS module.
fix
Convert your project to ESM (set type:module in package.json) or use dynamic import() with .cjs extension.
TypeError: remarkLintNoHtml is not a function
Attempted named import: import { remarkLintNoHtml } from 'remark-lint-no-html'. The package has no named export; only default export.
fix
Use default import: import remarkLintNoHtml from 'remark-lint-no-html'
Cannot find module 'remark-lint-no-html'
Package not installed or incorrect import path (e.g., missing .js extension in ESM).
fix
Install with npm install remark-lint-no-html and ensure import path is correct.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
unifiedrequiredUnified is the core processing pipeline; remark-lint-no-html is a unified plugin.
remark-lintrequiredremark-lint-no-html is a rule for remark-lint and requires remark-lint to be set up.
remark-parseoptionalRequired to parse Markdown input when using the API.
remark-stringifyoptionalRequired to stringify Markdown output when using the API.
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-no-html — npm install remark-lint-no-html · libregistry