(prefix string, section section)
| 80 | } |
| 81 | |
| 82 | func (h *Header) makeDocs(prefix string, section section) string { |
| 83 | conf := h.makeSection(section, true, true) // Generate this portion of the config file. |
| 84 | env := h.makeCompose(prefix, true) // Generate this portion of the docker-compose example. |
| 85 | |
| 86 | buf := bytes.Buffer{} |
| 87 | buf.WriteString("## " + h.Title + "\n\n<details>\n <summary>Examples. Prefix: <b>" + prefix) |
| 88 | |
| 89 | if !h.NoHeader { |
| 90 | brace1, brace2 := "[", "]" |
| 91 | if h.Kind == list { |
| 92 | brace1, brace2 = "[[", "]]" |
| 93 | } |
| 94 | |
| 95 | buf.WriteString(h.Prefix + "</b>, Header: <b> ") // Add to the line above. |
| 96 | buf.WriteString(brace1 + string(section) + brace2) // Add to the line above. |
| 97 | } |
| 98 | |
| 99 | buf.WriteString("</b></summary>\n\n") // Add to the line above. |
| 100 | buf.WriteString("- Using the config file:\n\n```yaml\n") |
| 101 | buf.WriteString(strings.TrimSpace(conf) + "\n```\n\n") |
| 102 | buf.WriteString("- Using environment variables:\n\n```js\n") |
| 103 | buf.WriteString(env + "```\n\n</details>\n\n") |
| 104 | buf.WriteString(h.Docs + "\n" + h.makeDocsTable(prefix) + "\n" + h.Tail) |
| 105 | |
| 106 | if h.Notes != "" { // Notes become a sub header. |
| 107 | buf.WriteString("### Notes for " + h.Title + "\n\n" + h.Notes) |
| 108 | } |
| 109 | |
| 110 | return buf.String() |
| 111 | } |
| 112 | |
| 113 | const ( |
| 114 | tableHeader = "|Config Name|Variable Name|Default / Note|\n|---|---|---|\n" |
no test coverage detected