diff --git a/doc/utils/converters/lammpsdoc/lammps_filters.py b/doc/utils/converters/lammpsdoc/lammps_filters.py
index 2d2a00a4c7d62e45594e2a6cce01b72207825f53..11460185db56eed8d1b71e71f3b5ec4442c07f09 100644
--- a/doc/utils/converters/lammpsdoc/lammps_filters.py
+++ b/doc/utils/converters/lammpsdoc/lammps_filters.py
@@ -90,3 +90,24 @@ def promote_doc_keywords(content):
 
 def filter_multiple_horizontal_rules(content):
     return re.sub(r"----------[\s\n]+----------", '', content)
+
+
+def merge_preformatted_sections(content):
+    mergable_section_pattern = re.compile(r"\.\. parsed-literal::\n"
+                                          r"\n"
+                                          r"(?P<listingA>((   [^\n]+\n)|(^\n))+)\n\s*"
+                                          r"^\.\. parsed-literal::\n"
+                                          r"\n"
+                                          r"(?P<listingB>((   [^\n]+\n)|(^\n))+)\n", re.MULTILINE | re.DOTALL)
+
+    m = mergable_section_pattern.search(content)
+
+    while m:
+        content = mergable_section_pattern.sub(r".. parsed-literal::\n"
+                                            r"\n"
+                                            r"\g<listingA>"
+                                            r"\g<listingB>"
+                                            r"\n", content)
+        m = mergable_section_pattern.search(content)
+
+    return content
diff --git a/doc/utils/converters/lammpsdoc/txt2rst.py b/doc/utils/converters/lammpsdoc/txt2rst.py
index 5c371bcfdc4d5146cbfc237a4f10e8ea9dd0bd34..6949cb690eeccdf31e934c1d3d8798928d9eaaea 100755
--- a/doc/utils/converters/lammpsdoc/txt2rst.py
+++ b/doc/utils/converters/lammpsdoc/txt2rst.py
@@ -359,6 +359,7 @@ class Txt2Rst(TxtParser):
         self.document_filters.append(lammps_filters.detect_and_add_command_to_index)
         self.document_filters.append(lammps_filters.filter_multiple_horizontal_rules)
         self.document_filters.append(lammps_filters.promote_doc_keywords)
+        self.document_filters.append(lammps_filters.merge_preformatted_sections)
 
     def is_ignored_textblock_begin(self, line):
         return line.startswith('<!-- HTML_ONLY -->')