Template:Task heading: Difference between revisions

From Rosetta Code
Content added Content deleted
(show the edit link only for the default "Task" heading, not for custom ones)
(Mention link anchors as another benefit)
Line 14: Line 14:
* It has an edit link.
* It has an edit link.
*: <small>''(Only for the main "Task" heading, because due to technical limitations, it can't give you a specific subsection of the task to edit - it gives you the whole task description, or more precisely, everything above the first real heading.)''</small>
*: <small>''(Only for the main "Task" heading, because due to technical limitations, it can't give you a specific subsection of the task to edit - it gives you the whole task description, or more precisely, everything above the first real heading.)''</small>
* It has a link anchor.
*: <small>''(E.g. to link to the "See also" section, you can write <tt><nowiki>[[#See_also]]</nowiki></tt>. Note that spaces have to be replaced by underscores.)''</small>


===Usage===
===Usage===

Revision as of 04:09, 23 August 2016


This template can be used to show a heading (which won't affect the table of contents) above the task description on a task page.

Multiple headings can also be used to break longer task descriptions up into logical subsections (see example below).

Advantages

In the past, some Rosettacode editors have used the definition header syntax (e.g. ;Task:) to to create such headings.
Using this template instead, has the following advantages:

  • The heading is styled exactly the same way as the heading of the TOC, which makes it look nice and tidy.
    (Whereas ;Task: is simply rendered in bold, with the same font size and line spacing as normal text, and therefore doesn't stand out as much as a heading, especially when the task description already uses bold text for highlights.)
  • It has an edit link.
    (Only for the main "Task" heading, because due to technical limitations, it can't give you a specific subsection of the task to edit - it gives you the whole task description, or more precisely, everything above the first real heading.)
  • It has a link anchor.
    (E.g. to link to the "See also" section, you can write [[#See_also]]. Note that spaces have to be replaced by underscores.)

Usage

The first and only argument is the title of the heading to show.
If it is not specified, it defaults to the word "Task".

Usage example Renders as
{{task heading}}

...

{{task heading|Test cases}}

...

{{task heading|See also}}

...

...

Test cases

...

See also

...



This is a template. There are many others. See Category:RCTemplates for a complete list of templates.