Template:Indent/doc: Difference between revisions

From HIBIKIFORUM
Jump to navigation Jump to search
(Created page with "{{Documentation subpage}} {{Lua|Module:Indent}} {{tsh|in}} __NOTOC__ The template {{tlc|indent}} performs a newline and indents by a specified number of spaces. However, the spaces are not all the same size, but rather a mixture of en-size & em-size spaces that have been tested to work on a wide range of browsers. == Usage == The indentation spacing generated by {{tl|Indent}} will match the alignment of a colo...")
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 56: Line 56:
== See also ==
== See also ==
* {{tl|block indent}}, to indent an entire block of content, similar to a block quotation (uses {{code|lang=html|code=<div>}} and CSS margins)
* {{tl|block indent}}, to indent an entire block of content, similar to a block quotation (uses {{code|lang=html|code=<div>}} and CSS margins)
* {{tl|space}}, which indents a single line (or content inline in one) uses non-breaking spaces


== TemplateData ==
== TemplateData ==
Line 77: Line 78:


<!-- Categories below this line, please -->
<!-- Categories below this line, please -->
[[Category:Templates]]
[[Category:Formatting templates]]
[[Category:Formatting Templates]]
[[Category:General use templates]]
[[Category:General Use Templates]]
}}}}</includeonly>
}}}}</includeonly>

Latest revision as of 01:56, 20 August 2023

Light bulb.png }}
It contains usage information, categories and other content that is not part of the original template page.


The template {{indent}} performs a newline and indents by a specified number of spaces. However, the spaces are not all the same size, but rather a mixture of en-size & em-size spaces that have been tested to work on a wide range of browsers.

Usage

The indentation spacing generated by {{Indent}} will match the alignment of a colon-shift : by using {{indent|5}}. To match ::, use {{indent|10}}.

  • Note: This may vary depending on your browser.

Usage: {{indent|# of spaces}}

  • Indents up to 30 spaces.
  • Indent differs from {{space}} only in that it automatically begins a wrapped-newline, then spaces over n spaces, whereas {{space}} spaces over n in the same (current) line.

Examples

The following are detailed examples, also comparing to the equivalent indentation generated if a colon-shift : were used instead.

Example 1 – Indenting by 5:
Markup Renders As
Some text.{{indent|5}}Some more text. Some text.
     Some more text.
Example 2 – Alignment with : or :: indentations:
Markup Renders As
: Line of colon-shifted text.

{{indent|5}}Line of indent-5-shifted text.
<br />      Line of br-6-nbsp-shifted text.
<br />     Line of br-5-nbsp-shifted text.
<br />     Line of br-5-nbsp-true-shifted text.
:: Line of 2-colon-shifted text.
{{space|10}}Line of space-10-shifted text.

Line of colon-shifted text.


     Line of indent-5-shifted text.
      Line of br-6-nbsp-shifted text.
     Line of br-5-nbsp-shifted text.
     Line of br-5-nbsp-true-shifted text.

Line of 2-colon-shifted text.

          Line of space-10-shifted text.

Note that if the prior line is already colon-shifted text, then using "{{indent|5}}" generates a blank line first, so instead, use "{{space|5}}" (or such) after a colon-shifted line.

Analysis of uneven spacing

As computers optimize code, they occasionally risk displaying unsavory results after condensing monotonous strings of characters (such as spaces). Thus, many templates around Wiki choose to avoid this hurdle by alternating different types of spaces (with the intention of displaying no differently than regular spaces).

Spaces come in two main size varieties: em spaces and en spaces. Em spaces are generally defined as the width of one character, and en spaces exactly half that size. However, there is no requirement that browsers must conform to this standard, and so templates that code in en spaces may not display uniformly across all browsers. Neither {{indent}} nor {{space}} use true space-size (that is, em-size spaces), but rather mix en and em spaces.

See also

  • {{block indent}}, to indent an entire block of content, similar to a block quotation (uses <div> and CSS margins)
  • {{space}}, which indents a single line (or content inline in one) uses non-breaking spaces

TemplateData

Template to perform a newline and indent by a specified number of spaces.

Template parameters

ParameterDescriptionTypeStatus
Number1

Number of spaces to indent.

Example
5
Numberrequired