Simple example with only 1 attach
const parent = doc();
attach(parent);
div();
p();
The div
and p
tags will be automatically added as child of parentDiv
Example attaching and detaching
const parent = doc();
attach(parent);
div();
p();
let d1 = div();
attach(d1);
// All the p tags will be added to `d1`
p();
p();
p();
// remember to call detach when you want to go back to the previous root tag
detach();
Generated using TypeDoc
Attach a given tag to the current context. When you attach a tag, this tag will be the "root" for any tag created without a parent.
@detach
and return to the previous root tag.This is used to remove clutter and reduntancies when creating hobo docs. Like this: