I have replaced the Verbatim environment to include a vbox and colorbox so that I can apply a background color to it. The problem is that now it does not split at the end of the page.
This is a minimal working code (working meaning that it compiles):
\documentclass[
a4paper,
]{article}
\usepackage{xcolor}
\usepackage{fvextra}
\definecolor{codebgcolor}{cmyk}{0,0.02,0.03,0}
% Note: redefining the Verbatim environment to have a background
% I used latexdef -E itemize and latexdef -E enumerate to
% discover the internal variables they use to control indentation.
% Then I used \leftmargin to know how much each indentation
% level indents, and added a negative horizontal spacing \hspace.
% ref: The definitions of LaTeX commands
% ref: https://tex.stackexchange.com/questions/62202/change-background-colour-of-verbatim-environment
\makeatletter
\let\oldv\Verbatim
\def\Verbatim{%
\setbox0\vbox\bgroup\oldv%
}
% == indented nested Verbatim ==
% ref: https://tex.stackexchange.com/questions/426736/addition-multiplication-of-parameter-and-constant-with-unit
\def\unindent{\hspace{-\dimexpr\leftmargin*(@itemdepth+@enumdepth)\relax}}
\let\oldendv\endVerbatim
\def\endVerbatim{%
\oldendv\egroup\fboxsep0pt \colorbox{codebgcolor}{%
\parbox{\linewidth}{%
\unindent\usebox0%
}%
}%
}
\makeatother
\begin{document}
\begin{itemize}
\item Something here:
\begin{Verbatim}[commandchars=\\\{\}, mathescape]
a a
a b
a c
a d
a e
a f
a g
a h
a i
a j
a k
a l
a m
a n
a o
a p
a q
a r
a s
a t
a u
a v
a w
a x
a y
b a
b b
b c
b d
b e
b f
b g
b h
b i
b j
b k
b l
b m
b n
b o
b p
b q
b r
b s
b t
b u
b v
b w
b x
b y
c a
c b
c c
c d
c e
c f
c g
c h
c i
c j
c k
c l
c m
c n
c o
c p
c q
c r
c s
c t
c u
c v
c w
c x
c y
\end{Verbatim}
\end{itemize}
\end{document}
I tried to follow the instructions in another question Breakable vboxes without success.
I really didn't understand what is \partialboxdim in the accepted answer, and how am I supposed to set it.
Also, I don't know how to use that with \setbox0\vbox\bgroup. I tried to replace it with \setbox\totalbox=\vbox\bgroup and then use it at the redefined endVerbatim replacing \usebox0 with \totalbox... but that didn't work. I don't know how to proceed with this.

\vboxand the later\parbox). – Donald Arseneau Jun 29 '20 at 21:47tcolorbox– egreg Jun 29 '20 at 22:13