Skip to content

Commit

Permalink
enhance: update param documents (milvus-io#35152)
Browse files Browse the repository at this point in the history
See: milvus-io#35161

---------

Signed-off-by: Ted Xu <[email protected]>
Signed-off-by: Sumit Dubey <[email protected]>
  • Loading branch information
tedxu authored and sumitd2 committed Aug 6, 2024
1 parent 291c5c7 commit fed5792
Show file tree
Hide file tree
Showing 6 changed files with 470 additions and 255 deletions.
16 changes: 9 additions & 7 deletions cmd/tools/config-docs-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ func (s Section) sectionPageContent() string {
ret += fmt.Sprintf("# %s-related Configurations"+mdNextLine, s.Name)
ret += s.descriptionContent() + mdNextLine
for _, field := range s.Fields {
if len(field.Description) == 0 || field.Description[0] == "" {
continue
}
ret += field.sectionPageContent() + mdNextLine
}

Expand Down Expand Up @@ -248,21 +251,20 @@ const fieldTableTemplate = `<table id="%s">
func (f Field) sectionPageContent() string {
ret := fmt.Sprintf("## `%s`", f.Name) + mdNextLine
desp := f.descriptionContent()
if len(desp) > 0 {
desp = "\n" + desp + " "
}
ret += fmt.Sprintf(fieldTableTemplate, f.Name, desp, f.DefaultValue)
return ret
}

func (f Field) descriptionContent() string {
var ret string
lines := len(f.Description)
for i, descLine := range f.Description {
ret += fmt.Sprintf(" <li>%s</li>", descLine)
if i < lines-1 {
ret += "\n"
if lines > 1 {
for _, descLine := range f.Description {
ret += fmt.Sprintf("\n <li>%s</li> ", descLine)
}
} else {
ret = fmt.Sprintf(" %s ", f.Description[0])
}

return ret
}
Loading

0 comments on commit fed5792

Please sign in to comment.