https://github.com/cheton/html5-tag
A simple utility for creating HTML5 tags.
https://github.com/cheton/html5-tag
Last synced: 8 months ago
JSON representation
A simple utility for creating HTML5 tags.
- Host: GitHub
- URL: https://github.com/cheton/html5-tag
- Owner: cheton
- License: mit
- Created: 2016-06-12T10:19:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-13T10:13:09.000Z (over 8 years ago)
- Last Synced: 2024-10-29T16:26:32.478Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome_frontend_development_resources - html5-tag - A simple utility for creating HTML5 tags. (Utilities / React Components)
- awesome - html5-tag - A simple utility for creating HTML5 tags. (Utilities / React Components)
README
# html5-tag [](https://travis-ci.org/cheton/html5-tag) [](https://coveralls.io/github/cheton/html5-tag?branch=master)
[](https://www.npmjs.com/package/html5-tag)
A simple utility for creating HTML5 tags.
## Installation
```bash
npm install --save html5-tag
```
## Usage
```js
import tag from 'html5-tag';
// No end tags for void elements (https://www.w3.org/TR/html5/syntax.html#void-elements)
tag('br');
// → '
'
tag('a', { href: 'http://example.com' }, 'Example');
// → 'Example'
tag('input', { name: 'name', value: 'Input your name...', disabled: true });
// → ''
tag('div', { title: '\'"&<>' }, tag('i', { class: 'icon icon-folder' }, ''));
// → '
'
// Defaults to 'div' if tag is not specified
tag({ class: 'container' }, 'container text');
// → '
container text'
```
## License
Copyright (c) 2016 Cheton Wu
Licensed under the [MIT License](LICENSE).