Support

Support Options

Submit a Support Ticket

 
You are here: TopicsHelp: Wiki Macros

Help: Wiki Macros

Table of Contents

A macro inserts dynamic HTML data in any context supporting Wiki Formatting.

Using Macros

Macro calls are enclosed in two square brackets.

Examples

[[Timestamp]]

Display: 2010-09-02 12:35:28

[[Resource(100)]]

Display: Curriculum on Nanotechnology

[[Tag(heattransfer)]]

Display: heat transfer

To add a footnote to text you use the footnote macro. [[FootNote(Footnotes are automatically linked)]] You use the same macro but with no text to display the accumulated list of footnotes. For example:

[[FootNote]]

Display: To add a footnote to text you use the footnote macro. [1] You use the same macro but with no text to display the accumulated list of footnotes. For example:

  1. Footnotes are automatically linked

Available Macros

[[Tag(args)]]

This macro will generate a link to a Tag.

[[File(args)]]

Works similar to the Image macro but, instead, generates a link to a file. The first argument is the filename.

[[Contributor(args)]]

This macro will generate a link to a contributor's page with the contributor's name as the link text. It accepts either the contributor's ID, username, or name. NOTE: to use a name, it must be identical to their contributor page.

[[Recentpage(args)]]

Generates a link and optional bit of text to a recently created or updated page page.

Args:

  • limit - Number of articles to return. Defaults to 1
  • container class - A CSS class to be applied to the wrapper DIV
[[Span(args)]]

Wraps text or other elements inside a <span> tag.

[[Macrolist(args)]]

Displays a list of all installed Wiki macros, including documentation if available. Optionally, the name of a specific macro can be provided as an argument. In that case, only the documentation for that macro will be rendered.

[[Resource(args)]]

This macro will insert a linked title to a resource. It can be passed wither an ID or alias.

[[Page(args)]]

This macro will insert a linked title to a wiki page. It can be passed either an ID or alias.

[[Div(args)]]

Allows content to be wrapped in a <div> tag. This macro must be used twice: [[Div(start)]] to indicate where to create the opening <div> tag and [[Div(end)]] to indicate where to close the resulting <div> tag. Attributes may be applied by separating name/value pairs with a comma. Example: [[Div(start, class=myclass)]]

[[Fileindex(args)]]

Inserts an alphabetic list of all files and images attached to this page into the output. Accepts a prefix string as parameter: if provided, only files with names that start with the prefix are included in the resulting list. If this parameter is omitted, all files are listed.

[[Helloworld(args)]]

Outputs "Hello world"

[[Randompage(args)]]

Generates a link to a random page.

[[Titleindex(args)]]

Inserts an alphabetic list of all wiki pages into the output. Accepts a prefix string as parameter: if provided, only pages with names that start with the prefix are included in the resulting list. If this parameter is omitted, all pages are listed.

The list may have a sorting applied by adding the sort=[title,created(oldest to newest),modified(newest to oldest)] argument. For example, [[TitleIndex(sort=modified)]] will list all pages by their last modified date (most recent to oldest). If you have a page prefix, simply add a comma and the sort parameter after. For example: [[TitleIndex(Help, sort=modified)]]

[[Image(args)]]

Embed an image in wiki-formatted text. The first argument is the file specification. The remaining arguments are optional and allow configuring the attributes and style of the rendered <img> element:

  • digits and unit are interpreted as the size (ex. 120, 25%) for the image
  • right, left, top or bottom are interpreted as the alignment for the image
  • link=some Link... replaces the link to the image source by the one specified using Link. If no value is specified, the link is simply removed.
  • nolink means without link to image source (deprecated, use link=)
  • key=value style are interpreted as HTML attributes or CSS style indications for the image. Valid keys are:
  • align, border, width, height, alt, title, longdesc, class, id and usemap
  • border can only be a number

Examples:

  • [[Image(photo.jpg)]] # simplest
  • [[Image(photo.jpg, 120px)]] # with image width size
  • [[Image(photo.jpg, right)]] # aligned by keyword
  • [[Image(photo.jpg, nolink)]] # without link to source
  • [[Image(photo.jpg, align=right)]] # aligned by attribute
  • [[Image(photo.jpg, 120px, class=mypic)]] # with image width size and a CSS class
[[Timestamp(args)]]

Displays a time-stamp in the following format: YYYY-MM-DD HH:MM:SS

[[Children(args)]]

Inserts an alphabetic list of all sub-pages (children) of the current page into the output. Accepts one parameter:

  • depth: how deep to mine for pages. Default is one level.

Example usage: [[Children(depth=3)]]

[[Footnote(args)]]

Add a footnote, or explicitly display collected footnotes when no args (footnote text) are given.

[[Anchor(args)]]

Inserts an anchor into a page.

Created on 18 Feb 2008, Last modified on 03 Mar 2009

nanoHUB.org is supported by the National Science Foundation and other funding agencies.