pandoc-include-code
pandoc-include-code copied to clipboard
Code Not Included With GitHub Flavored Markdown (gfm)
Consider the following file hello.c
#include <stdio>
int main()
{
fprintf(stdout, "Hello World\n");
}
Consider the following markdown document sample.md
Sample Code
```{include=hello.c}
```
Build a PDF using
pandoc --toc \
--filter ~/.cabal/bin/pandoc-include-code \
-f gfm \
-o sample.pdf \
sample.md
Open the PDF and notice that the contents of hello.c was not included.
If you call it as follows:
pandoc --toc \
--filter ~/.cabal/bin/pandoc-include-code \
-f markdown \
-o sample.pdf \
sample.md
then the content of hello.c is included.
@bloudraak, I don’t think it’s a pandoc-include-code issue. Since gfm (GitHub Flavored Markdown) doesn’t allow attributes in curly braces, an extension is required. Try gfm+attributes. I can’t check it with a PDF engine, but it definetely works with AsciiDoc, HTML, OpenDocument Text, etc.
pandoc \
--toc \
--filter ~/.cabal/bin/pandoc-include-code \
-f gfm+attributes \
-o sample.html \
sample.md