I'm in conflict with how mdframed
handles footnotes inside environments that span multiple pages. Consider this MWE
\documentclass{article}
\usepackage{lipsum}
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[%
hidealllines=true,
backgroundcolor=blue!10,
]{bluebox}
\begin{document}
\begin{bluebox}
\lipsum[1]
Here comes a footnote.\footnote{Footnote 1.}
\lipsum[2]
Here comes another footnote.\footnotemark
\lipsum[3-5]
\end{bluebox}
\footnotetext{Footnote 2.}
\end{document}
My preferred behavior would be for footnotes to appear inside the blue box, but with the same counting scheme (1, 2, 3, ...) as outside the environment and on the same page as the reference in the text. Any ideas how to implement this?