diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdGenerateDocument.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdGenerateDocument.java
index 764351a4f5e2e..cab037faf8ffc 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdGenerateDocument.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdGenerateDocument.java
@@ -108,7 +108,7 @@ private void generateDocument(StringBuilder sb, String module, JCommander obj) {
sb.append("\n\n");
CmdBase cmdObj = (CmdBase) obj.getObjects().get(0);
cmdObj.jcommander.getCommands().forEach((subK, subV) -> {
- sb.append("\n\n## ").append(subK).append("\n\n");
+ sb.append("\n\n## ").append(subK).append("\n\n");
sb.append(cmdObj.getUsageFormatter().getCommandDescription(subK)).append("\n\n");
sb.append("**Command:**\n\n");
sb.append("```shell\n$ pulsar-admin ").append(module).append(" ")
diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java b/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
index a4deb4444601e..f41e53a80e7f3 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/util/CmdGenerateDocs.java
@@ -118,7 +118,7 @@ private String generateDocument(String module, JCommander commander) {
sb.append(" subcommand").append("\n```").append("\n\n");
cmdObj.getCommands().forEach((subK, subV) -> {
if (!subK.equals(name)) {
- sb.append("\n\n## ").append(subK).append("\n\n");
+ sb.append("\n\n## ").append(subK).append("\n\n");
String subDesc = cmdObj.getUsageFormatter().getCommandDescription(subK);
if (null != subDesc && !subDesc.isEmpty()) {
sb.append(subDesc).append("\n");