MCPcopy Index your code
hub / github.com/cortexproject/cortex / generateBlockMarkdown

Function generateBlockMarkdown

tools/doc-generator/main.go:284–315  ·  view source on GitHub ↗
(blocks []*configBlock, blockName, fieldName string)

Source from the content-addressed store, hash-verified

282}
283
284func generateBlockMarkdown(blocks []*configBlock, blockName, fieldName string) string {
285 // Look for the requested block.
286 for _, block := range blocks {
287 if block.name != blockName {
288 continue
289 }
290
291 md := &markdownWriter{}
292
293 // Wrap the root block with another block, so that we can show the name of the
294 // root field containing the block specs.
295 md.writeConfigBlock(&configBlock{
296 name: blockName,
297 desc: block.desc,
298 entries: []*configEntry{
299 {
300 kind: "block",
301 name: fieldName,
302 required: true,
303 block: block,
304 blockDesc: "",
305 root: false,
306 },
307 },
308 })
309
310 return md.string()
311 }
312
313 // If the block has not been found, we return an empty string.
314 return ""
315}
316
317func generateJSONSchemaMain(outputFile string) {
318 // Create a Cortex config instance

Callers 1

mainFunction · 0.85

Calls 2

writeConfigBlockMethod · 0.95
stringMethod · 0.95

Tested by

no test coverage detected