about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeLines
...
* Update copyright year in licenseMarkus Wüstenberg2022-03-21-1/+1
|
* Use a test matrix with the last three stable Go versions (#96)Markus Wüstenberg2022-03-21-14/+21
|
* Add http.Adapt function (#92)Markus Wüstenberg2021-10-08-0/+156
| | | In the new package `http`, an `Adapt` function converts a `Handler` into a `http.HandlerFunc` from the `http` stdlib package.
* Test using Go 1.17 (#91)Markus Wüstenberg2021-10-06-6/+3
| | | Also set the new `-shuffle` flag when testing.
* Mark the assert test helpers as such (#90)Markus Wüstenberg2021-10-06-11/+14
| | | | | Using `t.Helper()`. Also move the assert package to be internal.
* Add loading and srcset HTML attributes (#86)Josep Jesus Bigorra Algaba2021-09-07-0/+10
| | | | | | | Useful for `img` and `picture` elements. Fixes #85. Co-authored-by: Josep Jesus Bigorra Algaba <josep@prowarehouse.nl>
* Add link to maragu.dk and golang.dk in readmeMarkus Wüstenberg2021-06-18-0/+2
|
* Add Github action status badge to readmeMarkus Wüstenberg2021-06-18-0/+1
|
* Add contributors fileMarkus Wüstenberg2021-06-18-0/+9
|
* Add video element and related attributes (#84)Markus Wüstenberg2021-06-18-15/+40
| | | Adds the `video` element and `loop`, `muted`, `playsinline`, `poster` attributes.
* Add javascript alert onclick handler to Raw example (#82)Markus Wüstenberg2021-06-09-2/+4
| | | Makes for fun XSS testing.
* Add examples in test files (#80)Markus Wüstenberg2021-06-08-13/+64
| | | These show up in godoc.
* Add LinkStylesheet and LinkPreload components (#79)Markus Wüstenberg2021-06-08-0/+27
| | | These are often used in the `<head>` part of the HTML.
* Escape Attr values (#77)Markus Wüstenberg2021-05-18-1/+15
| | | | | Because this can be a place of injection if untrusted data is passed, escape all attribute values. Fixes #74.
* Fix TailwindCSS CDN URL in example (#76)Markus Wüstenberg2021-05-11-4/+4
| | | | | The CSS style URLs from unpkg.com redirected to a different page, but the first request set a `Content-Type` header of `text/plain`. Using the direct URLs fixes this. Fixes #75. Thanks to @gedw99 for reporting.
* Update readme with content from website (#73)Markus Wüstenberg2021-05-07-8/+8
|
* Bump Go version to 1.16 in CI (#72)Markus Wüstenberg2021-05-07-9/+8
|
* Add more complex example using TailwindCSS (#71)Markus Wüstenberg2021-05-07-0/+125
|
* Add svg package and a few helpers (#67)Markus Wüstenberg2021-05-05-0/+101
| | | Introducing SVG, to inline vector graphics in your HTML! 🥳
* Fix code in readme (#69)Markus Wüstenberg2021-05-05-3/+3
| | | Broken in #66.
* Update license year (#68)Markus Wüstenberg2021-05-05-1/+1
|
* Streamline HTML element API (#66)Markus Wüstenberg2021-05-05-104/+92
| | | | | There were a lot of elements previously, like `Em`, `H1`, and a lot more, that took a string as the first argument previously. This was weird when you wanted to mix elements to output html like `<strong><em>…</em></strong>` or `<h1>Something <em>something</em> something</h1>`. gomponents is not an HTML validator, so I want people to be able to use elements however they please, also without text content. This also means that all elements now have the same API.
* Use g.If in HTML5 helper (#65)Markus Wüstenberg2021-04-28-9/+2
| | | Inlining looks much nicer.
* Return Node from all helpers instead of NodeFunc (#62)Markus Wüstenberg2021-01-07-122/+122
| | | | | This makes it clearer that the helpers return a `Node` of any kind, and that the type is not important. This also streamlines the API, as attribute helpers already return just `Node`.
* Add data- attribute helper (#61)Markus Wüstenberg2020-12-22-3/+16
| | | Fixes #49.
* Add test for InputHidden (#60)Markus Wüstenberg2020-12-22-0/+16
|
* Add aria-* and role attributes (#59)Markus Wüstenberg2020-12-22-0/+17
| | | Fixes #50.
* Add If helper function (#57)Markus Wüstenberg2020-12-22-3/+38
| | | Used to inline conditional nodes.
* Change main example to be the dot-import version (#56)Markus Wüstenberg2020-12-10-86/+43
|
* Simplify available elements (#55)Markus Wüstenberg2020-12-10-112/+67
| | | | | | | `a`, `form`, `img`, `input`, `label`, `option`, `progress`, `select`, and `textarea` are now just regular elements (without helper parameters), because: - Sometimes the use case doesn't fit (`a` as anchor without href, for example) - There's no reason these are special among the others, so streamlining them makes sense Also added new attributes `action`, `alt`, `for`, `method` that I had somehow missed.
* Rename Document to Doctype (#54)Markus Wüstenberg2020-12-10-12/+12
|
* Move elements and attributes into html package (#52)Markus Wüstenberg2020-12-10-933/+910
| | | | | This makes it easier to use dot-imports. Also updated the readme and examples with new usage, and move the `Classes` helper into the `components` package.
* Minor refactoring and comment changes (#51)Markus Wüstenberg2020-12-08-10/+9
|
* Add example with dot imports (#47)Markus Wüstenberg2020-11-17-0/+37
|
* Add svg element (#46)Markus Wüstenberg2020-11-16-0/+15
| | | | | Also add `cols` and `rows` attributes. Fixes #43.
* Add NodeType which replaces the Placer interface (#45)Markus Wüstenberg2020-11-16-32/+25
| | | The `Placer` interface was a weird interface that tried to abstract away nodes being elements or attributes, but it doesn't really make sense. Now `Nodes` just have a `NodeType`.
* Render correct HTML5 (#44)Markus Wüstenberg2020-11-16-72/+103
| | | | | | | | | Previously, elements of kind void and empty elements generally would be rendered auto-closing (with a final `/` character in the start tag), which is allowed sometimes but arguably wrong. See https://dev.w3.org/html5/spec-LC/syntax.html#end-tags This created problems with for example `textarea` and `script`, which cannot be auto-closing, or the browser renders it wrong. Also clarified in the docs that this library outputs HTML5. Fixes #42.
* Add package docs (#41)Markus Wüstenberg2020-11-02-0/+12
| | | Also update readme with features.
* Add Map function (#40)Markus Wüstenberg2020-11-02-6/+36
| | | `Map` makes it easier to build lists of elements without having to iterate.
* Render to Writer instead of string (#39)Markus Wüstenberg2020-11-02-115/+179
| | | | | | | The Render function has been changed to take a `Writer` instead of returning a string. This makes it possible to generate documents without having the whole content in memory. This also removes the `gomponents.Write` function, which is now redundant. Furthermore, the `el.Document` function has been changed to only take one child, as multiple children never make sense for it. (It's not even a child, more a sibling.)
* Remove fmt.Sprintf call in attribute Render (#38)Markus Wüstenberg2020-10-29-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just concatenating the strings is much faster. Before: ``` make benchmark go test -bench=. goos: darwin goarch: amd64 pkg: github.com/maragudk/gomponents BenchmarkAttr/boolean_attributes-8 8194791 139 ns/op BenchmarkAttr/name-value_attributes-8 5143292 229 ns/op PASS ok github.com/maragudk/gomponents 2.841s ``` After: ``` make benchmark go test -bench=. goos: darwin goarch: amd64 pkg: github.com/maragudk/gomponents BenchmarkAttr/boolean_attributes-8 16755404 67.0 ns/op BenchmarkAttr/name-value_attributes-8 10208625 116 ns/op PASS ok github.com/maragudk/gomponents 2.702s ```
* Pass attributes as pointers (#37)Markus Wüstenberg2020-10-29-5/+5
|
* Add HTML5 document template (#36)Markus Wüstenberg2020-10-29-0/+129
|
* Add attribute helpers (#35)Markus Wüstenberg2020-10-28-72/+243
| | | Also refactor tests to be table-driven, for readability.
* Add element helpers and refactor (#34)Markus Wüstenberg2020-10-28-487/+556
| | | | | | | This change adds a lot of element helpers, and refactors: - helpers into simple, text, and other helpers - most tests into table-driven tests, so they're easier to read Thanks to @oderwat for pushing me to improve the tests. 😉
* Add contributing instructions (#33)Markus Wüstenberg2020-10-23-0/+18
|
* Add br and hr element helpers (#30)Hans Raaf2020-10-23-0/+21
|
* Remove "fmt" import in readme example (#31)Hans Raaf2020-10-23-3/+6
| | | Also style menu in simple example slightly.
* Don't render or error on nil children (#32)Markus Wüstenberg2020-10-23-0/+8
| | | This makes it easier to e.g. conditionally skip a component for rendering.
* Add Group function to group Nodes (#29)Markus Wüstenberg2020-10-22-43/+78
|