MCPcopy
hub / github.com/tinyauthapp/tinyauth / compileMd

Function compileMd

gen/gen_md.go:104–128  ·  view source on GitHub ↗
(entries []MarkdownEntry)

Source from the content-addressed store, hash-verified

102}
103
104func compileMd(entries []MarkdownEntry) []byte {
105 buffer := bytes.Buffer{}
106
107 buffer.WriteString("<!--- This file is automatically generated by gen/gen_md.go. Do not edit manually. --->\n\n")
108 buffer.WriteString("# Tinyauth configuration reference\n\n")
109 buffer.WriteString("| Environment | Flag | Description | Default |\n")
110 buffer.WriteString("| - | - | - | - |\n")
111
112 previousSection := ""
113
114 for _, entry := range entries {
115 if strings.Count(entry.Env, "_") > 1 {
116 section := strings.Split(strings.TrimPrefix(entry.Env, "TINYAUTH_"), "_")[0]
117 if section != previousSection {
118 buffer.WriteString("\n## " + strings.ToLower(section) + "\n\n")
119 buffer.WriteString("| Environment | Flag | Description | Default |\n")
120 buffer.WriteString("| - | - | - | - |\n")
121 previousSection = section
122 }
123 }
124 fmt.Fprintf(&buffer, "| `%s` | `%s` | %s | %s |\n", entry.Env, entry.Flag, entry.Description, entry.Default)
125 }
126
127 return buffer.Bytes()
128}

Callers 1

generateMarkdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected