diff --git a/doc/utils/converters/lammpsdoc/txt2rst.py b/doc/utils/converters/lammpsdoc/txt2rst.py
index 1bc279c0f30e48177948d508266b0cff071b196f..3576f721aba056c40c8fec82965451e9cd06dfd4 100755
--- a/doc/utils/converters/lammpsdoc/txt2rst.py
+++ b/doc/utils/converters/lammpsdoc/txt2rst.py
@@ -65,6 +65,7 @@ class RSTMarkup(Markup):
     def escape_rst_chars(self, text):
         text = text.replace('*', '\\*')
         text = text.replace('^', '\\^')
+        text = text.replace('|', '\\|')
         text = re.sub(r'([^"])_', r'\1\\_', text)
         return text
 
@@ -72,6 +73,7 @@ class RSTMarkup(Markup):
         text = text.replace('\\*', '*')
         text = text.replace('\\^', '^')
         text = text.replace('\\_', '_')
+        text = text.replace('\\|', '|')
         return text
 
     def inline_math(self, text):
diff --git a/doc/utils/converters/tests/test_txt2rst.py b/doc/utils/converters/tests/test_txt2rst.py
index 2fa2bd699ee7048c86e4563fe805826861574f3b..b662a24e3f0b0bdedd6280c681aeaef790d29191 100644
--- a/doc/utils/converters/tests/test_txt2rst.py
+++ b/doc/utils/converters/tests/test_txt2rst.py
@@ -81,6 +81,10 @@ class TestMarkup(unittest.TestCase):
         s = self.markup.convert("[*bold] and {italic*}")
         self.assertEqual("**\*bold** and *italic\**", s)
 
+    def test_escape_rst_characters(self):
+      s = self.markup.convert("[|bold|] and {|italic|}")
+      self.assertEqual("**\|bold\|** and *\|italic\|*", s)
+
     def test_escape_hat_character(self):
         s = self.markup.convert("x^2")
         self.assertEqual("x\^2", s)