Search code examples
restructuredtextrst2pdf

How to enforce line wrapping in code-block in rst2pdf?


I have some generated reStructuredText that has code blocks with long lines. Is there a way to enforce line breaks just like normal lines (not in blocks) are wrapped?

Here's an example where rst2pdf reduces the font size of the block to make the whole line fit on the pdf page:

.. code-block::
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris

enter image description here


Solution

  • I don't think rst2pdf has a way to break those lines - because it's a code block, it won't adjust anything. You could try applying a different (non-literal) style instead, and setting that up to do what you wanted.