Template:Block indent/doc
| This is a documentation subpage for Template:Block indent. It may contain usage information, categories and other content that is not part of the original template page. |
| This template is used in system messages, and on approximately 1,110,000 pages, or roughly 2% of all pages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
| This template uses TemplateStyles: |
The {{Block indent}} template adds an indented content block to a page.
Usage
[edit]{{Block indent|1=The material to be indented here. May include markup, paragraph breaks, etc.}}
Example
[edit]{{Block indent|1=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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}} →
TemplateData
[edit]TemplateData for Block indent
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Indented content | 1content quote text | The page content to display indented. This should always be defined as a named, not an unnamed, parameter to avoid parser errors. | Content | required |
| Left indentation width | leftem | Number | optional | |
| Right indentation width | right | Number | optional | |
| Custom styling | style | Custom CSS style declarations to be added following the default ( overflow: hidden;), each terminated by a semicolon
| Line | optional |
| CSS classes | class | Additional CSS class names (e.g. as defined at MediaWiki:Common.css) to declare alongside the default ( block-indent), whitespace-delimited if more than one
| Line | optional |
Alternatives that are not recommended
[edit]A colon at the start of the line produces a similar indent, but it produces incorrect HTML; see Wikipedia:Manual of Style § Indentation for more details. (An initial : was intended only for use after ; in constructing description lists, but many editors have used it ubiquitously for simple indentation.)
{{Blockquote}} employs the HTML <blockquote>...</blockquote> element and is intended for use only with actual block quotation; using it for indenting simple block elements breaks semantic HTML and the appearance differs. (Whereas {{Block indent}} employs an HTML <div>...</div> element with padding offsetting it from the left and/or right page margins.)
The default display of {{Block indent}} differs from that of {{Blockquote}} in that it does not:
- introduce vertical whitespace above or below the indented material (add blank lines above and/or below manually, as needed)
- indent from the right as well as the left (though the optional
|right=parameter triggers this behavior) - affect the font size of its contents
- bookend the block with large quotation marks on mobile devices
- support plain blank-line paragraph breaks inside it, or
- support attribution parameters (because {{Block indent}} isn't for quotations).
{{Blockquote}} and {{Block indent}} both support internal paragraph breaks through the use of HTML <p>...</p> tags around subsequent paragraphs, as well as other HTML markup. It is always safest to explicitly format using raw HTML rather than rely on MediaWiki's parser because future updates to it could alter the output at any time.
Comparison with Template:Blockquote
[edit]| {{Block indent}}[a] | {{Blockquote}}[b] |
|---|---|
|
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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
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 nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
Technical issues with block templates
[edit]If the block-formatted content uses a named parameter (including |1=) and begins with a list (or any other wikimarkup that is dependent upon a specific markup character being at the beginning of a line), because MediaWiki behavior is to strip whitespace from named parameters, a <nowiki /> and a new line must exist before the list (or whatever) starts. This no longer affects unnamed parameters. Compare:
| code | result | |
|---|---|---|
| Works as intended | {{Block indent| |
|
| FAIL | {{Block indent|1= |
*Firstly, ...
|
| Works as intended | {{Block indent|1=<nowiki /> |
|
To embed a table in block markup like this, the block template's content parameter must be named or numbered and include the self-closing nowiki – as in |1=<nowiki /> – then every | character in the table markup must be escaped with {{!}}. An alternative is to use explicit HTML <table>, <tr>, <th>, and <td> markup.
See also
[edit]| Use case | Template |
|---|---|
| Long quotations | {{Blockquote}} |
| With line breaks ⏎ | {{Poem quote}} |
| Non-quotations | {{Block indent}} {{Indent 5}} (inline) |
| Math formulae | See <math> blocks |
- {{Blockquote}}, only for use with block quotations
- {{Hanging indent}}
- {{Indent}} – indents a single line, after a newline, using a mixture of en and/or em spaces
- {{Indent 5}} – indents a single line (or portion of inline content) using up to fifty (50) equal en spaces
- {{Spaces}} – indents a single line (or portion of inline content) using non-breaking spaces