optional-tags

Array of "optional tags" defined by the HTML specification.

Usage no npm install needed!

<script type="module">
  import optionalTags from 'https://cdn.skypack.dev/optional-tags';
</script>

README

optional-tags

NPM Version NPM Downloads Build Status Test Coverage

Exports optional html tags with some levels, Constrainted by w3.org#optional-tags.

For some reason, we can omit element's start tag or end tag like this (comply with a standard):

<!doctype html><html lang="en"><link><base><body><ul><li>say hi<p>it's all we need</ul>

Why omit the tags? (unfinished drafts):

Example

var optionalTags = require('optional-tags')

// recommend
var safeTags = optionalTags(true) // or 'safe', or undefined
console.log( 'safe start tags: ', safeTags.starts.join(', ') )
console.log( 'safe end tags: ', safeTags.join(', ') )

// recommend, but make sure you don't use any comments or space character
var radicalTags = optionalTags('radical')
console.log( 'radical start tags: ', radicalTags.starts.join(', ') )
console.log( 'radical end tags: ', radicalTags.ends.join(', ') )

License

MIT