Skip to main content
Module

x/markup_tag/mod.ts>tagNoVoid

Render markup tag easily
Latest
function tagNoVoid
import { tagNoVoid } from "https://deno.land/x/markup_tag@0.4.0/mod.ts";

Render markup tag, always add closing tag unlike tag().

Parameters

tagName: string

(required)

optional
attributesOrFirstChild: Record<string, string | number | boolean> | string

(optional)

...children: Array<string>

(optional)

Returns

string

rendered tag

Examples:

import { tag, tagNoVoid } from "https://deno.land/x/markup_tag/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"

// in tag(), skip attributes in void tags like 'link'
assertEquals(
tag("link", "http://example.com"),
`<link>`,
);

// in tagNoVoid(), always add closing tag
assertEquals(
tag("link", "http://example.com"),
`<link>http://example.com</link>`,
);