walle / gimli

Utility for converting markup files to pdf files
https://github.com/walle/gimli
MIT License
538 stars 44 forks source link

No nice code boxes #61

Closed h8h closed 9 years ago

h8h commented 9 years ago

Hi,

I'm new to gimli and I'm trying to convert a simple md file to pdf. Everythings works fine except the code boxes. I think something with the css is broken on my system. I tried to download your provided style css and ran gimli with the parameter s gimli -f README.md -s style.css

My Output Readme.pdf differs from this Output deldycke and even differs from your examples.

With or without the parameter s, it makes no differences for the output.

What am I doing wrong? Is it possible to store the generated html file for debugging proposes?


I'm using arch linux and installed gimli via gem 2.2.2 with ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux] and wkhtmltopdf 0.9.6.

walle commented 9 years ago

Yes, you are correct, I've tested it and no code boxes appear. But it is not because of the styling, rather the code block detection.

I think the pdf you linked to was produced with an earlier version of gimli, which used pygmentize for code blocks. We have since changed to Coderay, to do all processing in ruby, instead of shelling out to python. There is no support for syntax highlighting in indented code blocks. Probably because I prefer the fenced code blocks. The implementation is at https://github.com/walle/gimli/blob/5c5692fd96b6873378789ea960bb48dda643eb09/lib/gimli/markup/code.rb#L18 and pull requests for finding indented code blocks are welcome.

So to get syntax highlighting I would suggest you use the fenced codeblocks e.g.

 ```ruby
    def foo(bar)
      puts bar
    end


And yes, there is the -d (debug) flag for outputing debug information to stdout, including the generated html.
h8h commented 9 years ago

I see. Syntax highlighting works. Thank you. Maybe I start a bit debugging first.