ht

html5-tag

A simple utility for creating HTML5 tags.

Showing:

Popularity

Downloads/wk

1.1K

GitHub Stars

2

Maintenance

Last Commit

4yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

0.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

html5-tag build status Coverage Status

NPM

A simple utility for creating HTML5 tags.

Installation

npm install --save html5-tag

Usage

import tag from 'html5-tag';

// No end tags for void elements (https://www.w3.org/TR/html5/syntax.html#void-elements)
tag('br');
// → '<br>'

tag('a', { href: 'http://example.com' }, 'Example');
// → '<a href="http://example.com">Example</a>'

tag('input', { name: 'name', value: 'Input your name...', disabled: true });
// → '<input name="name" value="Input your name..." disabled>'

tag('div', { title: '\'"&<>' }, tag('i', { class: 'icon icon-folder' }, ''));
// → '<div title="&#39;&quot;&amp;&lt;&gt;"><i class="icon icon-folder"></i></div>'

// Defaults to 'div' if tag is not specified
tag({ class: 'container' }, 'container text');
// → '<div class="container">container text</div>'

License

Copyright (c) 2016 Cheton Wu

Licensed under the MIT License.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100