I’ve noticed that recently MMD has added support for fenced code blocks, that’s nice!
I’ve a couple of questions:
1. Can I add a caption to the listing?
2. Can I create a label for it, to cross-reference the listing within the text?
When exporting to Latex, I use the following scheme:
A simple C example.
```c,caption=My first C program,label=src-hello-c
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
return 0;
}
```
where the code block is inserted in a `listings` environment (at least with `MultiMarkdown Composer`), and it has its own caption:
\begin{lstlisting}[language=c,caption==My first C program,label=src-hello-c]
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
return 0;
}
\end{lstlisting}
The problems are:
* I cannot figure out how to cross-reference the label within the text in MMD.
* `Listings` package is used only when exporting from `MMD Composer`. This is probably because I’ve installed MMD v4.2 on my system (and maybe `MMD Composer` uses a separate, newer MMD engine.
Any hints?
Thanks,
Giorgio