Template:Pseudoheading/doc

From Wikisource
Jump to navigation Jump to search

Pseudoheading[edit]

{{Pseudoheading}} generates a classed div with an ID, as an alternative to HTML heading elements (which MediaWiki will often override the styles of); the ID can be used for anchor links. It explicitly has no support for direct CSS formatting, and applies no styles except for highlighting the text when a link to the anchor is followed. It is designed for use with classes and index-specific CSS.

Parameters[edit]

  • 1: The content of the header.
  • class: Optional CSS classes (use this if you have multiple heading styles in a single work). The div always has the class .wst-heading as well as additional classes.
  • id: Optional ID (used as an anchor). If not given, the contents of the header is used. This parameter should also be used to add a suitable simple ID, if markup or complex formatting is used in the header (such as a footnote directly associated with the heading).
  • attr: Additional attributes.
    For example, {{pseudoheading/leveled}} uses this to set attr = aria-level="{{{level|2}}}".

Examples[edit]

Example

A div with class wst-heading and id Chapter_One:

{{pseudoheading|Chapter One}}
Chapter One

Example

A div with classes .wst-heading and .chapter_heading and id Chapter_1:

{{pseudoheading|Chapter ''One''<ref>example</ref>|id=Chapter 1|class=chapter_heading}}
<references />
Chapter One[1]
  1. example

There are a few common styling choices you may wish to replicate.

Margin/leading underneath the heading[edit]

Example: Page:Ayn Rand Anthem.pdf/21 (using Index:Ayn Rand Anthem.pdf/styles.css)

.wst-heading {
	text-align:center;
	font-size:120%;
	margin-bottom:1.5em;
}

Small-caps for subtitles[edit]

.wst-heading {
	text-align:center;
}
.wst-heading.subtitle {
	font-variant:small-caps;
}

Also consider all-small-caps if you want Proper Nouns to appear in "all small caps", including the first letters: e.g. Oxford.

Pseudoheading/main and Pseudoheading/subheading[edit]

{{Pseudoheading/main}} and {{pseudoheading/subheading}} call {{pseudoheading}} with the additional classes .wst-main-heading and .wst-subheading respectively, and produce centered text, which {{pseudoheading/main}} also makes font size 120%.

Parameters[edit]

  • 1 The content of the header.
  • class Optional CSS classes.
  • id Optional ID.

Examples[edit]

Example

{{pseudoheading/main|Chapter I}}
{{pseudoheading/subheading|Subtitle}}
Chapter I
Subtitle

Pseudoheading/leveled[edit]

{{Pseudoheading/leveled}} calls {{pseudoheading}} with the additional classes .wst-heading-leveled and .wst-heading-leveled-{{{level}}}.

Parameters[edit]

  • 1 The content of the header.
  • class Optional CSS classes. The div always has the classes .wst-heading, .wst-heading-leveled and .wst-heading-leveled-{{{level}}} as well as additional classes.
  • id Optional ID (used as an anchor).
  • level Heading level. Typically an integer between 1 and 6, defaults to 2.

Examples[edit]

Example

{{Pseudoheading/leveled|Text}}
Text

Example

{{Pseudoheading/leveled|Level 1|level=1}}
{{Pseudoheading/leveled|Level 2|level=2}}
{{Pseudoheading/leveled|Level 3|level=3}}
{{Pseudoheading/leveled|Level 4|level=4}}
{{Pseudoheading/leveled|Level 5|level=5}}
{{Pseudoheading/leveled|Level 6|level=6}}
Level 1
Level 2
Level 3
Level 4
Level 5
Level 6


Example

{{Pseudoheading/leveled|Text<ref>Demo</ref>|class=example|id=Text|level=example}}
<references />
Text[1]
  1. Demo