Merge pull request #564 from thaJeztah/fix-yaml-examples

Fix leading characters being stripped from example sections in YAML
This commit is contained in:
Daniel Nephin 2018-02-16 11:22:24 -05:00 committed by GitHub
commit 847cc4bdc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -241,10 +241,10 @@ func parseMDContent(mdString string) (description string, examples string) {
parsedContent := strings.Split(mdString, "\n## ") parsedContent := strings.Split(mdString, "\n## ")
for _, s := range parsedContent { for _, s := range parsedContent {
if strings.Index(s, "Description") == 0 { if strings.Index(s, "Description") == 0 {
description = strings.Trim(s, "Description\n") description = strings.TrimSpace(strings.TrimPrefix(s, "Description"))
} }
if strings.Index(s, "Examples") == 0 { if strings.Index(s, "Examples") == 0 {
examples = strings.Trim(s, "Examples\n") examples = strings.TrimSpace(strings.TrimPrefix(s, "Examples"))
} }
} }
return description, examples return description, examples