github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/cmd/gen-kismatic-ref-docs/markdowntable.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  type markdownTable struct{}
     9  
    10  func (mt markdownTable) render(docs []doc) {
    11  	fmt.Println("| Property | Type | Required | Default Value | Allowed Value | Description |")
    12  	fmt.Println("|----------|------|----------|---------------|---------------|-------------|")
    13  	for _, d := range docs {
    14  		options := strings.Join(d.options, ",")
    15  		defaultVal := d.defaultValue
    16  		if defaultVal == "" {
    17  			defaultVal = " "
    18  		}
    19  		fmt.Printf("| `%s` | %s | %v | `%s` | %v | %s |\n", d.property, d.propertyType, d.required, defaultVal, options, d.description)
    20  	}
    21  }