-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
71 lines (69 loc) · 1.54 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Copyright 2024 LambdAurora <email@lambdaurora.dev>
*
* This file is part of lib.html.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/**
* # lib.html
*
* An HTML AST, parser, and writer library.
*
* ## Quick Example
*
* ```ts
* import * as html from "@lambdaurora/libhtml";
*
* const div = html.parse(`<div>
* <h1>Hello World!</h1>
* <p>
* This is a lovely HTML source.
* </p>
* </div>`) as html.Element;
*
* div.get_element_by_tag_name("h1").text // Hello World!
*
* const alert = html.create_element("div")
* .with_child(html.create_element("h1")
* .with_child("Alert: this is a lovely day!")
* ).with_child(html.create_element("p")
* .with_child("Have a good day!")
* );
*
* const html_string = alert.html();
*
* const dialog = html.dialog({
* children: [
* html.h1(["Hello world!"]),
* html.p(["I hope you have a wonderful day!"]),
* html.button(["Thank you"])
* ],
* attributes: {
* open: ""
* }
* });
*
* const other_html_string = dialog.html();
* ```
*
* @module
*/
export * from "./lib/tree.ts";
export * from "./lib/text.ts";
export * from "./lib/attribute.ts";
export {
create_element,
Element,
ImageElement,
LinkElement,
type NamedTagData,
Tag,
type TagData,
} from "./lib/element.ts";
export * from "./lib/parser.ts";
export * from "./lib/stringify.ts";
export * from "./lib/sugar.ts";
export * from "./lib/utils.ts";