is-html

Check if a string is HTML

MIT 10 个版本
安装
npm install is-html
yarn add is-html
pnpm add is-html
bun add is-html
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.

版本列表
3.2.0 2025-09-09
3.1.0 2024-03-12
3.0.0 2021-09-01
2.0.0 2019-05-28
1.1.0 2017-02-13
1.0.0 2014-08-14
0.2.2 2014-04-29
0.2.1 2014-04-16
0.1.1 2013-12-13
0.1.0 2013-12-13