I want to insert pre-formatted text into html text, but the renderer insists on adding blank lines before and after the pre-formatted text. For example, this html code:
<html>
<body>
Before text
<pre>
Line 1: Pre-formatted text
Line 2: Pre-formatted text
</pre>
After text
</body>
</html>
results in this output:
Before textLine 1: Pre-formatted text Line 2: Pre-formatted textAfter text
Is there any way of getting rid of the leading and trailing blank lines? If I'd wanted them, I could have put them in myself!
There are many suggestions in the possible duplicates posted in the comments. The solution that works for me is to replace <pre>
with <pre style="margin:0">
, and to add <br>
outside the pre-formatted text to compensate as required.