From 50ba2caeb57ce85e2a5d09a2fd59c0477d3a87eb Mon Sep 17 00:00:00 2001
From: Dan Ramich <daniel@massdriver.cloud>
Date: Wed, 20 Sep 2023 11:57:39 -0600
Subject: [PATCH] Move newline to inside the DisableAutoGenTag block

Fixes https://github.com/spf13/cobra/issues/2029
---
 doc/md_docs.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/md_docs.go b/doc/md_docs.go
index c4a27c00..f243d47f 100644
--- a/doc/md_docs.go
+++ b/doc/md_docs.go
@@ -105,9 +105,9 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string)
 			link = strings.ReplaceAll(link, " ", "_")
 			buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
 		}
-		buf.WriteString("\n")
 	}
 	if !cmd.DisableAutoGenTag {
+		buf.WriteString("\n")
 		buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n")
 	}
 	_, err := buf.WriteTo(w)