I am using the development version (1.9d) of the mdframed package to customize the proof environment in the following way. I wish that a line runs down from the word "Proof." and that the text of the proof is indented accordingly. To do that, I used a mdframed environment with only the left edge visible and a negative top margin (see MWE below). However, when a page break is needed, the environment starts on a new page every time.
The situation is very similar to Split mdframed environment occasionally skips page and mdframed does not split correctly between pages. However, the first question provides only a solution when the "overhead text" is obtained with Tikz, and the solution provided in the second (using skipabove) does not seem to work in my case.
I have toyed with the options skipabove, splitbottomskip, splittopskip, and adding more spaces with beforebreak, without success.
Here is a minimal working example:
\documentclass{memoir}
\usepackage[english]{babel}
\usepackage{amsfonts,lipsum, mdframed}
\newmdenv[hidealllines=true,leftline=true,linewidth=1.5pt,innerleftmargin = 10pt,
innertopmargin=-1.1\baselineskip]{np}
\newenvironment{niceproof}{
\hangindent5pt\hangafter0
\begin{np}\hspace{-15pt}\textit{Proof.}~}
{\hfill$\square$\end{np}}
\begin{document}
If it fits in one page, everything works as intended.
\begin{niceproof}
\lipsum[1-4]
\end{niceproof}
\clearpage{}
But if we add a little more text, it starts on the next page
(even though the box is cut in two properly):
\begin{niceproof}
\lipsum[1-5]
\end{niceproof}
\end{document}
If this way of customizing the proof environment is not recommended, I am open to any alternative suggestions. In particular, I would be glad if such a result is possible by using only a newmdenv.
Edit: result after compilation of the MWE. As you can see, the first Proof environment displays properly, but the second skips a page before displaying, although the break is good (I did not show page 4, which contains the rest of the Lorem Ipsum).
result after compilation of the MWE http://www.latp.univ-mrs.fr/~hellouin/Capture.png