1.0.1 • Published 4 years ago

validate-html-tags v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Validate HTML Tags

Utility functions to escape custom tags in a string or check if any string contains valid or custom tags.

Installation

$ npm i validate-html-tags

How to use

1. Method to escape custom tags

The method will return the changed string in which all the custom HTML tags will be replaced with lt and gt

validateHTMLTags.escapeCustomTags('Send a <custom> and a valid <html> tag here to test!')

2. Method to check if string contains any valid html tag or not

This method will return a boolean stating whether the given string contains any valid html tag or not

validateHTMLTags.isValidTag('Send a <custom> and a valid <html> tag here to test!')

3. Method to check if string contains any custom html tag or not

This method will return a boolean stating whether the given string contains any custom html tag or not

validateHTMLTags.isCustomTag('Send a <custom> and a valid <html> tag here to test!')

Misc

Considered Valid HTML tags list

We are considering W3Schools valid HTML elements, ref here.

Suggestions

If you have any suggestions on what more can be added to this library, write to me at - piyush@whisperingbox.com