Pandoc: Unable to syntax-highlight the entire file?

Created on 8 Sep 2019  路  5Comments  路  Source: jgm/pandoc

pandoc seems to understand a ton of programming languages (as evidenced by the output of pandoc --list-highlight-languages) - but I've been unable to "highlight" the entire file.

What I'm trying to do is something like

$ pandoc -s -t latex -o t.tex t.c

but it doesn't come out syntax-highlighted - at best it packs my source code into verbatim.

  • Pandoc 2.7.3
  • macOS 10.14.6
  • MacTeX 2019
  • Cabal 3.0.0.0
  • Stack 2.1.3

Most helpful comment

Another option is to use the skylighting executable provided with the skylighting package.

All 5 comments

Save 1.md with contents:

```c

Save 2.md with contents:

```

Then:

pandoc -s -o t.tex 1.md t.c 2.md

See also https://pandoc.org/MANUAL.html#syntax-highlighting

Or you can use a filter like the following: https://github.com/owickstrom/pandoc-include-code

For future questions, please use the pandoc-discuss mailing list instead of this issue tracker. Thanks!

Another option is to use the skylighting executable provided with the skylighting package.

$ cabal install skylighting
. . . . .
Haddock      skylighting-0.8.2 (lib)
Installing   skylighting-0.8.2 (lib)
Completed    skylighting-0.8.2 (lib)
Warning: You asked to install executables, but there are no executables in
target: skylighting. Perhaps you want to use --lib to install libraries
instead.

see https://github.com/jgm/skylighting#installing

Thank you, very helpful. Following the guidance (added -fexecutable to Cabal invocation), it works now!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phyllisstein picture phyllisstein  路  84Comments

elliottslaughter picture elliottslaughter  路  44Comments

jgm picture jgm  路  266Comments

dashed picture dashed  路  107Comments

jgm picture jgm  路  117Comments