1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
# DocGen
This package provides documentation generator with JSON or Markdown output.
## Usage
Create a file and put next code into it.
```go
package main
import (
"encoding/json"
"fmt"
"github.com/antonmedv/expr/docgen"
)
func main() {
// TODO: Replace env with your own types.
doc := docgen.CreateDoc(env)
buf, err := json.MarshalIndent(doc, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(buf))
}
```
Run `go run your_file.go`. Documentation will be printed in JSON format.
## Markdown
To generate markdown documentation:
```go
package main
import "github.com/antonmedv/expr/docgen"
func main() {
// TODO: Replace env with your own types.
doc := docgen.CreateDoc(env)
print(doc.Markdown())
}
```
|