tannerdolby / get-tag

Create HTML tag strings

Home Page:https://www.npmjs.com/package/get-tag

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get-tag

Create HTML tag strings on the fly.

Installation

Install the package from npm:

npm install get-tag

Usage

const getTag = require('get-tag');

console.log(getTag('title', 'Some Title'));
// <title>Some Title</title>

console.log(getTag('a', 'Some Link', {href: 'foo.com'}));
// <a href="foo.com">Some link</a>

console.log(getTag('meta', null, {name: 'author', content: 'foo'}));
// <meta name="author" content="foo">

If the provided HTML tag name is included in the void-elements list, then selfClosing will be set to true.

About

Create HTML tag strings

https://www.npmjs.com/package/get-tag

License:MIT License


Languages

Language:JavaScript 55.6%Language:TypeScript 44.4%