Skip to content

Version 0.27.0

Compare
Choose a tag to compare
@chasefleming chasefleming released this 07 Aug 23:22
· 16 commits to main since this release
d709650

🚀 New Features

Support for Single-Quoted Attribute Values

You can now define attributes with values enclosed in single quotes, avoiding the need for additional escaping when double quotes are used within the attribute value itself.

Usage Examples

Below is an example of how you can utilize single-quoted attribute values in your Go code:

import (
    "github.com/chasefleming/elem-go"
    "github.com/chasefleming/elem-go/attrs"
)

func main() {
    content := elem.Div(attrs.Props{
        "data-values": `'{"quantity": 5}'`,  // Single-quoted attribute value
    })

    html := content.Render()

    fmt.Println(html)
}

This code will produce the following HTML output:

<div data-values='{"quantity": 5}'></div>

🙏 Thanks to Contributors