diff --git a/mdit_py_plugins/dollarmath/index.py b/mdit_py_plugins/dollarmath/index.py
index 2663617..e2a4fed 100644
--- a/mdit_py_plugins/dollarmath/index.py
+++ b/mdit_py_plugins/dollarmath/index.py
@@ -13,6 +13,7 @@ def dollarmath_plugin(
     allow_labels: bool = True,
     allow_space: bool = True,
     allow_digits: bool = True,
+    allow_blank_lines: bool = True,
     double_inline: bool = False,
     label_normalizer: Optional[Callable[[str], str]] = None,
     renderer: Optional[Callable[[str, Dict[str, Any]], str]] = None,
@@ -30,6 +31,10 @@ def dollarmath_plugin(
     :param allow_digits: Parse inline math when there is a digit
         before/after the opening/closing ``$``, e.g. ``1$`` or ``$2``.
         This is useful when also using currency.
+    :param allow_blank_lines: Allow blank lines inside ``$$``. Note that blank lines are
+        not allowed in LaTeX, executablebooks/markdown-it-dollarmath, or the Github or
+        StackExchange markdown dialects. Hoever, they have special semantics if used
+        within Sphinx `..math` admonitions, so are allowed for backwards-compatibility.
     :param double_inline: Search for double-dollar math within inline contexts
     :param label_normalizer: Function to normalize the label,
         by default replaces whitespace with `-`
@@ -47,7 +52,9 @@ def dollarmath_plugin(
         math_inline_dollar(allow_space, allow_digits, double_inline),
     )
     md.block.ruler.before(
-        "fence", "math_block", math_block_dollar(allow_labels, label_normalizer)
+        "fence",
+        "math_block",
+        math_block_dollar(allow_labels, label_normalizer, allow_blank_lines),
     )
 
     # TODO the current render rules are really just for testing
@@ -246,6 +253,7 @@ DOLLAR_EQNO_REV = re.compile(r"^\s*\)([^)$\r\n]+?)\(\s*\${2}")
 def math_block_dollar(
     allow_labels: bool = True,
     label_normalizer: Optional[Callable[[str], str]] = None,
+    allow_blank_lines: bool = False,
 ) -> Callable[[StateBlock, int, int, bool], bool]:
     """Generate block dollar rule."""
 
@@ -299,15 +307,14 @@ def math_block_dollar(
                 start = state.bMarks[nextLine] + state.tShift[nextLine]
                 end = state.eMarks[nextLine]
 
-                if end - start < 2:
-                    continue
-
                 lineText = state.src[start:end]
 
                 if lineText.strip().endswith("$$"):
                     haveEndMarker = True
                     end = end - 2 - (len(lineText) - len(lineText.strip()))
                     break
+                if lineText.strip() == "" and not allow_blank_lines:
+                    break  # blank lines are not allowed within $$
 
                 # reverse the line and match
                 if allow_labels:

diff --git a/tests/fixtures/dollar_math.md b/tests/fixtures/dollar_math.md
index a1c2d43..c6554ec 100644
--- a/tests/fixtures/dollar_math.md
+++ b/tests/fixtures/dollar_math.md
@@ -226,6 +226,18 @@ b = 2
 </div>
 .
 
+display equation with blank lines. (valid=False)
+.
+$$
+1+1=2
+
+$$
+.
+<p>$$
+1+1=2</p>
+<p>$$</p>
+.
+
 equation followed by a labelled equation (valid=True)
 .
 $$
diff --git a/tests/test_dollarmath.py b/tests/test_dollarmath.py
index 62f52ef..6ae0345 100644
--- a/tests/test_dollarmath.py
+++ b/tests/test_dollarmath.py
@@ -92,7 +92,11 @@ def test_custom_renderer(data_regression):
 )
 def test_dollarmath_fixtures(line, title, input, expected):
     md = MarkdownIt("commonmark").use(
-        dollarmath_plugin, allow_space=False, allow_digits=False, double_inline=True
+        dollarmath_plugin,
+        allow_space=False,
+        allow_digits=False,
+        double_inline=True,
+        allow_blank_lines=False,
     )
     md.options.xhtmlOut = False
     text = md.render(input)

Do not allow blank lines within $$
See https://github.com/executablebooks/markdown-it-dollarmath/pull/8
tests/test_dollarmath.py::test_dollarmath_fixtures[1-single tests/test_dollarmath.py::test_dollarmath_fixtures[8-double-dollar-$$\n-<p>$$</p>\n] tests/test_dollarmath.py::test_dollarmath_fixtures[15-single tests/test_dollarmath.py::test_dollarmath_fixtures[22-inline tests/test_dollarmath.py::test_dollarmath_fixtures[29-simple tests/test_dollarmath.py::test_dollarmath_fixtures[36-simple tests/test_dollarmath.py::test_dollarmath_fixtures[43-equation tests/test_dollarmath.py::test_dollarmath_fixtures[50-use tests/test_dollarmath.py::test_dollarmath_fixtures[57-use tests/test_dollarmath.py::test_dollarmath_fixtures[64-inline tests/test_dollarmath.py::test_dollarmath_fixtures[71-inline tests/test_dollarmath.py::test_dollarmath_fixtures[78-inline tests/test_dollarmath.py::test_dollarmath_fixtures[85-exponentiation tests/test_dollarmath.py::test_dollarmath_fixtures[92-conjugate tests/test_dollarmath.py::test_dollarmath_fixtures[99-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[108-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[118-single tests/test_dollarmath.py::test_dollarmath_fixtures[127-display tests/test_dollarmath.py::test_dollarmath_fixtures[136-display tests/test_dollarmath.py::test_dollarmath_fixtures[146-inline tests/test_dollarmath.py::test_dollarmath_fixtures[158-underline tests/test_dollarmath.py::test_dollarmath_fixtures[168-after tests/test_dollarmath.py::test_dollarmath_fixtures[179-following tests/test_dollarmath.py::test_dollarmath_fixtures[186-consecutive tests/test_dollarmath.py::test_dollarmath_fixtures[193-inline tests/test_dollarmath.py::test_dollarmath_fixtures[200-display tests/test_dollarmath.py::test_dollarmath_fixtures[211-multiple tests/test_dollarmath.py::test_dollarmath_fixtures[229-display tests/test_dollarmath.py::test_dollarmath_fixtures[241-equation tests/test_dollarmath.py::test_dollarmath_fixtures[260-multiline tests/test_dollarmath.py::test_dollarmath_fixtures[275-vector tests/test_dollarmath.py::test_dollarmath_fixtures[288-display tests/test_dollarmath.py::test_dollarmath_fixtures[298-inline tests/test_dollarmath.py::test_dollarmath_fixtures[305-equation tests/test_dollarmath.py::test_dollarmath_fixtures[319-numbered tests/test_dollarmath.py::test_dollarmath_fixtures[334-Equations tests/test_dollarmath.py::test_dollarmath_fixtures[350-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[357-Sum tests/test_dollarmath.py::test_dollarmath_fixtures[366-Sum tests/test_dollarmath.py::test_dollarmath_fixtures[376-equation tests/test_dollarmath.py::test_dollarmath_fixtures[390-inline tests/test_dollarmath.py::test_dollarmath_fixtures[403-display tests/test_dollarmath.py::test_dollarmath_fixtures[421-mixed tests/test_dollarmath.py::test_dollarmath_fixtures[441-dollar tests/test_dollarmath.py::test_dollarmath_fixtures[450-empty tests/test_dollarmath.py::test_dollarmath_fixtures[460-or tests/test_dollarmath.py::test_dollarmath_fixtures[471-new tests/test_dollarmath.py::test_dollarmath_fixtures[480-math-escaping: tests/test_dollarmath.py::test_dollarmath_fixtures[487-math-escaping: tests/test_dollarmath.py::test_dollarmath_fixtures[494-math-escaping: tests/test_dollarmath.py::test_dollarmath_fixtures[501-math-escaping: tests/test_dollarmath.py::test_dollarmath_fixtures[508-math-escaping: tests/test_dollarmath.py::test_dollarmath_fixtures[515-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[522-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[529-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[536-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[543-Inline tests/test_dollarmath.py::test_dollarmath_fixtures[556-display
tests/test_dollarmath.py::test_inline_func tests/test_dollarmath.py::test_block_func tests/test_dollarmath.py::test_plugin_parse tests/test_dollarmath.py::test_custom_renderer