node-lib

@wtasnorg/node-lib


@wtasnorg/node-lib / Anchor

Class: Anchor

Defined in: src/anchor.ts:32

A simple builder for an HTML <a> element.

Both href and text are HTML-escaped in toString() output.

Example

const link = new Anchor("https://example.com", "Example");
link.toString(); // '<a href="https://example.com">Example</a>'

Constructors

Constructor

new Anchor(href?, text?): Anchor

Defined in: src/anchor.ts:36

Parameters

href?

string = "#"

text?

string = "#"

Returns

Anchor

Properties

href

href: string

Defined in: src/anchor.ts:33


text

text: string

Defined in: src/anchor.ts:34

Methods

toString()

toString(): string

Defined in: src/anchor.ts:41

Returns

string