Help:Line-break handling: Difference between revisions

Content deleted Content added
 
(18 intermediate revisions by 9 users not shown)
Line 9:
 
===Newlines===
{{see|Wikipedia:Don'tLine usebreaks line breaksusage|Wikipedia:Manual of Style#Controlling line breaks}}
 
{{shortcut|H:PARAGRAPH}}
{{see|Wikipedia:Don't use line breaks|Wikipedia:Manual of Style#Controlling line breaks}}
There are several ways to force [[newline|line breaks]] and [[hard return|paragraph breaks]] in the text. The simplest method is by inserting newlines; for example:
 
Line 36:
}}
 
=== <br /> or <br> ===
{{shortcut|H:BR}}{{anchor|<br> or <br />|br|br/|br /}}
 
<code><nowiki><br></nowiki></code>, <code><nowiki><br ></nowiki></code>, <code><nowiki><br/></nowiki></code>, <code><nowiki><br /></nowiki></code>
The {{tag|br|s}} or {{tag|br|o}} tags are used for a single forced line break. For content that is semantically a list, such as in infoboxes, actual list markup is preferred. See {{format link|#Lists}} below.
 
The [[MediaWiki]] software uses any of them for a single forced line break. All of them are converted to {{tag|br|s}} in the HTML that browsers read.
 
MediaWiki also converts <code><nowiki></br></nowiki></code> to {{tag|br|s}}, but this form is invalid. Please correct these tags.
 
The {{tag|br|s}} or {{tag|br|o}} tags are used for a single forced line break. For content that is semantically a list, such as in infoboxes, actual list markup is preferred. See {{format link|#Lists}} below.
 
{{markup
|<nowiki>And this line of text<br />will break in the middle.</nowiki>
|And this line of text<br />will break in the middle.
}}
 
The example below includes four forms that are rendered as line breaks and two that display as plain text.
The MediaWiki software converts valid forms like {{tag|br|o}}, {{tag|br|s}}, and {{tag|br&#32;|o}} to {{tag|br/|o}}. It also converts the invalid form {{tag|br|c}} to {{tag|br/|o}}. The invalid forms {{tag|&#32;br|o}} and {{tag|&#32;br|c}} are not converted, they will display literally and will not create line breaks, so must not be used.
<div style="display:inline-table; border: 2px solid var(--border-color-content-added); padding: 0.5em;">
'''Wiki source'''
 
<nowiki>One <br>Two <br >Three <br/>Four <br />Five < br>Six </ br>Seven</nowiki>
</div>
 
<div style="display:inline-table; border: 2px solid var(--border-color-content-added); padding: 0.5em;">
While valid forms without the <code>/</code> (such as {{tag|br|o}} or {{tag|br&nbsp;|o}}) will work properly in the rendered page because modern browsers are forgiving of [[Well-formed element|malformed HTML]], they can break several of the available [[Wikipedia:Syntax highlighting|syntax highlighters]] for wiki code in the editing view (mis-highlighting all text in the page after the occurrence of that tag), and so should be avoided.
'''Rendered result'''
 
One <br>Two <br >Three <br/>Four <br />Five < br>Six </ br>Seven
Please correct invalid occurrences&nbsp;– such as {{tag|br|c}}, {{tag|&nbsp;br|o}}, or {{tag|&nbsp;br|c}}&nbsp;– to {{tag|br|s}} as you encounter them, though preferably as a part of a more substantive edit.
</div>
 
=== &lt;poem> ===
Line 216 ⟶ 229:
 
== Preventing and controlling word wraps ==
{{Nutshell|title=This section|To prevent word wraps use <code>&amp;nbsp;</code> in place of each space,; and oruse <code>&amp;#8209;</code> in place of aeach hyphen. For more complex cases, see below.}}
 
There are several ways to prevent word wraps (line wraps) from occurring in unwanted places. This is an overview of when to use which method.
Line 358 ⟶ 371:
 
{{markup
|<nowiki>This long German word Datenschutz&amp;shy;erklärung breaks between its constituent parts "Datenschutz" and "erklärung".</nowiki>
|This long German word Datenschutz&shy;erklärung breaks between its constituent parts "Datenschutz" and "erklärung".
}}
Line 386 ⟶ 399:
 
== See also ==
* [[metamw:HelpManual:Newlines and spaces]]
* {{tl|break}}
* {{tl|clear}}