`shortvrb`'s `\MakeShortVerb` allows defining single active tokens, e.g. `|`, in a way that makes `|\foo|` equivalent to `\verb|\foo|`. To do this, `|` is defined to expand to `\verb|` and added to both `\dospecials` and `\@sanitize`. Internally, `\MakeShortVerb\|` expands to `\def\@shortvrbdef{\verb}\@MakeShortVerb\|` and `\@shortvrbdef` is later used to set the expansion of `|`.

I want to use the same mechanism but with `minted`. In order to use the `minted` macro `\code` (as defined in the MWE below) insead of `\verb`, I defined

```latex
\def\MakeShortCode{\def\@shortvrbdef{\code}\@MakeShortVerb}

```

However, I get the error

```
! Paragraph ended before \minted@inline@ii was complete.

```

when using the shorthand. If I manually define

```latex
\def|{\code|}

```

the shorthand works fine. Inspection of the definition of `|` in both cases shows that they are indeed identical, so the only difference should be the registration of `|` in `\dospecials` and `\@sanitize`.

Why exactly does this error occur? How can I get around this without braking e.g. the `verbatim` environment? Is this a bug in `minted` or is there a good reason for this behavior?

---

```latex
\documentclass{article}

\usepackage{xparse}
\usepackage{minted}
\usepackage{shortvrb}

\newmintinline[code]{latex}{}

\makeatletter
  \def\MakeShortCode{\def\@shortvrbdef{\code}\@MakeShortVerb}
  \def\MakeShortLstinline{\def\@shortvrbdef{\lstinline}\@MakeShortVerb}
\makeatother

\ExplSyntaxOn
  \NewDocumentCommand\decompose{ m }
    {
      {
        \ttfamily
        \tl_analysis_map_inline:Nn #1 
          {
            \exp_last_unbraced:No \token_to_str:N { ##1 }
            \ensuremath { \sb {##3} }
          }
      }
    }
\ExplSyntaxOff

\begin{document}

\catcode`\|=\active

\def|{\code|}
|\foo|

\decompose|

\MakeShortCode\|
%|\foo| % This will cause an error.

\decompose|

\end{document}

```