Skip to content

Commit

Permalink
doc: improve examples readme
Browse files Browse the repository at this point in the history
  • Loading branch information
g4s8 authored Feb 1, 2024
1 parent 4069b93 commit 75e50f6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions _examples/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Examples

There are few target files:
- [`config.go`](./config.go) has a simple type `Config` with a few documented fields. It has
`go:generate` directives to call `envdoc` with different params to build
documentation in different formats: [`config.md`](./config.md), [`config.html`](./config.html) and [`config.txt`](./config.txt).
- [`complex.go`](./complex.go) has multiple types, and this file tries to cover all possible cases
of field tags and type comments. Also, it has more `go:generate` directives to
produce documentation not only in different formats but it uses different options
for `envdoc`, e.g. there you can find `-no-styles` and `-env-prefix` options: [`complex.md`](./complex.md), [`complex.html`](./complex.html),
[`complex.txt`](./complex.txt) for default markdown, HTML and text documentation files; [`x_complex.md`](./x_complex.md) with
envprefix parameter; [`complex-nostyle.html`](./complex-nostyle.html) is HTML documentation without built-in styles.
- [`envprefix.go`](./envprefix.go) has nested config structure with `envPrefix` tag for structure field. It generates [`envprefix.md`](./envprefix.md).
- [`config.go`](./config.go) contains a simple type `Config` with several documented fields. It includes
`go:generate` directives to call `envdoc` with different params, creating
documentation in various formats: [`config.md`](./config.md), [`config.html`](./config.html) and [`config.txt`](./config.txt).
- [`complex.go`](./complex.go) features multiple types, covering a broad range of field tags and type comments.
Additionally, it includes more `go:generate` directives to
produce documentation in not only different formats but also using various options
for `envdoc`. For instance, options such as `-no-styles` and `-env-prefix` are utilized here. The outputs include [`complex.md`](./complex.md),
[`complex.html`](./complex.html) and [`complex.txt`](./complex.txt) for standard markdown, HTML and text documentation, respectively;
[`x_complex.md`](./x_complex.md) with `-env-prefix` argument;
and [`complex-nostyle.html`](./complex-nostyle.html) which is HTML documentation without built-in styles.
- [`envprefix.go`](./envprefix.go) showcases a nested config structure with the `envPrefix` tag for a structure field.
It generates [`envprefix.md`](./envprefix.md).

The examples dir has helper script files as well:
- `build-examples.sh` - you can modify any example go file and regenerate all documentation outputs by running it via `./build-examples.sh`.
The examples directory also contains helper script files:
- `build-examples.sh` - modify any example Go file and regenerate all documentation outputs by executing it via `./build-examples.sh`.
- `clean.sh` - removes all documentation files.

0 comments on commit 75e50f6

Please sign in to comment.