jmaupetit / md2pdf

Markdown to PDF conversion tool
MIT License
268 stars 41 forks source link

Question: Is there a CSS option to keep new lines in code snippets? #74

Closed sarroutbi closed 5 months ago

sarroutbi commented 5 months ago

Hello. I am using m2pdf to create a PDF document from Markdown.

Original markdown document has a shell code snippet like:

$ operator-sdk run bundle --timeout 3m quay.io/sec-eng-special/tang-operator-bundle:v1.0.9
INFO[0008] Successfully created registry pod: quay-io-sec-eng-special-tang-operator-bundle-v1.0.9
...
INFO[0031] OLM has successfully installed "tang-operator.v1.0.9"

However, generated pdf does not keep newlines ... and the information is rendered like: image

Is there any CSS option for PDF output to keep new lines in code snippets?

Thanks !

jmaupetit commented 5 months ago

Which version do you run? Is your code snippet wrapped using the triple backquotes syntax?

sarroutbi commented 5 months ago

Which version do you run? I am running 1.0.1 version on Fedora 40

Is your code snippet wrapped using the triple backquotes syntax? Yes, it is. I have tried both, triple quotes with and without bash

jmaupetit commented 5 months ago

I haven't released it yet, but using the current main branch, activating the fenced-code-blocks extra should work:

md2pdf -e fenced-code-blocks input.md ouput.pdf
sarroutbi commented 5 months ago

I haven't released it yet, but using the current main branch, activating the fenced-code-blocks extra should work:

md2pdf -e fenced-code-blocks input.md ouput.pdf

Nice. Thanks for your help.