I am trying to highlight some code fragments inside a minted environment.
In my example I used a \colorbox to change the background of words. The problem is that all these words have a different heights and the colorboxes are not at the same level. Is there a way to adjust the colorbox that it has the same height for all characters?
Is there a better way to solve my problem?
\documentclass[a4paper,12pt]{scrreprt}
\usepackage[dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage[ngerman]{babel}
\usepackage[chapter, cache=false]{minted}
\setminted[python]{
frame=single,
framesep=2mm,
baselinestretch=1.2,
fontsize=\footnotesize,
linenos=true,
}
\begin{document}
\begin{listing}[ht]
\begin{minted}[escapeinside=||]{python}
print('test Test !,?/')
|\colorbox{green}{test}| |\colorbox{yellow}{Test}| |\colorbox{red}{!,?/}|
\end{minted}
\end{listing}
\end{document}

