title: Markdown and references inside the listing captions
body: <p>Is it possible to process the text markdown for the listing captions in pandoc?</p>
  
  <p>Pandoc works well for figure captions and translates the <em>emphasis</em> and <code>inline code</code>, but apparently fails to do so in listing captions.
  For example, in the code below, I have some formatting and reference in the captions for the second listing and the figure.
  However, only the formatting in the figure is correctly transformed into latex.
  The listing caption is left as it is, which breaks the tex processer later in the pipeline.</p>
  
  <p>Is it possible to process the listing captions just like the figure captions?</p>
  
  <hr>
  
  <pre><code>    ```{#lst:first .C caption="Hi"}
      int hi() {
          return ((int)'h'&lt;&lt;8) | 'i';
      }
      ```
  
      ```{#lst:second .C caption="Code *using* the function `hi` from [@lst:first]"}
      x = hi();
      ```
  
      ![Picture *with* `inline code` and reference [@lst:first]](picture.png)
  </code></pre>
  
  <blockquote>
    <p>pandoc example.so.md -o example.so.tex --listings --filter=pandoc-crossref</p>
  </blockquote>
  
  <p>Produces:</p>
  
  <pre><code>\begin{codelisting}
  
  \caption{Hi}
  
  \begin{lstlisting}[language=C, caption=Hi, label=lst:first]
  int hi() {
      return ((int)'h'&lt;&lt;8) | 'i';
  }
  \end{lstlisting}
  
  \end{codelisting}
  
  \begin{codelisting}
  
  \caption{Code *using* the function `hi` from {[}@lst:first{]}}
  
  \begin{lstlisting}[language=C, caption={Code *using* the function `hi` from [@lst:first]}, label=lst:second]
  x = hi();
  \end{lstlisting}
  
  \end{codelisting}
  
  \begin{figure}
  \centering
  \includegraphics{picture.png}
  \caption{Picture \emph{with} \passthrough{\lstinline!inline code!} and
  reference lst.~\ref{lst:first}}
  \end{figure}
  </code></pre>
  
  <hr>
  
  <p>I use pandoc 2.7.3 and pandoc-crossref v0.3.4.1</p>
  
  <p>P.S. as <a href="https://github.com/jgm/pandoc/issues/673" rel="nofollow noreferrer">https://github.com/jgm/pandoc/issues/673</a> suggests, there may still be no native support for this. Is there a workaround?</p>