Consider this example:
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\begin{document}
line1
line2
\begin{tikzpicture}
\draw (0, 0) -- (2, 2);
\end{tikzpicture}
\end{document}
In the output everything is on one line:
How to have a new line in standalone?

