1
Fork 0

Add support for multiline description.

This commit is contained in:
Kristijan Husak 2021-06-13 21:04:53 +02:00
parent 9f1dd8eaa4
commit e31c32b657
2 changed files with 11 additions and 1 deletions

View File

@ -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:

View File

@ -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")