Originally inspired by an HTML helper in hexo by [Tommy Chen](https://github.com/tommy351). ## Usage ```js var tag = require('html-tag'); tag(name[, attribs, text]); ``` **Params** * `tag` **{String}**: Name of the tag to create. * `attribs` **{Object}**: Optional attributes * `text` **{String|Boolean}**: Optional text * `returns` **{String}**: string of HTML **Examples** ```js console.log(tag('a', {href: 'https://sellside.com'}, 'Sellside')); //=> Sellside console.log(tag('a', {id: 'anchor'})); //=> console.log(tag('strong', 'Let\'s dance!')); //=> Let's dance console.log(tag('div')); //=>
``` **Void elements (self-closing tags)** ```js console.log(tag('img', {src: 'foo.jpg'})); //=>
console.log(tag('br'));
//=> Some random text... console.log(tag('P', false)); //=>
```
**Boolean attributes**
Boolean attributes are defined by defining the attribute with a boolean value (strictly `true` or strictly `false`)
```js
console.log(tag('details', {open: true}));
//=>