MCPcopy Create free account
hub / github.com/Unpackerr/unpackerr / makeDocs

Method makeDocs

init/config/docusaurus.go:82–111  ·  view source on GitHub ↗
(prefix string, section section)

Source from the content-addressed store, hash-verified

80}
81
82func (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
113const (
114 tableHeader = "|Config Name|Variable Name|Default / Note|\n|---|---|---|\n"

Callers 2

createDocusaurusFunction · 0.80
makeDefinedDocsMethod · 0.80

Calls 4

makeSectionMethod · 0.95
makeComposeMethod · 0.95
makeDocsTableMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected