about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarkus Wüstenberg2023-05-11 10:08:27 +0200
committerGitHub2023-05-11 10:08:27 +0200
commit4f9709afcc83b617f17f8e5757d58a55be7bf2cf (patch)
tree3b14ce4e547f5195f97f6e12333d5927c9b481f0
parentb638b8b078ffedc76513aac30152ce36f2072814 (diff)
parentc129ae8da154e1f6ef325ac85ca4d2736547c7cd (diff)
downloadgomponents-4f9709afcc83b617f17f8e5757d58a55be7bf2cf.tar.lz
gomponents-4f9709afcc83b617f17f8e5757d58a55be7bf2cf.tar.zst
gomponents-4f9709afcc83b617f17f8e5757d58a55be7bf2cf.zip
Document Text/Textf helpers better (#135)
Both in the readme and package doc.

Fixes #133.
-rw-r--r--README.md6
-rw-r--r--gomponents.go4
2 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index 1ebcd51..bf4a6f6 100644
--- a/README.md
+++ b/README.md
@@ -25,14 +25,16 @@ Made in 🇩🇰 by [maragu](https://www.maragu.dk), maker of [online Go courses
   - Auto-completion
   - Nice formatting with `gofmt`
 - Simple API that's easy to learn and use (you know most already if you know HTML)
+- Useful helpers like `Text` and `Textf` that insert HTML-escaped text, `Map` for mapping data to components,
+  and `If` for conditional rendering.
 - No external dependencies
 
 ## Usage
 
 Get the library using `go get`:
 
-```shell script
-go get -u github.com/maragudk/gomponents
+```shell
+go get github.com/maragudk/gomponents
 ```
 
 The preferred way to use gomponents is with so-called dot-imports (note the dot before the `gomponents/html` import),
diff --git a/gomponents.go b/gomponents.go
index 9f86538..7b73a3b 100644
--- a/gomponents.go
+++ b/gomponents.go
@@ -4,8 +4,8 @@
 // to the given writer as a string.
 //
 // All DOM elements and attributes can be created by using the El and Attr functions.
-// The functions Text, Textf, Raw, and Rawf can be used to create text nodes.
-// See also helper functions Group, Map, and If.
+// The functions Text, Textf, Raw, and Rawf can be used to create text nodes, either HTML-escaped or unescaped.
+// See also helper functions Group, Map, and If for mapping data to Nodes and inserting them conditionally.
 //
 // For basic HTML elements and attributes, see the package html.
 // For higher-level HTML components, see the package components.