diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 06de14672..420392282 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -300,6 +300,7 @@ OUTER_LOOP:
 
 		case html.EndTagToken:
 			if len(startTags) == 0 {
+				buf.WriteString(token.String())
 				break
 			}