mandolyte / mdtopdf

Markdown to PDF
MIT License
126 stars 31 forks source link

Truncation of lines in long code blocks #7

Closed sirnewton01 closed 6 years ago

sirnewton01 commented 6 years ago

Try converting a markdown document with a wide line in the code block:

This line is really quite long, long and even more long so that the text reaches the edge of the page. More and more and more.

It is expected that either the text is wrapped or the code block font size adjusted to accommodate the width of the line.

Instead, the text goes outside of the edge of the grey code block box and gets truncated.

sirnewton01 commented 6 years ago

It's an interesting problem since it is expected that code blocks are meant to be largely uninterpreted. A work around is to manually wrap the lines. The HTML version accommodates using scroll bars, which don't work for obvious reasons with pdf/ps.

mandolyte commented 6 years ago

I could also try using MultiCell which will wrap, albeit in a simplistic fashion. But I may not used it for some other reason...

Making the font smaller will not always work, of course. And you can adjust the "backtick" Styler to make it smaller as a workaround. Manually wrapping can be done, but will look first into MultiCell since it will do this already.

Hopefully next week I'll have a solution.

sirnewton01 commented 6 years ago

Thanks, any of these sound fine to me. Yes, the font shrinking approach is overly simplistic. I was just trying to brainstorm a number of different approaches.

mandolyte commented 6 years ago

Was able to use multicell to wrap long lines.