# Minted doesn't break the line at the desired character

I'm writing a document using minted. I installed Python, pygmentize, everything works great. But there is a behaviour I don't understand. I want to break the text inside the minted environment at the character '|'. When I try to do it at

\begin{minted}[breaklines, breakafter=|]{python}
some_string = 'SomeTextThat|GoesOnAndOnForSoLong|ThatItCouldNeverFitOnOneLine'
\end{minted}


LaTeX breaks the line right after the second |. But with this piece of code instead

\begin{minted}[breaklines, breakafter=|]{bash}
tail -n 39 $target | awk '{print($NF" "$0)}' | sort -g -t@ -k2 | cut -f2- -d' ' > /tmp/\ /"$NEWFILE" #@15
\end{minted}


it doesn't work, breaking the line after the last space before going out of the box. Where do I go wrong?

The breakafter and breakbefore options allow specifying break locations in addition to spaces, rather than instead of spaces. You can disable spaces as break locations. One way to do this is to set spaces as visible and then define the space character as an (invisible) non-breaking space. You will probably also want to turn off pre-break symbols in a case like this (breakaftersymbolpre).
\begin{minted}[breaklines, breakafter=|, showspaces, space=~, breakaftersymbolpre={}]{bash}
tail -n 39 $target | awk '{print($NF" "$0)}' | sort -g -t@ -k2 | cut -f2- -d' ' > /tmp/\ /"$NEWFILE" #@15

• @RaffaelloCørsini You might try updating your packages. If you don't have a relatively recent minted and fvextra, this won't work. – G. Poore May 29 '18 at 20:30