macdown
macdown copied to clipboard
Wrap text for code rendering
Noticed that code renderings do not wrap text and when exported to PDF, cuts off.
Some people may not want code blocks to wrap, or at least, not every time a document is printed.
I think there should be an option on each print job to allow the user to control whether it wraps or not, with a preference to set the default value of this option.
This issue has been addressed in MacDown 3000.
The fix implements @media print CSS that forces code blocks to wrap in PDF exports:
-
white-space: pre-wrapfor<pre>and<code>elements -
overflow-wrap: break-wordto prevent overflow - Special handling for tables containing code
Based on the approach from PR #1349 by @falkorichter.