MCPcopy Create free account
hub / github.com/algolia/cli / GenMdxTree

Function GenMdxTree

internal/docs/mdx.go:27–40  ·  view source on GitHub ↗
(cmd *cobra.Command, dir string)

Source from the content-addressed store, hash-verified

25}
26
27func GenMdxTree(cmd *cobra.Command, dir string) error {
28 tpl, err := template.New("mdx.tpl").Funcs(template.FuncMap{
29 "getExamples": func(cmd Command) []Example {
30 return cmd.ExamplesList()
31 },
32 "formatAlgoliaDocLinks": formatAlgoliaDocLinks,
33 "trimTrailingNewlines": trimTrailingNewlines,
34 }).Parse(mdxTemplate)
35 if err != nil {
36 return err
37 }
38
39 return writeMdxPageTree(tpl, dir, newMdxPage(describeCommand(cmd)))
40}
41
42func newMdxPage(cmd Command) mdxPage {
43 page := mdxPage{

Calls 4

writeMdxPageTreeFunction · 0.85
newMdxPageFunction · 0.85
describeCommandFunction · 0.85
ExamplesListMethod · 0.80