Files
expr/docgen
zeekay 3cfebaa7bd fix(go.mod): declare module path github.com/hanzoai/expr
Go 1.21+ rejects 'replace X => Y vN' when Y's go.mod declares a module
path other than Y. The prior v1.17.8 kept 'module github.com/expr-lang/expr'
while being hosted+required at github.com/hanzoai/expr, so consumers on
Go 1.26 fail with:

  module declares its path as: github.com/expr-lang/expr
          but was required as: github.com/hanzoai/expr

Rehome the declared module path to github.com/hanzoai/expr and repath all
internal imports to match. Consumers keep 'require github.com/expr-lang/expr'
and 'replace github.com/expr-lang/expr => github.com/hanzoai/expr vX' — the
standard renaming-fork pattern that Go's replace path-check accepts.
2026-06-30 20:12:29 -07:00
..
2020-03-27 15:25:51 +03:00
2023-12-03 21:53:01 +01:00

DocGen

This package provides documentation generator with JSON or Markdown output.

Usage

Create a file and put next code into it.

package main

import (
	"encoding/json"
	"fmt"
  
	"github.com/expr-lang/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:

package main

import "github.com/expr-lang/expr/docgen"

func main() {
	// TODO: Replace env with your own types.
	doc := docgen.CreateDoc(env)

	print(doc.Markdown())
}