Help:Line-break handling: Difference between revisions

Content deleted Content added
<nowiki>: Improved markup of demos; updated
Causing line breaks: Made pre its own section
Line 86:
Enfolding sunny spots of greenery.
</poem>
}}
 
=== &lt;pre> ===
 
{{xtag|pre|p}} and its alternatives are typically used for code, and display their contents in [[monospace]] font with a frame and different background colour. Both markup and newlines within {{tag|pre}} are reproduced verbatim. However, first newline after {{tag|pre|o}} and last newline before {{tag|pre|c}} are also ignored, allowing the tags to be placed on their own lines without extra empty lines appearing in the output.
{{markupv
m=<nowiki><pre>
{{2x|foo}}<br />bar
[[wiki]]
</pre></nowiki>
r=<pre>
{{2x|foo}}<br />bar
[[wiki]]
</pre>
}}
 
The alternatives <nowiki><pre<includeonly></includeonly>></nowiki> and {{tl|pre}} allow markup to be evaluated while still preserving newlines.
{{markupv
|
m=<nowiki>{{Pre |
{{2x|foo}}<br />bar
[[wiki]]
}}</nowiki>
|
r={{Pre |
{{2x|foo}}<br />bar
[[wiki]]
}}
}}
 
Line 157 ⟶ 187:
}}
 
'''Solution 3''': ToConsider displayusing the text in monospace with a frame and different background color, use {{xtag[[#&lt;pre>|&lt;pre|p}}>]] instead of {{tag|nowiki}}. The first newline after {{tag|pre|o}} and the last newline before {{tag|pre|c}} are ignored.
{{markupv
m=<nowiki><pre>
{{2x|foo}}<br />bar
[[wiki]]
</pre></nowiki>
r=<pre>
{{2x|foo}}<br />bar
[[wiki]]
</pre>
}}
 
=== Lists ===