tag
import { tag } from "https://lilk6errxype3gpzga773pqnv4zzvc2v7locw2phzged227jyamq.arweave.net/WhavEjG-Hk2Z-TA__b4NrzOai1X63Ctp58mIPWvpwBk/mod.ts";
Render markup tag.
function tag(
tagName: string,
attributesOrFirstChild?: Record<string, string | number> | string,
...children: Array<string>,
): string;§
tag(tagName: string, attributesOrFirstChild?: Record<string, string | number> | string, ...children: Array<string>): string
[src]§Parameters
§Return Type
§
string
[src]rendered tag
Examples:
import { tag } from "https://deno.land/x/markup_tag/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"
// common usage
assertEquals(
tag("div", { id: "foo", class: "bar" }, "Hello world!"),
`<div id="foo" class="bar">Hello world!</div>`,
);
// void (no-close) tag
assertEquals(
tag("meta", { charset: "utf-8" }),
`<meta charset="utf-8">`,
);
// nested tags
assertEquals(
tag( "ul", { class: "nav" }, tag("li", "first"), tag("li", "second")),
`<ul class="nav"><li>first</li><li>second</li></ul>`,
);