Merge pull request #4 from kristijanhusak/feature/multiline-description

Add support for multiline description.
This commit is contained in:
Alex Yatskov 2021-06-13 12:26:50 -07:00 committed by GitHub
commit 624f47911d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 The first field is the filename of the generated vimdoc help file; the second is the description can you provide
with this parameter. with this parameter.
Multi line description can be written using `\n`.
* **norules** * **norules**
By default, we generate horizontal rules above level 1-2 headings, as shown below: 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 // Header and footer
func (v *vimDoc) DocumentHeader(out *bytes.Buffer) { func (v *vimDoc) DocumentHeader(out *bytes.Buffer) {
if len(v.desc) > 0 { 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 { } else {
out.WriteString(v.filename) out.WriteString(v.filename)
out.WriteString("\n") out.WriteString("\n")