Skip to content
sindresorhusPublic

About

Check if a string is HTML

Resources

Code of conduct

Contributing

Security policy

Stars

95 stars

Watchers

4 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

Repository files navigation

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.

About

Check if a string is HTML

Resources

Code of conduct

Contributing

Security policy

Stars

95 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages