princjef / gomarkdoc

Generate markdown documentation for Go (golang) code
MIT License
380 stars 60 forks source link

Multiple newlines are generated during templates processing #74

Closed dmvolod closed 1 year ago

dmvolod commented 2 years ago

There are multiple newlines are generated during templates processing which is known behaviour, i.e.

func (h *Client) IsReleaseInstalled(...) (bool, error)

Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)

<!-- gomarkdoc:embed:end -->

But multiple empty lines for the .md files are interpreting as a single one.
As we can control the output from the template we could probably add following postprocessing at the end of the template or whole *.md file processing

regexp.MustCompile(`[\r\n]{2,}`).ReplaceAllString(result.String(), "\n\n")