Documentation
¶
Overview ¶
Package nodx is a modern and developer-friendly Go template engine for generating safe, clean, and maintainable HTML. Designed for maximum productivity and easy maintenance, it combines simplicity, type safety and robust formatting, making it the perfect fit for your Go-based web projects.
In NodX, everything is a node and anything that implements the Node interface can be rendered as HTML or used as a Node child.
Index ¶
- func EscapeHTML(input string) string
- type ClassMap
- type Node
- func A(children ...Node) Node
- func Abbr(children ...Node) Node
- func Accept(value string) Node
- func AcceptCharset(value string) Node
- func Accesskey(value string) Node
- func Action(value string) Node
- func Address(children ...Node) Node
- func Align(value string) Node
- func Allow(value string) Node
- func Alt(value string) Node
- func Applet(children ...Node) Node
- func Area(children ...Node) Node
- func Aria(key string, value string) Node
- func Article(children ...Node) Node
- func Aside(children ...Node) Node
- func Async(value string) Node
- func Attr(name string, value ...string) Node
- func Audio(children ...Node) Node
- func Autocapitalize(value string) Node
- func Autocomplete(value string) Node
- func Autofocus(value string) Node
- func Autoplay(value string) Node
- func B(children ...Node) Node
- func Background(value string) Node
- func Base(children ...Node) Node
- func Basefont(children ...Node) Node
- func Bdi(children ...Node) Node
- func Bdo(children ...Node) Node
- func Bgcolor(value string) Node
- func Blockquote(children ...Node) Node
- func Body(children ...Node) Node
- func Border(value string) Node
- func Br(children ...Node) Node
- func Buffered(value string) Node
- func Button(children ...Node) Node
- func Canvas(children ...Node) Node
- func Caption(children ...Node) Node
- func Capture(value string) Node
- func Center(children ...Node) Node
- func Challenge(value string) Node
- func Charset(value string) Node
- func Checked(value string) Node
- func CiteAttr(value string) Node
- func CiteEl(children ...Node) Node
- func Class(value string) Node
- func CodeAttr(value string) Node
- func CodeEl(children ...Node) Node
- func Codebase(value string) Node
- func Col(children ...Node) Node
- func Colgroup(children ...Node) Node
- func Color(value string) Node
- func Cols(value string) Node
- func Colspan(value string) Node
- func Content(value string) Node
- func Contenteditable(value string) Node
- func Contextmenu(value string) Node
- func Controls(value string) Node
- func Coords(value string) Node
- func Crossorigin(value string) Node
- func Csp(value string) Node
- func Data(key string, value string) Node
- func DataAttr(value string) Node
- func DataEl(children ...Node) Node
- func Datalist(children ...Node) Node
- func Datetime(value string) Node
- func Dd(children ...Node) Node
- func Decoding(value string) Node
- func Default(value string) Node
- func Defer(value string) Node
- func Del(children ...Node) Node
- func Details(children ...Node) Node
- func Dfn(children ...Node) Node
- func Dialog(children ...Node) Node
- func DirAttr(value string) Node
- func DirEl(children ...Node) Node
- func Dirname(value string) Node
- func Disabled(value string) Node
- func Div(children ...Node) Node
- func Dl(children ...Node) Node
- func DocType() Node
- func Download(value string) Node
- func Draggable(value string) Node
- func Dt(children ...Node) Node
- func El(name string, children ...Node) Node
- func ElVoid(name string, children ...Node) Node
- func Em(children ...Node) Node
- func Embed(children ...Node) Node
- func Enctype(value string) Node
- func Enterkeyhint(value string) Node
- func Eval(fn func() Node) Node
- func Fieldset(children ...Node) Node
- func Figcaption(children ...Node) Node
- func Figure(children ...Node) Node
- func Font(children ...Node) Node
- func Footer(children ...Node) Node
- func For(value string) Node
- func FormAttr(value string) Node
- func FormEl(children ...Node) Node
- func Formaction(value string) Node
- func Formenctype(value string) Node
- func Formmethod(value string) Node
- func Formnovalidate(value string) Node
- func Formtarget(value string) Node
- func Frame(children ...Node) Node
- func Frameset(children ...Node) Node
- func Group(nodes ...Node) Node
- func H1(children ...Node) Node
- func H2(children ...Node) Node
- func H3(children ...Node) Node
- func H4(children ...Node) Node
- func H5(children ...Node) Node
- func H6(children ...Node) Node
- func Head(children ...Node) Node
- func Header(children ...Node) Node
- func Headers(value string) Node
- func Height(value string) Node
- func Hidden(value string) Node
- func High(value string) Node
- func Hr(children ...Node) Node
- func Href(value string) Node
- func Hreflang(value string) Node
- func Html(children ...Node) Node
- func HttpEquiv(value string) Node
- func I(children ...Node) Node
- func Icon(value string) Node
- func Id(value string) Node
- func If(condition bool, node Node) Node
- func IfFunc(condition bool, function func() Node) Node
- func Iframe(children ...Node) Node
- func Img(children ...Node) Node
- func Importance(value string) Node
- func Input(children ...Node) Node
- func Ins(children ...Node) Node
- func Integrity(value string) Node
- func Ismap(value string) Node
- func Itemprop(value string) Node
- func Kbd(children ...Node) Node
- func Keytype(value string) Node
- func Kind(value string) Node
- func LabelAttr(value string) Node
- func LabelEl(children ...Node) Node
- func Lang(value string) Node
- func Language(value string) Node
- func Legend(children ...Node) Node
- func Li(children ...Node) Node
- func Link(children ...Node) Node
- func List(value string) Node
- func Loading(value string) Node
- func Loop(value string) Node
- func Low(value string) Node
- func Main(children ...Node) Node
- func Manifest(value string) Node
- func Map[T any](slice []T, function func(T) Node) Node
- func MapEl(children ...Node) Node
- func Mark(children ...Node) Node
- func Max(value string) Node
- func Maxlength(value string) Node
- func Media(value string) Node
- func Meta(children ...Node) Node
- func Meter(children ...Node) Node
- func Method(value string) Node
- func Min(value string) Node
- func Minlength(value string) Node
- func Multiple(value string) Node
- func Muted(value string) Node
- func Name(value string) Node
- func Nav(children ...Node) Node
- func Noframes(children ...Node) Node
- func Nomodule(value string) Node
- func Nonce(value string) Node
- func Noscript(children ...Node) Node
- func Novalidate(value string) Node
- func Object(children ...Node) Node
- func Ol(children ...Node) Node
- func Open(value string) Node
- func Optgroup(children ...Node) Node
- func Optimum(value string) Node
- func Option(children ...Node) Node
- func Output(children ...Node) Node
- func P(children ...Node) Node
- func Param(children ...Node) Node
- func Pattern(value string) Node
- func Picture(children ...Node) Node
- func Ping(value string) Node
- func Placeholder(value string) Node
- func Playsinline(value string) Node
- func Poster(value string) Node
- func Pre(children ...Node) Node
- func Preload(value string) Node
- func Progress(children ...Node) Node
- func Q(children ...Node) Node
- func Raw(value string) Node
- func Rawf(format string, a ...any) Node
- func Rb(children ...Node) Node
- func Readonly(value string) Node
- func Referrerpolicy(value string) Node
- func Rel(value string) Node
- func Required(value string) Node
- func Reversed(value string) Node
- func Role(value string) Node
- func Rows(value string) Node
- func Rowspan(value string) Node
- func Rp(children ...Node) Node
- func Rt(children ...Node) Node
- func Rtc(children ...Node) Node
- func Ruby(children ...Node) Node
- func S(children ...Node) Node
- func Samp(children ...Node) Node
- func Sandbox(value string) Node
- func Scope(value string) Node
- func Scoped(value string) Node
- func Script(children ...Node) Node
- func Section(children ...Node) Node
- func Select(children ...Node) Node
- func Selected(value string) Node
- func Shape(value string) Node
- func Size(value string) Node
- func Sizes(value string) Node
- func SlotAttr(value string) Node
- func SlotEl(children ...Node) Node
- func Small(children ...Node) Node
- func Source(children ...Node) Node
- func SpanAttr(value string) Node
- func SpanEl(children ...Node) Node
- func Spellcheck(value string) Node
- func Src(value string) Node
- func Srcdoc(value string) Node
- func Srclang(value string) Node
- func Srcset(value string) Node
- func Start(value string) Node
- func Step(value string) Node
- func Strike(children ...Node) Node
- func Strong(children ...Node) Node
- func StyleAttr(value string) Node
- func StyleEl(children ...Node) Node
- func Sub(children ...Node) Node
- func SummaryAttr(value string) Node
- func SummaryEl(children ...Node) Node
- func Sup(children ...Node) Node
- func Svg(children ...Node) Node
- func Tabindex(value string) Node
- func Table(children ...Node) Node
- func Target(value string) Node
- func Tbody(children ...Node) Node
- func Td(children ...Node) Node
- func Template(children ...Node) Node
- func Text(value string) Node
- func Textarea(children ...Node) Node
- func Textf(format string, a ...any) Node
- func Tfoot(children ...Node) Node
- func Th(children ...Node) Node
- func Thead(children ...Node) Node
- func Time(children ...Node) Node
- func TitleAttr(value string) Node
- func TitleEl(children ...Node) Node
- func Tr(children ...Node) Node
- func Track(children ...Node) Node
- func Translate(value string) Node
- func Tt(children ...Node) Node
- func Type(value string) Node
- func U(children ...Node) Node
- func Ul(children ...Node) Node
- func Usemap(value string) Node
- func Value(value string) Node
- func Var(children ...Node) Node
- func Video(children ...Node) Node
- func Wbr(children ...Node) Node
- func Width(value string) Node
- func Wrap(value string) Node
- type StyleMap
Examples ¶
- A
- Abbr
- Accept
- AcceptCharset
- Accesskey
- Action
- Address
- Align
- Allow
- Alt
- Applet
- Area
- Aria
- Article
- Aside
- Async
- Attr
- Audio
- Autocapitalize
- Autocomplete
- Autofocus
- Autoplay
- B
- Background
- Base
- Basefont
- Bdi
- Bdo
- Bgcolor
- Blockquote
- Body
- Border
- Br
- Buffered
- Button
- Canvas
- Caption
- Capture
- Center
- Challenge
- Charset
- Checked
- CiteAttr
- CiteEl
- Class
- ClassMap
- CodeAttr
- CodeEl
- Codebase
- Col
- Colgroup
- Color
- Cols
- Colspan
- Content
- Contenteditable
- Contextmenu
- Controls
- Coords
- Crossorigin
- Csp
- Data
- DataAttr
- DataEl
- Datalist
- Datetime
- Dd
- Decoding
- Default
- Defer
- Del
- Details
- Dfn
- Dialog
- DirAttr
- DirEl
- Dirname
- Disabled
- Div
- Dl
- Download
- Draggable
- Dt
- El
- ElVoid
- Em
- Embed
- Enctype
- Enterkeyhint
- Eval
- Fieldset
- Figcaption
- Figure
- Font
- Footer
- For
- FormAttr
- FormEl
- Formaction
- Formenctype
- Formmethod
- Formnovalidate
- Formtarget
- Frame
- Frameset
- Group
- H1
- H2
- H3
- H4
- H5
- H6
- Head
- Header
- Headers
- Height
- Hidden
- High
- Hr
- Href
- Hreflang
- Html
- HttpEquiv
- I
- Icon
- Id
- If
- IfFunc
- Iframe
- Img
- Importance
- Input
- Ins
- Integrity
- Ismap
- Itemprop
- Kbd
- Keytype
- Kind
- LabelAttr
- LabelEl
- Lang
- Language
- Legend
- Li
- Link
- List
- Loading
- Loop
- Low
- Main
- Manifest
- Map
- MapEl
- Mark
- Max
- Maxlength
- Media
- Meta
- Meter
- Method
- Min
- Minlength
- Multiple
- Muted
- Name
- Nav
- Noframes
- Nomodule
- Nonce
- Noscript
- Novalidate
- Object
- Ol
- Open
- Optgroup
- Optimum
- Option
- Output
- P
- Param
- Pattern
- Picture
- Ping
- Placeholder
- Playsinline
- Poster
- Pre
- Preload
- Progress
- Q
- Raw
- Rawf
- Rb
- Readonly
- Referrerpolicy
- Rel
- Required
- Reversed
- Role
- Rows
- Rowspan
- Rp
- Rt
- Rtc
- Ruby
- S
- Samp
- Sandbox
- Scope
- Scoped
- Script
- Section
- Select
- Selected
- Shape
- Size
- Sizes
- SlotAttr
- SlotEl
- Small
- Source
- SpanAttr
- SpanEl
- Spellcheck
- Src
- Srcdoc
- Srclang
- Srcset
- Start
- Step
- Strike
- Strong
- StyleAttr
- StyleEl
- StyleMap
- Sub
- SummaryAttr
- SummaryEl
- Sup
- Svg
- Tabindex
- Table
- Target
- Tbody
- Td
- Template
- Text
- Textarea
- Textf
- Tfoot
- Th
- Thead
- Time
- TitleAttr
- TitleEl
- Tr
- Track
- Translate
- Tt
- Type
- U
- Ul
- Usemap
- Value
- Var
- Video
- Wbr
- Width
- Wrap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapeHTML ¶
EscapeHTML escapes the input string to prevent XSS attacks.
Types ¶
type ClassMap ¶
ClassMap represents a map of class names with conditional rendering. The keys are the class names, and the values are boolean expressions (conditions) that determine whether each class should be included in the final output.
Example:
isOdd := func(n int) bool { return n % 2 != 0 }
isEven := func(n int) bool { return n % 2 == 0 }
renderOdd := isOdd(3) // true
renderEven := isEven(3) // false
cm := ClassMap{
"odd-class": renderOdd, // Included
"even-class": renderEven, // Excluded
"always-on": true, // Always included
}
This will render the class attribute as: class="odd-class always-on"
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
shouldHide := 3 > 2
node := nodx.Div(
nodx.ClassMap{
"container": true,
"other": false,
"hidden": shouldHide,
},
nodx.Text("Hello, World!"),
)
fmt.Println(node)
}
Output: <div class="container hidden">Hello, World!</div>
func (ClassMap) IsAttribute ¶ added in v0.2.0
func (ClassMap) RenderBytes ¶
func (ClassMap) RenderString ¶
type Node ¶
type Node interface {
// Render writes the node HTML to the writer.
Render(w io.Writer) error
// RenderString returns the node HTML as a string.
RenderString() (string, error)
// RenderBytes returns the node HTML as a byte slice.
RenderBytes() ([]byte, error)
// IsElement indicates if the node should be rendered as an element.
IsElement() bool
// IsAttribute indicates if the node should be rendered as an attribute.
IsAttribute() bool
// String returns the node HTML as a string and implements the fmt.Stringer interface.
//
// This is only for convenience and debugging purposes and it ignores the
// error return value.
//
// You should use RenderString() whenever possible.
String() string
}
Node is the interface that wraps the basic Render methods used in the different NodX node types.
Anything that implements this interface can be used as a node.
func A ¶
A defines a hyperlink.
func ExampleA() {
node := nodx.A(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <a id="1">Hello World!</a>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.A(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <a id="1">Hello World!</a>
func Abbr ¶
Abbr defines an abbreviation or acronym.
func ExampleAbbr() {
node := nodx.Abbr(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <abbr id="1">Hello World!</abbr>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Abbr(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <abbr id="1">Hello World!</abbr>
func Accept ¶
Accept specifies the types of files that the server accepts (only for input type='file').
func ExampleAccept() {
node := nodx.Accept("value")
fmt.Println(node)
// Output: accept="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Accept("value")
fmt.Println(node)
}
Output: accept="value"
func AcceptCharset ¶
AcceptCharset specifies the character encodings to be used for form submission.
func ExampleAcceptCharset() {
node := nodx.AcceptCharset("value")
fmt.Println(node)
// Output: accept-charset="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.AcceptCharset("value")
fmt.Println(node)
}
Output: accept-charset="value"
func Accesskey ¶
Accesskey specifies a shortcut key to activate/focus an element.
func ExampleAccesskey() {
node := nodx.Accesskey("value")
fmt.Println(node)
// Output: accesskey="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Accesskey("value")
fmt.Println(node)
}
Output: accesskey="value"
func Action ¶
Action specifies where to send the form-data when a form is submitted.
func ExampleAction() {
node := nodx.Action("value")
fmt.Println(node)
// Output: action="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Action("value")
fmt.Println(node)
}
Output: action="value"
func Address ¶
Address defines contact information for the author/owner of a document.
func ExampleAddress() {
node := nodx.Address(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <address id="1">Hello World!</address>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Address(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <address id="1">Hello World!</address>
func Align ¶
Align specifies the alignment of the element's content.
func ExampleAlign() {
node := nodx.Align("value")
fmt.Println(node)
// Output: align="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Align("value")
fmt.Println(node)
}
Output: align="value"
func Allow ¶
Allow specifies a feature policy for the iframe.
func ExampleAllow() {
node := nodx.Allow("value")
fmt.Println(node)
// Output: allow="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Allow("value")
fmt.Println(node)
}
Output: allow="value"
func Alt ¶
Alt provides alternative text for an image if it cannot be displayed.
func ExampleAlt() {
node := nodx.Alt("value")
fmt.Println(node)
// Output: alt="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Alt("value")
fmt.Println(node)
}
Output: alt="value"
func Applet ¶
Applet defines an embedded applet (deprecated).
func ExampleApplet() {
node := nodx.Applet(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <applet id="1">Hello World!</applet>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Applet(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <applet id="1">Hello World!</applet>
func Area ¶
Area defines an area inside an image-map.
func ExampleArea() {
node := nodx.Area(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <area id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Area(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <area id="1">
func Aria ¶
Aria defines accessibility semantics or aria properties.
func ExampleAria() {
node := nodx.Aria("key", "value")
fmt.Println(node)
// Output: aria-key="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Aria("key", "value")
fmt.Println(node)
}
Output: aria-key="value"
func Article ¶
Article defines an article.
func ExampleArticle() {
node := nodx.Article(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <article id="1">Hello World!</article>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Article(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <article id="1">Hello World!</article>
func Aside ¶
Aside defines content aside from the page content.
func ExampleAside() {
node := nodx.Aside(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <aside id="1">Hello World!</aside>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Aside(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <aside id="1">Hello World!</aside>
func Async ¶
Async indicates that the script should be executed asynchronously.
func ExampleAsync() {
node := nodx.Async("value")
fmt.Println(node)
// Output: async="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Async("value")
fmt.Println(node)
}
Output: async="value"
func Attr ¶
Attr creates a new Node representing an HTML attribute with a name and value. The value is HTML-escaped to prevent XSS attacks.
If you don't provide a value, the attribute will be rendered without it.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Attr("my-custom-attr", "foo"),
)
fmt.Println(node)
}
Output: <div my-custom-attr="foo"></div>
func Audio ¶
Audio defines embedded sound content.
func ExampleAudio() {
node := nodx.Audio(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <audio id="1">Hello World!</audio>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Audio(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <audio id="1">Hello World!</audio>
func Autocapitalize ¶
Autocapitalize controls how text input is automatically capitalized.
func ExampleAutocapitalize() {
node := nodx.Autocapitalize("value")
fmt.Println(node)
// Output: autocapitalize="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Autocapitalize("value")
fmt.Println(node)
}
Output: autocapitalize="value"
func Autocomplete ¶
Autocomplete specifies whether an input field should have autocomplete enabled.
func ExampleAutocomplete() {
node := nodx.Autocomplete("value")
fmt.Println(node)
// Output: autocomplete="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Autocomplete("value")
fmt.Println(node)
}
Output: autocomplete="value"
func Autofocus ¶
Autofocus specifies that an input field should automatically get focus when the page loads.
func ExampleAutofocus() {
node := nodx.Autofocus("value")
fmt.Println(node)
// Output: autofocus="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Autofocus("value")
fmt.Println(node)
}
Output: autofocus="value"
func Autoplay ¶
Autoplay specifies that the audio/video should start playing as soon as it is ready.
func ExampleAutoplay() {
node := nodx.Autoplay("value")
fmt.Println(node)
// Output: autoplay="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Autoplay("value")
fmt.Println(node)
}
Output: autoplay="value"
func B ¶
B defines bold text.
func ExampleB() {
node := nodx.B(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <b id="1">Hello World!</b>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.B(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <b id="1">Hello World!</b>
func Background ¶
Background specifies a background image for the element.
func ExampleBackground() {
node := nodx.Background("value")
fmt.Println(node)
// Output: background="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Background("value")
fmt.Println(node)
}
Output: background="value"
func Base ¶
Base specifies the base URL for all relative URLs in a document.
func ExampleBase() {
node := nodx.Base(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <base id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Base(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <base id="1">
func Basefont ¶
Basefont specifies a default color, size, and font for all text in a document (deprecated).
func ExampleBasefont() {
node := nodx.Basefont(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <basefont id="1">Hello World!</basefont>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Basefont(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <basefont id="1">Hello World!</basefont>
func Bdi ¶
Bdi isolates a part of text that might be formatted in a different direction from other text.
func ExampleBdi() {
node := nodx.Bdi(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <bdi id="1">Hello World!</bdi>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Bdi(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <bdi id="1">Hello World!</bdi>
func Bdo ¶
Bdo overrides the current text direction.
func ExampleBdo() {
node := nodx.Bdo(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <bdo id="1">Hello World!</bdo>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Bdo(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <bdo id="1">Hello World!</bdo>
func Bgcolor ¶
Bgcolor specifies the background color of an element.
func ExampleBgcolor() {
node := nodx.Bgcolor("value")
fmt.Println(node)
// Output: bgcolor="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Bgcolor("value")
fmt.Println(node)
}
Output: bgcolor="value"
func Blockquote ¶
Blockquote defines a section that is quoted from another source.
func ExampleBlockquote() {
node := nodx.Blockquote(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <blockquote id="1">Hello World!</blockquote>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Blockquote(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <blockquote id="1">Hello World!</blockquote>
func Body ¶
Body defines the body of the document.
func ExampleBody() {
node := nodx.Body(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <body id="1">Hello World!</body>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Body(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <body id="1">Hello World!</body>
func Border ¶
Border specifies the border width.
func ExampleBorder() {
node := nodx.Border("value")
fmt.Println(node)
// Output: border="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Border("value")
fmt.Println(node)
}
Output: border="value"
func Br ¶
Br inserts a single line break.
func ExampleBr() {
node := nodx.Br(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <br id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Br(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <br id="1">
func Buffered ¶
Buffered contains the time ranges that the media element has buffered.
func ExampleBuffered() {
node := nodx.Buffered("value")
fmt.Println(node)
// Output: buffered="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Buffered("value")
fmt.Println(node)
}
Output: buffered="value"
func Button ¶
Button defines a clickable button.
func ExampleButton() {
node := nodx.Button(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <button id="1">Hello World!</button>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Button(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <button id="1">Hello World!</button>
func Canvas ¶
Canvas used to draw graphics on the fly via scripting.
func ExampleCanvas() {
node := nodx.Canvas(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <canvas id="1">Hello World!</canvas>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Canvas(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <canvas id="1">Hello World!</canvas>
func Caption ¶
Caption defines a table caption.
func ExampleCaption() {
node := nodx.Caption(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <caption id="1">Hello World!</caption>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Caption(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <caption id="1">Hello World!</caption>
func Capture ¶
Capture specifies that the camera should be used for input.
func ExampleCapture() {
node := nodx.Capture("value")
fmt.Println(node)
// Output: capture="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Capture("value")
fmt.Println(node)
}
Output: capture="value"
func Center ¶
Center defines centered text (deprecated).
func ExampleCenter() {
node := nodx.Center(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <center id="1">Hello World!</center>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Center(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <center id="1">Hello World!</center>
func Challenge ¶
Challenge specifies that the value of the keygen element should be challenged when submitted.
func ExampleChallenge() {
node := nodx.Challenge("value")
fmt.Println(node)
// Output: challenge="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Challenge("value")
fmt.Println(node)
}
Output: challenge="value"
func Charset ¶
Charset specifies the character encoding.
func ExampleCharset() {
node := nodx.Charset("value")
fmt.Println(node)
// Output: charset="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Charset("value")
fmt.Println(node)
}
Output: charset="value"
func Checked ¶
Checked specifies that an input element should be pre-selected when the page loads.
func ExampleChecked() {
node := nodx.Checked("value")
fmt.Println(node)
// Output: checked="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Checked("value")
fmt.Println(node)
}
Output: checked="value"
func CiteAttr ¶
CiteAttr specifies a URL that explains the quote, or why a text was inserted/deleted.
func ExampleCiteAttr() {
node := nodx.CiteAttr("value")
fmt.Println(node)
// Output: cite="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.CiteAttr("value")
fmt.Println(node)
}
Output: cite="value"
func CiteEl ¶
CiteEl defines the title of a work.
func ExampleCiteEl() {
node := nodx.CiteEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <cite id="1">Hello World!</cite>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.CiteEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <cite id="1">Hello World!</cite>
func Class ¶
Class specifies one or more class names for an element.
func ExampleClass() {
node := nodx.Class("value")
fmt.Println(node)
// Output: class="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Class("value")
fmt.Println(node)
}
Output: class="value"
func CodeAttr ¶
CodeAttr specifies the URL of the applet's class file to be loaded and executed.
func ExampleCodeAttr() {
node := nodx.CodeAttr("value")
fmt.Println(node)
// Output: code="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.CodeAttr("value")
fmt.Println(node)
}
Output: code="value"
func CodeEl ¶
CodeEl defines a piece of computer code.
func ExampleCodeEl() {
node := nodx.CodeEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <code id="1">Hello World!</code>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.CodeEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <code id="1">Hello World!</code>
func Codebase ¶
Codebase specifies the base URL for an applet.
func ExampleCodebase() {
node := nodx.Codebase("value")
fmt.Println(node)
// Output: codebase="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Codebase("value")
fmt.Println(node)
}
Output: codebase="value"
func Col ¶
Col specifies column properties for each column within a colgroup element.
func ExampleCol() {
node := nodx.Col(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <col id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Col(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <col id="1">
func Colgroup ¶
Colgroup specifies a group of one or more columns in a table for formatting.
func ExampleColgroup() {
node := nodx.Colgroup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <colgroup id="1">Hello World!</colgroup>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Colgroup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <colgroup id="1">Hello World!</colgroup>
func Color ¶
Color specifies the text color of an element.
func ExampleColor() {
node := nodx.Color("value")
fmt.Println(node)
// Output: color="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Color("value")
fmt.Println(node)
}
Output: color="value"
func Cols ¶
Cols specifies the visible width of a text area.
func ExampleCols() {
node := nodx.Cols("value")
fmt.Println(node)
// Output: cols="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Cols("value")
fmt.Println(node)
}
Output: cols="value"
func Colspan ¶
Colspan specifies the number of columns a cell should span.
func ExampleColspan() {
node := nodx.Colspan("value")
fmt.Println(node)
// Output: colspan="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Colspan("value")
fmt.Println(node)
}
Output: colspan="value"
func Content ¶
Content gives the value associated with the http-equiv or name attribute.
func ExampleContent() {
node := nodx.Content("value")
fmt.Println(node)
// Output: content="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Content("value")
fmt.Println(node)
}
Output: content="value"
func Contenteditable ¶
Contenteditable specifies whether the content of an element is editable.
func ExampleContenteditable() {
node := nodx.Contenteditable("value")
fmt.Println(node)
// Output: contenteditable="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Contenteditable("value")
fmt.Println(node)
}
Output: contenteditable="value"
func Contextmenu ¶
Contextmenu specifies a context menu for an element.
func ExampleContextmenu() {
node := nodx.Contextmenu("value")
fmt.Println(node)
// Output: contextmenu="value"
}
func Controls ¶
Controls specifies that audio/video controls should be displayed.
func ExampleControls() {
node := nodx.Controls("value")
fmt.Println(node)
// Output: controls="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Controls("value")
fmt.Println(node)
}
Output: controls="value"
func Coords ¶
Coords specifies the coordinates of an area in an image-map.
func ExampleCoords() {
node := nodx.Coords("value")
fmt.Println(node)
// Output: coords="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Coords("value")
fmt.Println(node)
}
Output: coords="value"
func Crossorigin ¶
Crossorigin configures the CORS requests for the element's fetched data.
func ExampleCrossorigin() {
node := nodx.Crossorigin("value")
fmt.Println(node)
// Output: crossorigin="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Crossorigin("value")
fmt.Println(node)
}
Output: crossorigin="value"
func Csp ¶
Csp allows specifying a Content Security Policy for the content in the iframe.
func ExampleCsp() {
node := nodx.Csp("value")
fmt.Println(node)
// Output: csp="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Csp("value")
fmt.Println(node)
}
Output: csp="value"
func Data ¶
Data used to store custom data private to the page or application.
func ExampleData() {
node := nodx.Data("key", "value")
fmt.Println(node)
// Output: data-key="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Data("key", "value")
fmt.Println(node)
}
Output: data-key="value"
func DataAttr ¶
DataAttr specifies the URL of the resource to be used by the object.
func ExampleDataAttr() {
node := nodx.DataAttr("value")
fmt.Println(node)
// Output: data="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.DataAttr("value")
fmt.Println(node)
}
Output: data="value"
func DataEl ¶
DataEl links the given content with a machine-readable translation.
func ExampleDataEl() {
node := nodx.DataEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <data id="1">Hello World!</data>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.DataEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <data id="1">Hello World!</data>
func Datalist ¶
Datalist specifies a list of pre-defined options for input controls.
func ExampleDatalist() {
node := nodx.Datalist(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <datalist id="1">Hello World!</datalist>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Datalist(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <datalist id="1">Hello World!</datalist>
func Datetime ¶
Datetime specifies the date and time.
func ExampleDatetime() {
node := nodx.Datetime("value")
fmt.Println(node)
// Output: datetime="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Datetime("value")
fmt.Println(node)
}
Output: datetime="value"
func Dd ¶
Dd defines a description/value of a term in a description list.
func ExampleDd() {
node := nodx.Dd(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dd id="1">Hello World!</dd>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dd(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dd id="1">Hello World!</dd>
func Decoding ¶
Decoding indicates how the browser should load the image.
func ExampleDecoding() {
node := nodx.Decoding("value")
fmt.Println(node)
// Output: decoding="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Decoding("value")
fmt.Println(node)
}
Output: decoding="value"
func Default ¶
Default specifies the default track kind.
func ExampleDefault() {
node := nodx.Default("value")
fmt.Println(node)
// Output: default="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Default("value")
fmt.Println(node)
}
Output: default="value"
func Defer ¶
Defer specifies that the script is executed when the page has finished parsing.
func ExampleDefer() {
node := nodx.Defer("value")
fmt.Println(node)
// Output: defer="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Defer("value")
fmt.Println(node)
}
Output: defer="value"
func Del ¶
Del defines text that has been deleted from a document.
func ExampleDel() {
node := nodx.Del(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <del id="1">Hello World!</del>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Del(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <del id="1">Hello World!</del>
func Details ¶
Details defines additional details that the user can view or hide.
func ExampleDetails() {
node := nodx.Details(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <details id="1">Hello World!</details>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Details(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <details id="1">Hello World!</details>
func Dfn ¶
Dfn represents the defining instance of a term.
func ExampleDfn() {
node := nodx.Dfn(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dfn id="1">Hello World!</dfn>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dfn(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dfn id="1">Hello World!</dfn>
func Dialog ¶
Dialog defines a dialog box or window.
func ExampleDialog() {
node := nodx.Dialog(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dialog id="1">Hello World!</dialog>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dialog(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dialog id="1">Hello World!</dialog>
func DirAttr ¶
DirAttr specifies the text direction for the content.
func ExampleDirAttr() {
node := nodx.DirAttr("value")
fmt.Println(node)
// Output: dir="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.DirAttr("value")
fmt.Println(node)
}
Output: dir="value"
func DirEl ¶
DirEl defines a directory list (deprecated).
func ExampleDirEl() {
node := nodx.DirEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dir id="1">Hello World!</dir>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.DirEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dir id="1">Hello World!</dir>
func Dirname ¶
Dirname enables the submission of the text directionality of an input field.
func ExampleDirname() {
node := nodx.Dirname("value")
fmt.Println(node)
// Output: dirname="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dirname("value")
fmt.Println(node)
}
Output: dirname="value"
func Disabled ¶
Disabled specifies that an element should be disabled.
func ExampleDisabled() {
node := nodx.Disabled("value")
fmt.Println(node)
// Output: disabled="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Disabled("value")
fmt.Println(node)
}
Output: disabled="value"
func Div ¶
Div defines a section or a division in a document.
func ExampleDiv() {
node := nodx.Div(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <div id="1">Hello World!</div>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <div id="1">Hello World!</div>
func Dl ¶
Dl defines a description list.
func ExampleDl() {
node := nodx.Dl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dl id="1">Hello World!</dl>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dl id="1">Hello World!</dl>
func DocType ¶
func DocType() Node
DocType Defines the document type.
This is a special element and should be used inside a nodx.Group.
Output: <!DOCTYPE html>
func Download ¶
Download specifies that the target will be downloaded when a user clicks on the hyperlink.
func ExampleDownload() {
node := nodx.Download("value")
fmt.Println(node)
// Output: download="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Download("value")
fmt.Println(node)
}
Output: download="value"
func Draggable ¶
Draggable specifies whether an element is draggable or not.
func ExampleDraggable() {
node := nodx.Draggable("value")
fmt.Println(node)
// Output: draggable="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Draggable("value")
fmt.Println(node)
}
Output: draggable="value"
func Dt ¶
Dt defines a term/name in a description list.
func ExampleDt() {
node := nodx.Dt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <dt id="1">Hello World!</dt>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Dt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <dt id="1">Hello World!</dt>
func El ¶
El creates a new Node representing an HTML element with the given name.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.El("my-custom-element",
nodx.Text("Hello, World!"),
)
fmt.Println(node)
}
Output: <my-custom-element>Hello, World!</my-custom-element>
func ElVoid ¶
ElVoid creates a new Node representing an HTML void element with the given name. Void elements are self-closing, such as <img> or <input>.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.ElVoid("my-custom-element",
nodx.Class("container"),
)
fmt.Println(node)
}
Output: <my-custom-element class="container">
func Em ¶
Em defines emphasized text.
func ExampleEm() {
node := nodx.Em(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <em id="1">Hello World!</em>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Em(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <em id="1">Hello World!</em>
func Embed ¶
Embed defines a container for an external application or interactive content.
func ExampleEmbed() {
node := nodx.Embed(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <embed id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Embed(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <embed id="1">
func Enctype ¶
Enctype specifies how the form-data should be encoded when submitting it to the server.
func ExampleEnctype() {
node := nodx.Enctype("value")
fmt.Println(node)
// Output: enctype="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Enctype("value")
fmt.Println(node)
}
Output: enctype="value"
func Enterkeyhint ¶
Enterkeyhint specifies what action label to present for the enter key on virtual keyboards.
func ExampleEnterkeyhint() {
node := nodx.Enterkeyhint("value")
fmt.Println(node)
// Output: enterkeyhint="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Enterkeyhint("value")
fmt.Println(node)
}
Output: enterkeyhint="value"
func Eval ¶ added in v0.2.0
Eval executes a provided function and integrates its resulting Node into the current node tree.
Use Eval to insert dynamic content, apply complex logic, or generate nodes on the fly.
Example:
node := nodx.Group(
nodx.Div(
nodx.Class("container"),
nodx.Eval(func() nodx.Node {
if condition {
return nodx.Text("Condition is true")
}
return nodx.Text("Condition is false")
}),
),
)
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
condition := 3 > 2
node := nodx.Div(
nodx.Class("container"),
nodx.Eval(func() nodx.Node {
// You can add your own go code here
if condition {
return nodx.Text("Condition is true")
}
return nodx.Text("Condition is false")
}),
)
fmt.Println(node)
}
Output: <div class="container">Condition is true</div>
func Fieldset ¶
Fieldset groups related elements in a form.
func ExampleFieldset() {
node := nodx.Fieldset(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <fieldset id="1">Hello World!</fieldset>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Fieldset(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <fieldset id="1">Hello World!</fieldset>
func Figcaption ¶
Figcaption defines a caption for a figure element.
func ExampleFigcaption() {
node := nodx.Figcaption(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <figcaption id="1">Hello World!</figcaption>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Figcaption(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <figcaption id="1">Hello World!</figcaption>
func Figure ¶
Figure specifies self-contained content.
func ExampleFigure() {
node := nodx.Figure(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <figure id="1">Hello World!</figure>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Figure(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <figure id="1">Hello World!</figure>
func Font ¶
Font defines font, color, and size for text (deprecated).
func ExampleFont() {
node := nodx.Font(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <font id="1">Hello World!</font>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Font(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <font id="1">Hello World!</font>
func Footer ¶
Footer defines a footer for a document or section.
func ExampleFooter() {
node := nodx.Footer(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <footer id="1">Hello World!</footer>
}
func For ¶
For specifies which form element a label or output element is bound to.
func ExampleFor() {
node := nodx.For("value")
fmt.Println(node)
// Output: for="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.For("value")
fmt.Println(node)
}
Output: for="value"
func FormAttr ¶
FormAttr specifies the form the element belongs to.
func ExampleFormAttr() {
node := nodx.FormAttr("value")
fmt.Println(node)
// Output: form="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.FormAttr("value")
fmt.Println(node)
}
Output: form="value"
func FormEl ¶
FormEl defines an HTML form for user input.
func ExampleFormEl() {
node := nodx.FormEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <form id="1">Hello World!</form>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.FormEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <form id="1">Hello World!</form>
func Formaction ¶
Formaction specifies where to send the form-data when a form is submitted (for input and button elements).
func ExampleFormaction() {
node := nodx.Formaction("value")
fmt.Println(node)
// Output: formaction="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Formaction("value")
fmt.Println(node)
}
Output: formaction="value"
func Formenctype ¶
Formenctype specifies how form-data should be encoded (for input and button elements).
func ExampleFormenctype() {
node := nodx.Formenctype("value")
fmt.Println(node)
// Output: formenctype="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Formenctype("value")
fmt.Println(node)
}
Output: formenctype="value"
func Formmethod ¶
Formmethod defines the HTTP method for sending form-data (for input and button elements).
func ExampleFormmethod() {
node := nodx.Formmethod("value")
fmt.Println(node)
// Output: formmethod="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Formmethod("value")
fmt.Println(node)
}
Output: formmethod="value"
func Formnovalidate ¶
Formnovalidate defines that form elements should not be validated when submitted.
func ExampleFormnovalidate() {
node := nodx.Formnovalidate("value")
fmt.Println(node)
// Output: formnovalidate="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Formnovalidate("value")
fmt.Println(node)
}
Output: formnovalidate="value"
func Formtarget ¶
Formtarget specifies where to display the response after submitting the form.
func ExampleFormtarget() {
node := nodx.Formtarget("value")
fmt.Println(node)
// Output: formtarget="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Formtarget("value")
fmt.Println(node)
}
Output: formtarget="value"
func Frame ¶
Frame defines a window (a frame) in a frameset (deprecated).
func ExampleFrame() {
node := nodx.Frame(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <frame id="1">Hello World!</frame>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Frame(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <frame id="1">Hello World!</frame>
func Frameset ¶
Frameset defines a set of frames (deprecated).
func ExampleFrameset() {
node := nodx.Frameset(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <frameset id="1">Hello World!</frameset>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Frameset(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <frameset id="1">Hello World!</frameset>
func Group ¶
Group combines multiple nodes into a single node without wrapping them in any HTML tag.
When rendered directly, it will call Render on all the nodes in the group sequentially.
When used as a child of another node, it will be expanded so that the nodes in the group become children of the group's parent.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Group(
nodx.DocType(),
nodx.Html(
nodx.Head(
nodx.TitleEl(nodx.Text("Hello, World!")),
),
nodx.Body(nodx.Text("Hello, World!")),
),
)
fmt.Println(node)
}
Output: <!DOCTYPE html><html><head><title>Hello, World!</title></head><body>Hello, World!</body></html>
func H1 ¶
H1 defines HTML headings level 1.
func ExampleH1() {
node := nodx.H1(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h1 id="1">Hello World!</h1>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H1(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h1 id="1">Hello World!</h1>
func H2 ¶
H2 defines HTML headings level 2.
func ExampleH2() {
node := nodx.H2(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h2 id="1">Hello World!</h2>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H2(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h2 id="1">Hello World!</h2>
func H3 ¶
H3 defines HTML headings level 3.
func ExampleH3() {
node := nodx.H3(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h3 id="1">Hello World!</h3>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H3(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h3 id="1">Hello World!</h3>
func H4 ¶
H4 defines HTML headings level 4.
func ExampleH4() {
node := nodx.H4(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h4 id="1">Hello World!</h4>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H4(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h4 id="1">Hello World!</h4>
func H5 ¶
H5 defines HTML headings level 5.
func ExampleH5() {
node := nodx.H5(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h5 id="1">Hello World!</h5>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H5(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h5 id="1">Hello World!</h5>
func H6 ¶
H6 defines HTML headings level 6.
func ExampleH6() {
node := nodx.H6(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <h6 id="1">Hello World!</h6>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.H6(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <h6 id="1">Hello World!</h6>
func Head ¶
Head contains metadata/information for the document.
func ExampleHead() {
node := nodx.Head(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <head id="1">Hello World!</head>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Head(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <head id="1">Hello World!</head>
func Header ¶
Header defines a header for a document or section.
func ExampleHeader() {
node := nodx.Header(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <header id="1">Hello World!</header>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Header(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <header id="1">Hello World!</header>
func Headers ¶
Headers specifies one or more header cells a cell is related to.
func ExampleHeaders() {
node := nodx.Headers("value")
fmt.Println(node)
// Output: headers="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Headers("value")
fmt.Println(node)
}
Output: headers="value"
func Height ¶
Height specifies the height of the element.
func ExampleHeight() {
node := nodx.Height("value")
fmt.Println(node)
// Output: height="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Height("value")
fmt.Println(node)
}
Output: height="value"
func Hidden ¶
Hidden specifies that an element is not yet, or is no longer, relevant.
func ExampleHidden() {
node := nodx.Hidden("value")
fmt.Println(node)
// Output: hidden="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Hidden("value")
fmt.Println(node)
}
Output: hidden="value"
func High ¶
High specifies the range that is considered to be a high value.
func ExampleHigh() {
node := nodx.High("value")
fmt.Println(node)
// Output: high="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.High("value")
fmt.Println(node)
}
Output: high="value"
func Hr ¶
Hr defines a thematic change in the content.
func ExampleHr() {
node := nodx.Hr(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <hr id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Hr(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <hr id="1">
func Href ¶
Href specifies the URL of the page the link goes to.
func ExampleHref() {
node := nodx.Href("value")
fmt.Println(node)
// Output: href="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Href("value")
fmt.Println(node)
}
Output: href="value"
func Hreflang ¶
Hreflang specifies the language of the linked document.
func ExampleHreflang() {
node := nodx.Hreflang("value")
fmt.Println(node)
// Output: hreflang="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Hreflang("value")
fmt.Println(node)
}
Output: hreflang="value"
func Html ¶
Html defines the root of an HTML document.
func ExampleHtml() {
node := nodx.Html(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <html id="1">Hello World!</html>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Html(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <html id="1">Hello World!</html>
func HttpEquiv ¶
HttpEquiv provides an HTTP header for the information/value of the content attribute.
func ExampleHttpEquiv() {
node := nodx.HttpEquiv("value")
fmt.Println(node)
// Output: http-equiv="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.HttpEquiv("value")
fmt.Println(node)
}
Output: http-equiv="value"
func I ¶
I defines a part of text in an alternate voice or mood.
func ExampleI() {
node := nodx.I(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <i id="1">Hello World!</i>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.I(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <i id="1">Hello World!</i>
func Icon ¶
Icon specifies an icon for the command.
func ExampleIcon() {
node := nodx.Icon("value")
fmt.Println(node)
// Output: icon="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Icon("value")
fmt.Println(node)
}
Output: icon="value"
func Id ¶
Id specifies a unique id for an element.
func ExampleId() {
node := nodx.Id("value")
fmt.Println(node)
// Output: id="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Id("value")
fmt.Println(node)
}
Output: id="value"
func If ¶
If renders a Node based on the provided boolean condition. If the condition is true, the node is rendered; otherwise, it renders nothing.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
condition := 3 > 2
node := nodx.Div(
nodx.Class("container"),
nodx.If(condition, nodx.Text("Condition is true")),
)
fmt.Println(node)
}
Output: <div class="container">Condition is true</div>
func IfFunc ¶
IfFunc executes and renders the result of a function based on the provided boolean condition. If the condition is true, the function is executed and rendered; otherwise, nothing is executed nor rendered.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
condition := 3 > 2
node := nodx.Div(
nodx.Class("container"),
nodx.IfFunc(condition, func() nodx.Node {
// You can add your own go code here
return nodx.Text("Condition is true")
}),
)
fmt.Println(node)
}
Output: <div class="container">Condition is true</div>
func Iframe ¶
Iframe defines an inline frame.
func ExampleIframe() {
node := nodx.Iframe(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <iframe id="1">Hello World!</iframe>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Iframe(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <iframe id="1">Hello World!</iframe>
func Img ¶
Img defines an image.
func ExampleImg() {
node := nodx.Img(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <img id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Img(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <img id="1">
func Importance ¶
Importance indicates the relative fetch priority for the resource.
func ExampleImportance() {
node := nodx.Importance("value")
fmt.Println(node)
// Output: importance="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Importance("value")
fmt.Println(node)
}
Output: importance="value"
func Input ¶
Input defines an input control.
func ExampleInput() {
node := nodx.Input(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <input id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Input(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <input id="1">
func Ins ¶
Ins defines a text that has been inserted into a document.
func ExampleIns() {
node := nodx.Ins(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <ins id="1">Hello World!</ins>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ins(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <ins id="1">Hello World!</ins>
func Integrity ¶
Integrity allows a browser to verify the fetched resource's integrity.
func ExampleIntegrity() {
node := nodx.Integrity("value")
fmt.Println(node)
// Output: integrity="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Integrity("value")
fmt.Println(node)
}
Output: integrity="value"
func Ismap ¶
Ismap specifies an image as a server-side image-map.
func ExampleIsmap() {
node := nodx.Ismap("value")
fmt.Println(node)
// Output: ismap="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ismap("value")
fmt.Println(node)
}
Output: ismap="value"
func Itemprop ¶
Itemprop defines a property of an item.
func ExampleItemprop() {
node := nodx.Itemprop("value")
fmt.Println(node)
// Output: itemprop="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Itemprop("value")
fmt.Println(node)
}
Output: itemprop="value"
func Kbd ¶
Kbd defines keyboard input.
func ExampleKbd() {
node := nodx.Kbd(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <kbd id="1">Hello World!</kbd>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Kbd(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <kbd id="1">Hello World!</kbd>
func Keytype ¶
Keytype specifies the security algorithm of a key.
func ExampleKeytype() {
node := nodx.Keytype("value")
fmt.Println(node)
// Output: keytype="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Keytype("value")
fmt.Println(node)
}
Output: keytype="value"
func Kind ¶
Kind specifies the kind of text track.
func ExampleKind() {
node := nodx.Kind("value")
fmt.Println(node)
// Output: kind="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Kind("value")
fmt.Println(node)
}
Output: kind="value"
func LabelAttr ¶
LabelAttr specifies the title of the text track.
func ExampleLabelAttr() {
node := nodx.LabelAttr("value")
fmt.Println(node)
// Output: label="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.LabelAttr("value")
fmt.Println(node)
}
Output: label="value"
func LabelEl ¶
LabelEl defines a label for an input element.
func ExampleLabelEl() {
node := nodx.LabelEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <label id="1">Hello World!</label>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.LabelEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <label id="1">Hello World!</label>
func Lang ¶
Lang specifies the language of the element's content.
func ExampleLang() {
node := nodx.Lang("value")
fmt.Println(node)
// Output: lang="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Lang("value")
fmt.Println(node)
}
Output: lang="value"
func Language ¶
Language deprecated. Specifies the scripting language used for the script.
func ExampleLanguage() {
node := nodx.Language("value")
fmt.Println(node)
// Output: language="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Language("value")
fmt.Println(node)
}
Output: language="value"
func Legend ¶
Legend defines a caption for a fieldset element.
func ExampleLegend() {
node := nodx.Legend(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <legend id="1">Hello World!</legend>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Legend(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <legend id="1">Hello World!</legend>
func Li ¶
Li defines a list item.
func ExampleLi() {
node := nodx.Li(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <li id="1">Hello World!</li>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Li(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <li id="1">Hello World!</li>
func Link ¶
Link defines the relationship between a document and an external resource.
func ExampleLink() {
node := nodx.Link(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <link id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Link(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <link id="1">
func List ¶
List refers to a datalist element that contains pre-defined options.
func ExampleList() {
node := nodx.List("value")
fmt.Println(node)
// Output: list="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.List("value")
fmt.Println(node)
}
Output: list="value"
func Loading ¶
Loading indicates how the browser should load the image or iframe.
func ExampleLoading() {
node := nodx.Loading("value")
fmt.Println(node)
// Output: loading="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Loading("value")
fmt.Println(node)
}
Output: loading="value"
func Loop ¶
Loop specifies that the audio/video will start over again, every time it is finished.
func ExampleLoop() {
node := nodx.Loop("value")
fmt.Println(node)
// Output: loop="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Loop("value")
fmt.Println(node)
}
Output: loop="value"
func Low ¶
Low specifies the range that is considered to be a low value.
func ExampleLow() {
node := nodx.Low("value")
fmt.Println(node)
// Output: low="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Low("value")
fmt.Println(node)
}
Output: low="value"
func Main ¶
Main specifies the main content of a document.
func ExampleMain() {
node := nodx.Main(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <main id="1">Hello World!</main>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Main(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <main id="1">Hello World!</main>
func Manifest ¶
Manifest specifies the URL of the document's cache manifest.
func ExampleManifest() {
node := nodx.Manifest("value")
fmt.Println(node)
// Output: manifest="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Manifest("value")
fmt.Println(node)
}
Output: manifest="value"
func Map ¶
Map transforms a slice of any type into a group of nodes by applying a function to each element. Returns a single Node that contains all the resulting nodes.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
items := []string{"Item 1", "Item 2", "Item 3"}
node := nodx.Ul(
nodx.Map(items, func(item string) nodx.Node {
return nodx.Li(nodx.Text(item))
}),
)
fmt.Println(node)
}
Output: <ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
func MapEl ¶
MapEl defines an image-map.
func ExampleMapEl() {
node := nodx.MapEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <map id="1">Hello World!</map>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.MapEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <map id="1">Hello World!</map>
func Mark ¶
Mark defines marked or highlighted text.
func ExampleMark() {
node := nodx.Mark(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <mark id="1">Hello World!</mark>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Mark(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <mark id="1">Hello World!</mark>
func Max ¶
Max specifies the maximum value.
func ExampleMax() {
node := nodx.Max("value")
fmt.Println(node)
// Output: max="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Max("value")
fmt.Println(node)
}
Output: max="value"
func Maxlength ¶
Maxlength specifies the maximum number of characters allowed in an input field.
func ExampleMaxlength() {
node := nodx.Maxlength("value")
fmt.Println(node)
// Output: maxlength="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Maxlength("value")
fmt.Println(node)
}
Output: maxlength="value"
func Media ¶
Media specifies what media/device the linked document is optimized for.
func ExampleMedia() {
node := nodx.Media("value")
fmt.Println(node)
// Output: media="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Media("value")
fmt.Println(node)
}
Output: media="value"
func Meta ¶
Meta defines metadata about an HTML document.
func ExampleMeta() {
node := nodx.Meta(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <meta id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Meta(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <meta id="1">
func Meter ¶
Meter defines a scalar measurement within a known range.
func ExampleMeter() {
node := nodx.Meter(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <meter id="1">Hello World!</meter>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Meter(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <meter id="1">Hello World!</meter>
func Method ¶
Method specifies the HTTP method to use when sending form-data.
func ExampleMethod() {
node := nodx.Method("value")
fmt.Println(node)
// Output: method="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Method("value")
fmt.Println(node)
}
Output: method="value"
func Min ¶
Min specifies the minimum value.
func ExampleMin() {
node := nodx.Min("value")
fmt.Println(node)
// Output: min="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Min("value")
fmt.Println(node)
}
Output: min="value"
func Minlength ¶
Minlength specifies the minimum number of characters required in an input field.
func ExampleMinlength() {
node := nodx.Minlength("value")
fmt.Println(node)
// Output: minlength="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Minlength("value")
fmt.Println(node)
}
Output: minlength="value"
func Multiple ¶
Multiple specifies that a user can enter more than one value.
func ExampleMultiple() {
node := nodx.Multiple("value")
fmt.Println(node)
// Output: multiple="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Multiple("value")
fmt.Println(node)
}
Output: multiple="value"
func Muted ¶
Muted specifies that the audio output should be muted.
func ExampleMuted() {
node := nodx.Muted("value")
fmt.Println(node)
// Output: muted="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Muted("value")
fmt.Println(node)
}
Output: muted="value"
func Name ¶
Name specifies the name of the element.
func ExampleName() {
node := nodx.Name("value")
fmt.Println(node)
// Output: name="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Name("value")
fmt.Println(node)
}
Output: name="value"
func Nav ¶
Nav defines navigation links.
func ExampleNav() {
node := nodx.Nav(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <nav id="1">Hello World!</nav>
}
func Noframes ¶
Noframes defines an alternate content for users that do not support frames (deprecated).
func ExampleNoframes() {
node := nodx.Noframes(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <noframes id="1">Hello World!</noframes>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Noframes(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <noframes id="1">Hello World!</noframes>
func Nomodule ¶
Nomodule indicates that the script should not be executed in browsers that support module scripts.
func ExampleNomodule() {
node := nodx.Nomodule("value")
fmt.Println(node)
// Output: nomodule="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Nomodule("value")
fmt.Println(node)
}
Output: nomodule="value"
func Nonce ¶
Nonce a cryptographic nonce used in Content Security Policy.
func ExampleNonce() {
node := nodx.Nonce("value")
fmt.Println(node)
// Output: nonce="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Nonce("value")
fmt.Println(node)
}
Output: nonce="value"
func Noscript ¶
Noscript defines an alternate content for users that do not support client-side scripts.
func ExampleNoscript() {
node := nodx.Noscript(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <noscript id="1">Hello World!</noscript>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Noscript(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <noscript id="1">Hello World!</noscript>
func Novalidate ¶
Novalidate specifies that the form should not be validated when submitted.
func ExampleNovalidate() {
node := nodx.Novalidate("value")
fmt.Println(node)
// Output: novalidate="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Novalidate("value")
fmt.Println(node)
}
Output: novalidate="value"
func Object ¶
Object defines an embedded object.
func ExampleObject() {
node := nodx.Object(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <object id="1">Hello World!</object>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Object(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <object id="1">Hello World!</object>
func Ol ¶
Ol defines an ordered list.
func ExampleOl() {
node := nodx.Ol(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <ol id="1">Hello World!</ol>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ol(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <ol id="1">Hello World!</ol>
func Open ¶
Open specifies that the details should be visible to the user.
func ExampleOpen() {
node := nodx.Open("value")
fmt.Println(node)
// Output: open="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Open("value")
fmt.Println(node)
}
Output: open="value"
func Optgroup ¶
Optgroup defines a group of related options in a drop-down list.
func ExampleOptgroup() {
node := nodx.Optgroup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <optgroup id="1">Hello World!</optgroup>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Optgroup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <optgroup id="1">Hello World!</optgroup>
func Optimum ¶
Optimum specifies the optimal value of the gauge.
func ExampleOptimum() {
node := nodx.Optimum("value")
fmt.Println(node)
// Output: optimum="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Optimum("value")
fmt.Println(node)
}
Output: optimum="value"
func Option ¶
Option defines an option in a drop-down list.
func ExampleOption() {
node := nodx.Option(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <option id="1">Hello World!</option>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Option(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <option id="1">Hello World!</option>
func Output ¶
Output defines the result of a calculation.
func ExampleOutput() {
node := nodx.Output(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <output id="1">Hello World!</output>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Output(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <output id="1">Hello World!</output>
func P ¶
P defines a paragraph.
func ExampleP() {
node := nodx.P(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <p id="1">Hello World!</p>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.P(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <p id="1">Hello World!</p>
func Param ¶
Param defines a parameter for an object.
func ExampleParam() {
node := nodx.Param(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <param id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Param(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <param id="1">
func Pattern ¶
Pattern specifies a regular expression that the input element's value is checked against.
func ExamplePattern() {
node := nodx.Pattern("value")
fmt.Println(node)
// Output: pattern="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Pattern("value")
fmt.Println(node)
}
Output: pattern="value"
func Picture ¶
Picture defines a container for multiple image resources.
func ExamplePicture() {
node := nodx.Picture(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <picture id="1">Hello World!</picture>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Picture(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <picture id="1">Hello World!</picture>
func Ping ¶
Ping specifies a space-separated list of URLs to be notified if a user follows the hyperlink.
func ExamplePing() {
node := nodx.Ping("value")
fmt.Println(node)
// Output: ping="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ping("value")
fmt.Println(node)
}
Output: ping="value"
func Placeholder ¶
Placeholder specifies a short hint that describes the expected value of an input field.
func ExamplePlaceholder() {
node := nodx.Placeholder("value")
fmt.Println(node)
// Output: placeholder="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Placeholder("value")
fmt.Println(node)
}
Output: placeholder="value"
func Playsinline ¶
Playsinline indicates that the video should play inline on mobile devices.
func ExamplePlaysinline() {
node := nodx.Playsinline("value")
fmt.Println(node)
// Output: playsinline="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Playsinline("value")
fmt.Println(node)
}
Output: playsinline="value"
func Poster ¶
Poster specifies an image to be shown while the video is downloading or until the user hits the play button.
func ExamplePoster() {
node := nodx.Poster("value")
fmt.Println(node)
// Output: poster="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Poster("value")
fmt.Println(node)
}
Output: poster="value"
func Pre ¶
Pre defines preformatted text.
func ExamplePre() {
node := nodx.Pre(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <pre id="1">Hello World!</pre>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Pre(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <pre id="1">Hello World!</pre>
func Preload ¶
Preload specifies if and how the author thinks the audio/video should be loaded when the page loads.
func ExamplePreload() {
node := nodx.Preload("value")
fmt.Println(node)
// Output: preload="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Preload("value")
fmt.Println(node)
}
Output: preload="value"
func Progress ¶
Progress represents the progress of a task.
func ExampleProgress() {
node := nodx.Progress(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <progress id="1">Hello World!</progress>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Progress(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <progress id="1">Hello World!</progress>
func Q ¶
Q defines a short quotation.
func ExampleQ() {
node := nodx.Q(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <q id="1">Hello World!</q>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Q(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <q id="1">Hello World!</q>
func Raw ¶
Raw creates a new Node representing a raw HTML text node. The value is not escaped, so the caller must ensure the content is safe. Useful for rendering raw HTML, like <script> or <style> tags.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Raw("<script>alert('Hello, World!')</script>"),
)
fmt.Println(node)
}
Output: <div><script>alert('Hello, World!')</script></div>
func Rawf ¶
Rawf creates a new Node representing a raw HTML text node. The value is formatted with fmt.Sprintf and not escaped, so ensure its safety. Useful for rendering raw HTML, like <script> or <style> tags.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Rawf("<script>alert('Hello, %s!')</script>", "World"),
)
fmt.Println(node)
}
Output: <div><script>alert('Hello, World!')</script></div>
func Rb ¶
Rb used to delimit the base text component of a ruby annotation.
func ExampleRb() {
node := nodx.Rb(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <rb id="1">Hello World!</rb>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rb(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <rb id="1">Hello World!</rb>
func Readonly ¶
Readonly specifies that the input field is read-only.
func ExampleReadonly() {
node := nodx.Readonly("value")
fmt.Println(node)
// Output: readonly="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Readonly("value")
fmt.Println(node)
}
Output: readonly="value"
func Referrerpolicy ¶
Referrerpolicy specifies which referrer information to send when fetching a resource.
func ExampleReferrerpolicy() {
node := nodx.Referrerpolicy("value")
fmt.Println(node)
// Output: referrerpolicy="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Referrerpolicy("value")
fmt.Println(node)
}
Output: referrerpolicy="value"
func Rel ¶
Rel specifies the relationship between the current document and the linked document.
func ExampleRel() {
node := nodx.Rel("value")
fmt.Println(node)
// Output: rel="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rel("value")
fmt.Println(node)
}
Output: rel="value"
func Required ¶
Required specifies that the input field must be filled out before submitting the form.
func ExampleRequired() {
node := nodx.Required("value")
fmt.Println(node)
// Output: required="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Required("value")
fmt.Println(node)
}
Output: required="value"
func Reversed ¶
Reversed specifies that the list order should be descending (9,8,7...).
func ExampleReversed() {
node := nodx.Reversed("value")
fmt.Println(node)
// Output: reversed="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Reversed("value")
fmt.Println(node)
}
Output: reversed="value"
func Role ¶
Role defines the role of an element for accessibility purposes.
func ExampleRole() {
node := nodx.Role("value")
fmt.Println(node)
// Output: role="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Role("value")
fmt.Println(node)
}
Output: role="value"
func Rows ¶
Rows specifies the visible number of lines in a text area.
func ExampleRows() {
node := nodx.Rows("value")
fmt.Println(node)
// Output: rows="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rows("value")
fmt.Println(node)
}
Output: rows="value"
func Rowspan ¶
Rowspan specifies the number of rows a cell should span.
func ExampleRowspan() {
node := nodx.Rowspan("value")
fmt.Println(node)
// Output: rowspan="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rowspan("value")
fmt.Println(node)
}
Output: rowspan="value"
func Rp ¶
Rp defines what to show in browsers that do not support ruby annotations.
func ExampleRp() {
node := nodx.Rp(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <rp id="1">Hello World!</rp>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rp(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <rp id="1">Hello World!</rp>
func Rt ¶
Rt defines an explanation/pronunciation of characters (for East Asian typography).
func ExampleRt() {
node := nodx.Rt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <rt id="1">Hello World!</rt>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <rt id="1">Hello World!</rt>
func Rtc ¶
Rtc defines a ruby text container for multiple rt elements.
func ExampleRtc() {
node := nodx.Rtc(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <rtc id="1">Hello World!</rtc>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Rtc(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <rtc id="1">Hello World!</rtc>
func Ruby ¶
Ruby defines a ruby annotation.
func ExampleRuby() {
node := nodx.Ruby(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <ruby id="1">Hello World!</ruby>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ruby(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <ruby id="1">Hello World!</ruby>
func S ¶
S defines text that is no longer correct.
func ExampleS() {
node := nodx.S(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <s id="1">Hello World!</s>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.S(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <s id="1">Hello World!</s>
func Samp ¶
Samp defines sample output from a computer program.
func ExampleSamp() {
node := nodx.Samp(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <samp id="1">Hello World!</samp>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Samp(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <samp id="1">Hello World!</samp>
func Sandbox ¶
Sandbox enables an extra set of restrictions for the content in an iframe.
func ExampleSandbox() {
node := nodx.Sandbox("value")
fmt.Println(node)
// Output: sandbox="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Sandbox("value")
fmt.Println(node)
}
Output: sandbox="value"
func Scope ¶
Scope specifies whether a header cell is a header for a column, row, or group of columns or rows.
func ExampleScope() {
node := nodx.Scope("value")
fmt.Println(node)
// Output: scope="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Scope("value")
fmt.Println(node)
}
Output: scope="value"
func Scoped ¶
Scoped specifies that the styles only apply to this element's parent and child elements.
func ExampleScoped() {
node := nodx.Scoped("value")
fmt.Println(node)
// Output: scoped="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Scoped("value")
fmt.Println(node)
}
Output: scoped="value"
func Script ¶
Script defines a client-side script.
func ExampleScript() {
node := nodx.Script(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <script id="1">Hello World!</script>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Script(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <script id="1">Hello World!</script>
func Section ¶
Section defines a section in a document.
func ExampleSection() {
node := nodx.Section(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <section id="1">Hello World!</section>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Section(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <section id="1">Hello World!</section>
func Select ¶
Select defines a drop-down list.
func ExampleSelect() {
node := nodx.Select(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <select id="1">Hello World!</select>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Select(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <select id="1">Hello World!</select>
func Selected ¶
Selected specifies that an option should be pre-selected when the page loads.
func ExampleSelected() {
node := nodx.Selected("value")
fmt.Println(node)
// Output: selected="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Selected("value")
fmt.Println(node)
}
Output: selected="value"
func Shape ¶
Shape specifies the shape of an area in an image-map.
func ExampleShape() {
node := nodx.Shape("value")
fmt.Println(node)
// Output: shape="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Shape("value")
fmt.Println(node)
}
Output: shape="value"
func Size ¶
Size specifies the width, in characters, of an input field.
func ExampleSize() {
node := nodx.Size("value")
fmt.Println(node)
// Output: size="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Size("value")
fmt.Println(node)
}
Output: size="value"
func Sizes ¶
Sizes specifies the sizes of icons for visual media.
func ExampleSizes() {
node := nodx.Sizes("value")
fmt.Println(node)
// Output: sizes="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Sizes("value")
fmt.Println(node)
}
Output: sizes="value"
func SlotAttr ¶
SlotAttr assigns a slot in a shadow DOM shadow tree.
func ExampleSlotAttr() {
node := nodx.SlotAttr("value")
fmt.Println(node)
// Output: slot="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SlotAttr("value")
fmt.Println(node)
}
Output: slot="value"
func SlotEl ¶
SlotEl defines a placeholder inside a web component.
func ExampleSlotEl() {
node := nodx.SlotEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <slot id="1">Hello World!</slot>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SlotEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <slot id="1">Hello World!</slot>
func Small ¶
Small defines smaller text.
func ExampleSmall() {
node := nodx.Small(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <small id="1">Hello World!</small>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Small(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <small id="1">Hello World!</small>
func Source ¶
Source defines multiple media resources for media elements.
func ExampleSource() {
node := nodx.Source(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <source id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Source(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <source id="1">
func SpanAttr ¶
SpanAttr defines the number of columns to span for a col or colgroup element.
func ExampleSpanAttr() {
node := nodx.SpanAttr("value")
fmt.Println(node)
// Output: span="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SpanAttr("value")
fmt.Println(node)
}
Output: span="value"
func SpanEl ¶
SpanEl defines a section in a document.
func ExampleSpanEl() {
node := nodx.SpanEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <span id="1">Hello World!</span>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SpanEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <span id="1">Hello World!</span>
func Spellcheck ¶
Spellcheck specifies whether the element is to have its spelling and grammar checked or not.
func ExampleSpellcheck() {
node := nodx.Spellcheck("value")
fmt.Println(node)
// Output: spellcheck="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Spellcheck("value")
fmt.Println(node)
}
Output: spellcheck="value"
func Src ¶
Src specifies the URL of the media file.
func ExampleSrc() {
node := nodx.Src("value")
fmt.Println(node)
// Output: src="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Src("value")
fmt.Println(node)
}
Output: src="value"
func Srcdoc ¶
Srcdoc specifies the HTML content of the page to show in the iframe.
func ExampleSrcdoc() {
node := nodx.Srcdoc("value")
fmt.Println(node)
// Output: srcdoc="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Srcdoc("value")
fmt.Println(node)
}
Output: srcdoc="value"
func Srclang ¶
Srclang specifies the language of the track text data (required if kind='subtitles').
func ExampleSrclang() {
node := nodx.Srclang("value")
fmt.Println(node)
// Output: srclang="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Srclang("value")
fmt.Println(node)
}
Output: srclang="value"
func Srcset ¶
Srcset specifies the URL of the image to use in different situations.
func ExampleSrcset() {
node := nodx.Srcset("value")
fmt.Println(node)
// Output: srcset="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Srcset("value")
fmt.Println(node)
}
Output: srcset="value"
func Start ¶
Start specifies the start value of an ordered list.
func ExampleStart() {
node := nodx.Start("value")
fmt.Println(node)
// Output: start="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Start("value")
fmt.Println(node)
}
Output: start="value"
func Step ¶
Step specifies the legal number intervals for an input field.
func ExampleStep() {
node := nodx.Step("value")
fmt.Println(node)
// Output: step="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Step("value")
fmt.Println(node)
}
Output: step="value"
func Strike ¶
Strike defines strikethrough text (deprecated).
func ExampleStrike() {
node := nodx.Strike(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <strike id="1">Hello World!</strike>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Strike(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <strike id="1">Hello World!</strike>
func Strong ¶
Strong defines important text.
func ExampleStrong() {
node := nodx.Strong(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <strong id="1">Hello World!</strong>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Strong(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <strong id="1">Hello World!</strong>
func StyleAttr ¶
StyleAttr specifies an inline CSS style for an element.
func ExampleStyleAttr() {
node := nodx.StyleAttr("value")
fmt.Println(node)
// Output: style="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.StyleAttr("value")
fmt.Println(node)
}
Output: style="value"
func StyleEl ¶
StyleEl defines style information for a document.
func ExampleStyleEl() {
node := nodx.StyleEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <style id="1">Hello World!</style>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.StyleEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <style id="1">Hello World!</style>
func Sub ¶
Sub defines subscripted text.
func ExampleSub() {
node := nodx.Sub(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <sub id="1">Hello World!</sub>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Sub(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <sub id="1">Hello World!</sub>
func SummaryAttr ¶
SummaryAttr specifies a summary of the content of a table (deprecated in HTML5).
func ExampleSummaryAttr() {
node := nodx.SummaryAttr("value")
fmt.Println(node)
// Output: summary="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SummaryAttr("value")
fmt.Println(node)
}
Output: summary="value"
func SummaryEl ¶
SummaryEl defines a visible heading for a details element.
func ExampleSummaryEl() {
node := nodx.SummaryEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <summary id="1">Hello World!</summary>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.SummaryEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <summary id="1">Hello World!</summary>
func Sup ¶
Sup defines superscripted text.
func ExampleSup() {
node := nodx.Sup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <sup id="1">Hello World!</sup>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Sup(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <sup id="1">Hello World!</sup>
func Svg ¶
Svg defines a container for SVG graphics.
func ExampleSvg() {
node := nodx.Svg(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <svg id="1">Hello World!</svg>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Svg(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <svg id="1">Hello World!</svg>
func Tabindex ¶
Tabindex specifies the tabbing order of an element.
func ExampleTabindex() {
node := nodx.Tabindex("value")
fmt.Println(node)
// Output: tabindex="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Tabindex("value")
fmt.Println(node)
}
Output: tabindex="value"
func Table ¶
Table defines a table.
func ExampleTable() {
node := nodx.Table(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <table id="1">Hello World!</table>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Table(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <table id="1">Hello World!</table>
func Target ¶
Target specifies where to open the linked document.
func ExampleTarget() {
node := nodx.Target("value")
fmt.Println(node)
// Output: target="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Target("value")
fmt.Println(node)
}
Output: target="value"
func Tbody ¶
Tbody groups the body content in a table.
func ExampleTbody() {
node := nodx.Tbody(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <tbody id="1">Hello World!</tbody>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Tbody(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <tbody id="1">Hello World!</tbody>
func Td ¶
Td defines a cell in a table.
func ExampleTd() {
node := nodx.Td(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <td id="1">Hello World!</td>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Td(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <td id="1">Hello World!</td>
func Template ¶
Template defines a template.
func ExampleTemplate() {
node := nodx.Template(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <template id="1">Hello World!</template>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Template(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <template id="1">Hello World!</template>
func Text ¶
Text creates a new Node representing an escaped HTML text node. The value is HTML-escaped to prevent XSS attacks.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Text("<script>alert('Hello, World!')</script>"),
)
fmt.Println(node)
}
Output: <div><script>alert('Hello, World!')</script></div>
func Textarea ¶
Textarea defines a multiline input control.
func ExampleTextarea() {
node := nodx.Textarea(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <textarea id="1">Hello World!</textarea>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Textarea(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <textarea id="1">Hello World!</textarea>
func Textf ¶
Textf creates a new Node representing an escaped HTML text node. The value is formatted with fmt.Sprintf and then HTML-escaped to prevent XSS attacks.
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Div(
nodx.Textf("<script>alert('Hello, %s!')</script>", "World"),
)
fmt.Println(node)
}
Output: <div><script>alert('Hello, World!')</script></div>
func Tfoot ¶
Tfoot groups the footer content in a table.
func ExampleTfoot() {
node := nodx.Tfoot(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <tfoot id="1">Hello World!</tfoot>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Tfoot(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <tfoot id="1">Hello World!</tfoot>
func Th ¶
Th defines a header cell in a table.
func ExampleTh() {
node := nodx.Th(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <th id="1">Hello World!</th>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Th(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <th id="1">Hello World!</th>
func Thead ¶
Thead groups the header content in a table.
func ExampleThead() {
node := nodx.Thead(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <thead id="1">Hello World!</thead>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Thead(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <thead id="1">Hello World!</thead>
func Time ¶
Time defines a specific time.
func ExampleTime() {
node := nodx.Time(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <time id="1">Hello World!</time>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Time(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <time id="1">Hello World!</time>
func TitleAttr ¶
TitleAttr specifies extra information about an element.
func ExampleTitleAttr() {
node := nodx.TitleAttr("value")
fmt.Println(node)
// Output: title="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.TitleAttr("value")
fmt.Println(node)
}
Output: title="value"
func TitleEl ¶
TitleEl defines a title for the document.
func ExampleTitleEl() {
node := nodx.TitleEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <title id="1">Hello World!</title>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.TitleEl(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <title id="1">Hello World!</title>
func Tr ¶
Tr defines a row in a table.
func ExampleTr() {
node := nodx.Tr(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <tr id="1">Hello World!</tr>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Tr(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <tr id="1">Hello World!</tr>
func Track ¶
Track defines text tracks for media elements.
func ExampleTrack() {
node := nodx.Track(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <track id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Track(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <track id="1">
func Translate ¶
Translate specifies whether the content of an element should be translated or not.
func ExampleTranslate() {
node := nodx.Translate("value")
fmt.Println(node)
// Output: translate="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Translate("value")
fmt.Println(node)
}
Output: translate="value"
func Tt ¶
Tt defines teletype text (deprecated).
func ExampleTt() {
node := nodx.Tt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <tt id="1">Hello World!</tt>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Tt(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <tt id="1">Hello World!</tt>
func Type ¶
Type specifies the type of element.
func ExampleType() {
node := nodx.Type("value")
fmt.Println(node)
// Output: type="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Type("value")
fmt.Println(node)
}
Output: type="value"
func U ¶
U defines text that should be stylistically different from normal text.
func ExampleU() {
node := nodx.U(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <u id="1">Hello World!</u>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.U(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <u id="1">Hello World!</u>
func Ul ¶
Ul defines an unordered list.
func ExampleUl() {
node := nodx.Ul(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <ul id="1">Hello World!</ul>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Ul(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <ul id="1">Hello World!</ul>
func Usemap ¶
Usemap specifies an image as a client-side image-map.
func ExampleUsemap() {
node := nodx.Usemap("value")
fmt.Println(node)
// Output: usemap="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Usemap("value")
fmt.Println(node)
}
Output: usemap="value"
func Value ¶
Value specifies the value of the element.
func ExampleValue() {
node := nodx.Value("value")
fmt.Println(node)
// Output: value="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Value("value")
fmt.Println(node)
}
Output: value="value"
func Var ¶
Var defines a variable.
func ExampleVar() {
node := nodx.Var(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <var id="1">Hello World!</var>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Var(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <var id="1">Hello World!</var>
func Video ¶
Video defines embedded video content.
func ExampleVideo() {
node := nodx.Video(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
// Output: <video id="1">Hello World!</video>
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Video(
nodx.Id("1"),
nodx.Text("Hello World!"),
)
fmt.Println(node)
}
Output: <video id="1">Hello World!</video>
func Wbr ¶
Wbr defines a possible line-break.
func ExampleWbr() {
node := nodx.Wbr(
nodx.Id( "1"),
)
fmt.Println(node)
// Output: <wbr id="1">
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Wbr(
nodx.Id("1"),
)
fmt.Println(node)
}
Output: <wbr id="1">
func Width ¶
Width specifies the width of the element.
func ExampleWidth() {
node := nodx.Width("value")
fmt.Println(node)
// Output: width="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Width("value")
fmt.Println(node)
}
Output: width="value"
func Wrap ¶
Wrap specifies how the text in a text area is to be wrapped when submitted in a form.
func ExampleWrap() {
node := nodx.Wrap("value")
fmt.Println(node)
// Output: wrap="value"
}
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
node := nodx.Wrap("value")
fmt.Println(node)
}
Output: wrap="value"
type StyleMap ¶
StyleMap represents a map of CSS style rules with conditional rendering. The keys are the complete CSS rules (e.g., "border: 1px solid black"), and the values are boolean conditions indicating whether each rule should be included in the final output.
Example:
sm := StyleMap{
"border: 1px solid black": true, // Included
"padding: 10px": false, // Excluded
"margin: 5px": true, // Included
}
This will render the style attribute as: style="border: 1px solid black; margin: 5px"
Example ¶
package main
import (
"fmt"
nodx "github.com/nodxdev/nodxgo"
)
func main() {
shouldHide := 3 > 2
node := nodx.Div(
nodx.StyleMap{
"color: red": true,
"border: 1px solid blue": false,
"display: none": shouldHide,
},
nodx.Text("Hello, World!"),
)
fmt.Println(node)
}
Output: <div style="color: red; display: none">Hello, World!</div>