-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add newline check for mdox-exec
output
#68
Conversation
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
pkg/mdformatter/mdgen/mdgen.go
Outdated
return b.Bytes(), nil | ||
output := b.Bytes() | ||
// Add newline to output if not present. | ||
if !bytes.HasSuffix(output, []byte("\n")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !bytes.HasSuffix(output, []byte("\n")) { | |
if !bytes.HasSuffix(output, newLineChar) { |
.. to not creat slice every time? (micro-optimization, but also readability) and I think we already have newLineChar somewhere 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
This PR adds a check to ensure
mdgen
output for a command always has a new line at the end so that there are no surprising formatting issues. Test case added. Fixes #67.