sindresorhus/is-html

Check if a string is HTML

JavaScript

95

34 commits

updated Sep 18, 2026

See the code

README

is-html

Check if a string is HTML

You should not use this for any kind of validation, sanitation, or XSS checks.

Install

npm install is-html

Usage

import isHtml from 'is-html';

isHtml('<p>I am HTML</p>');
//=> true

isHtml('<!doctype><html><body><h1>I ❤ unicorns</h1></body></html>');
//=> true

isHtml('<cake>I am XML</cake>');
//=> false

isHtml('>+++++++>++++++++++>+++>+<<<<-');
//=> false

Note: It does not detect deprecated HTML tags.

sindresorhus/is-html

Check if a string is HTML

JavaScript

95

34 commits

updated Sep 18, 2026

See the code

README

is-html

Check if a string is HTML

You should not use this for any kind of validation, sanitation, or XSS checks.

Install

npm install is-html

Usage

import isHtml from 'is-html';

isHtml('<p>I am HTML</p>');
//=> true

isHtml('<!doctype><html><body><h1>I ❤ unicorns</h1></body></html>');
//=> true

isHtml('<cake>I am XML</cake>');
//=> false

isHtml('>+++++++>++++++++++>+++>+<<<<-');
//=> false

Note: It does not detect deprecated HTML tags.

Project health

Overall

3.5/10

Maintained

0/10

Code review

1/10
OpenSSF Scorecard

Latest release

3.2.0 · Sep 9, 2025

Releases this year

0

Significant stargazers

Yann Bertrand

218 followers · starred Mar 2024