diff --git a/blog.py b/blog.py
index 225cb87ca..9a620d5a1 100644
--- a/blog.py
+++ b/blog.py
@@ -232,6 +232,18 @@ def html_blog_post_markdown(content: str) -> str:
new_content2 += section
ctr += 1
new_content = new_content2
+
+ if new_content == content:
+ return new_content
+
+ # remove extra newlines after header
+ for _, html_header in replacements.items():
+ if '' + html_header + '>
' in new_content:
+ new_content = new_content.replace('' + html_header + '>
',
+ '' + html_header + '>')
+ elif '' + html_header + '>
' in new_content:
+ new_content = new_content.replace('' + html_header + '>
',
+ '' + html_header + '>')
return new_content