Skip to content

Commit

Permalink
fix: don't code format empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
matty-rose committed Oct 24, 2021
1 parent 32ef8cc commit 3ff5f77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/document/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,9 @@ func (m MarkdownDocument) CreateLink(title, url string) string {
}

func (m MarkdownDocument) FormatCode(text string) string {
if text == "" {
return text
}

return fmt.Sprintf("`%s`", text)
}
4 changes: 2 additions & 2 deletions pkg/generator/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ also test
| Name | Description | Required | Default |
| --- | --- | --- | --- |
| a | a | false | ` + "`a`" + ` |
| b | b | true | ` + "``" + ` |
| b | b | true | |
## Outputs
No outputs.
Expand Down Expand Up @@ -257,7 +257,7 @@ also test
| Name | Description | Required | Default |
| --- | --- | --- | --- |
| a | a | false | ` + "`a`" + ` |
| b | b | true | ` + "``" + ` |
| b | b | true | |
## Outputs
| Name | Description | Value |
Expand Down

0 comments on commit 3ff5f77

Please sign in to comment.