I cannot recommend using a macro with undelimited-argument-syntax for producing multiline-verbatim-material:
The question of handling indentation of the source code will cause confusion because with verbatim-material indentation-spaces in the source-code are tokenizend and therefore show up as horizontal space/visible space in the output.
In order to exhibit some problems/weirdnesses the following example provides a macro \bigvrb—the option showspaces=true is applied so you can better see the treatment of spaces that are intended to be indentation for just making the source code more readable:
\RequirePackage{xparse}
\documentclass[a4paper]{article}
\usepackage{fancyvrb}
\usepackage{fvextra}
\NewDocumentCommand\bigvrb{}{%
\begingroup
\catcode\^^I=12 % %\endlinechar=^^M
\newlinechar=\endlinechar
\innerbigvrb
}%
\begingroup
\catcode\^^A=14\relax \catcode%=12\relax
\catcode\{=12\relax \catcode}=12\relax
\catcode\(=1\relax \catcode)=2\relax
\catcode\/=0\relax \catcode\=12\relax
/catcode`/^^M=12/relax^^A
/csname @firstofone/endcsname(^^A
/endgroup^^A
/NewDocumentCommand/innerbigvrb(+v)(^^A
/scantokens(^^A
\endgroup^^A
\begin{Verbatim}[showspaces=true, breaklines=true,numbers=left,breakafter=},breakbefore=\]^^M^^A
#1^^M^^A
\end{Verbatim}^^M%^^A
)^^A
)^^A
)%
\pagestyle{empty}
\parindent=0ex
\parskip=.25\baselineskip
\begin{document}
\enlargethispage{9cm}\vspace*{-4.5cm}%
\noindent\hrulefill
This looks okay:
\bigvrb{ABC
DEF}
\noindent\hrulefill
This has a visible comment-char and the spaces for indenting the code are visible also:
\bigvrb{%
ABC%
DEF%
}
\noindent\hrulefill
The spaces for indenting the code are visible. Besides this you have four
linebreaks \emph{inside} the verbatim-argument---the linebreak before the
first line (\verb| ABC|) and the linebreak after the last line
(\verb| DEF|) each yields an empty line:
\bigvrb{
ABC
DEF
}
\noindent\hrulefill
Even more spaces are used for indenting the code. They all are visible:
\begin{itemize}
\item Some text of an item of an \verb|itemize|-environment.
That item also contains a \verb|\bigvrb|-command whose
result is here:
\bigvrb{ABC
DEF}
\end{itemize}
\noindent\hrulefill
Now let's have fun creating two \verb|Verbatim|-environments in a weird way, keeping in mind that
curly braces must be balanced with \verb|\bigvrb|'s argument if not using delimiter-syntax:
\let\MyClosebrace=}
\bigvrb{First environment
\end{Verbatim}
\begin{Verbatim}[showspaces=true, breaklines=true, numbers=left, breakafter=\MyClosebrace, breakbefore=\]
Second environment}
\noindent\hrulefill
Now let's have fun creating two \verb|Verbatim|-environments in a weird way,
using delimiter-syntax---as verbatim-arg-delimiter \verb|>| is chosen:
\bigvrb>First environment
\end{Verbatim}
\begin{Verbatim}[showspaces=true, breaklines=true, numbers=left, breakafter=}, breakbefore=\]
Second environment>
\noindent\hrulefill
\textbf{Summa summarum:}
Undelimited-argument-syntax with multiline-verbatim-material is
confusing as
\begin{itemize}
\item you cannot have the usual code-indentation and linebreaking.
\item you cannot easily use the command \verb|\bigverb|
for verbatimized typesetting of the line \verb|\end{Verbatim}|.
\item you may need to take care of braces being balanced in
\verb|\bigvrb|'s argument if you don't use delimiter-syntax.
\end{itemize}
\end{document}

Of course \bigvrb of the example above is intended to obtain its argument by reading and tokenizing .tex-input after (temporarily) switching to verbatim-catcode-régime.
Therefore \bigvrb does not work in situations where it obtains its argument
- by having it passed as part of a macro-definition which got tokenized under non-verbatim-catcode-régime
- by having it passed from another macro during whose carrying-out the argument got tokenized under non-verbatim-catcode-régime
- by having it passed from a token-register via
\the-expansion when the content of that register was tokenized under non-verbatim-catcode-régime
- etc.
Using it as component of moving arguments might yield unexpected effects.
As a rule of thumb you can use \bigvrb within the text of the document but you cannot use it within macro-definitions/within the argument of other macros. Thus it is of very limited use only.
%and if all your braces will be balanced), then\detokenizecould work for you, with automatic line breaking. The%limitation can be overcome with a catcode change, but not the balanced brace requirement. – Steven B. Segletes Jul 20 '21 at 14:54\detokenizedoubles hashes and inserts spaces behind control-word-tokens. Besides this you may also need a catcode-change of the space-character and the horizontal-tab-character and the^as otherwise consecutive spaces collapse into a single space and^^-notation still works. Try, e.g.:\documentclass{article}\begin{document}\expandafter\texttt\expandafter{\detokenize{\TeX \TeX\TeX# A B^^JC}}\end{document}– Ulrich Diez Jul 20 '21 at 15:04\altdetokenizeat https://tex.stackexchange.com/questions/34580/escape-character-in-latex/593791#593791 can overcome a number of those issues. – Steven B. Segletes Jul 20 '21 at 15:18\futureletthe token after a space" a\romannumeral-expansion-based macro\StringifyNActis provided which applies\stringto each token of its argument and hereby takes brace-nesting into account. Perhaps a similar routine can be applied to a macro-argument that got tokenized while space and horizontal tab and carriage return and^had catcode 12. – Ulrich Diez Jul 20 '21 at 15:38