9

Consider the following code block:

~~~~{.Python .numberLines caption="test"}
def myfunction(var):
  """ Oh how awesome this is. """
  pass
~~~~

The code gets formatted correctly in the Pdf, but the caption does not appear. I also want to reference to the code block - but how? Can somebody give me a working example?

mre
  • 443

1 Answers1

15

Nevermind, I found a way to do it. I was using the builtin code highlighter.

Setting the --listings flag, I can switch to the lstlistings package and use the following syntax:

~~~~{caption="The preprocessing step" label=lstpreprocess}
def myfunction(var):
  """ Oh how awesome this is. """
  pass
~~~~

Pandoc is awesome.

mre
  • 443