diff --git a/README.md b/README.md index f6b7b63..ea07f2d 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ provides a more detailed description of what the parameters do. The first field is the filename of the generated vimdoc help file; the second is the description can you provide with this parameter. + Multi line description can be written using `\n`. + * **norules** By default, we generate horizontal rules above level 1-2 headings, as shown below: diff --git a/vimdoc.go b/vimdoc.go index aacfaa8..dabc282 100644 --- a/vimdoc.go +++ b/vimdoc.go @@ -373,7 +373,15 @@ func (v *vimDoc) NormalText(out *bytes.Buffer, text []byte) { // Header and footer func (v *vimDoc) DocumentHeader(out *bytes.Buffer) { if len(v.desc) > 0 { - v.writeSplitText(out, []byte(v.filename), []byte(v.desc), " ", 0) + parts := strings.Split(v.desc, "\\n") + for i, part := range parts { + if i == 0 { + v.writeSplitText(out, []byte(v.filename), []byte(part), " ", 0) + } else { + out.WriteString(part) + } + out.WriteString("\n") + } } else { out.WriteString(v.filename) out.WriteString("\n")