maragudk / maragudk/gomponents
JoinAttrs documentation seems to be still broken
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 59
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 17
Description
Hey, I was reading the code from the components package and couldn't figure out what JoinAttr actually do. Intelli sense showed me then doc info with the example:
// JoinAttrs with the given name only on the first level of the given nodes.
// This means that attributes on non-direct descendants are ignored.
// Attribute values are joined by spaces.
// Note that this renders all first-level attributes to check whether they should be processed.
func ExampleJoinAttrs() {
danceButton := myPrimaryButton("Dance")
_ = danceButton.Render(os.Stdout)
// Output: <div class="primary button">Dance</div>
}
The thing is, the example is missing at least the one function that can be find in the components_test.go:
func myPrimaryButton(text string) g.Node {
return myButton(Class("primary"), g.Text(text))
}
@markuswustenberg as a new user of the library I think the biggest hurdle at the beginning is the lack of straightforward documentation. Also I do think it can play a role while evaluating gomponents for a project as the official page is only a teaser of the library. Have you thought of addressing this in the past or in the future? If you plan something I could try to help.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components_test.go and inspect ExampleJoinAttrs alongside the myPrimaryButton helper shown in the issue. Update the example documentation so it includes the missing setup needed to understand and run it, then run the relevant Go example or package tests and confirm the documented output still matches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100