Style Guide

This page summariezes many wiki style rules and tells you how and/or when they should be used. Thus, this is good point to start when you want to create nice uniform pages.

Creating new Pages

How can you create a new page? Well, there a two possibilities to archive this:

  1. Just type the URL of the page you want to create in your webbrowser's url bar. You should then redirected to the 404 error page which will tell you that this page doesn't exist (of course). The error page should also include an link which will redirect you to an edit form to create this page.
  2. You can also create a link from a existing to a non-existing page (see links chapter). The link to the non-existing page will redirect you to an edit form to create this page.

more infos about creating new pages.

The first step to create a new page, you need to edit an existing page, and on it add a link to the page you want to create.

To link to your new page, you must choose a name for it. The best names describe the page's contents well, so that everyone can remember and type the name easily.
To create a link, surround the page name with double brackets. Typing [[my new page]] will create a link to my new page?. There's a lot you can do with double bracket links.

You can see that the links to my new page? all have question marks after them. That's because my new page? hasn't been written yet. Clicking the link as second step will take you to an edit form where you could write and finally save the new page.


Another way to create a page: in your browser's address bar (where the page URL is), replace the name of the current page with the name of the page you wish to create, and hit Enter or do whatever you would normally do to go to a new location. PmWiki will then dutifully tell you that the page you entered doesn't exist, but you can click on the "Edit" link in order to create, edit, and save the new page.

The bad thing about this method is that there are no links to your new page, so you're the only person who knows it is there. It will be an orphan, unread, unlinked, unloved. That's why adding a link to an existing page or to the SideBar is a better way to create a page.


Learn more:

  • You can also organize related pages into groups, and link between pages in different groups.

How do I create a new page?

Typing [[my new page]] will create a link to the new page. There's a lot you can do with double bracket links.

Why do some new pages have a title with spaces like "Creating New Pages" and others end up with a WikiWord-like title like "CreatingNewPages"?

The default page title is simply the name of page, which is normally stored as "CreatingNewPages." However, you can override a page's title by using the (:title Creating New Pages:) directive. This is especially useful when there are special characters or capitalization that you want in the title that cannot be used in the page name.

Links

  • Links to other Pages (Within the same Wiki group)

A key feature of Wiki Wiki Webs is the ease of creating hyper links in the text of a document. PmWiki provides multiple mechanisms for creating such links.

Links to other pages in the wiki

To create a link to another page, simply enclose the name of the page inside double square brackets, as in [[wiki sandbox]] or [[installation]]. These result in links to wiki sandbox and installation, respectively.

PmWiki creates a link by using the text inside the double brackets. It does this by removing spaces between words, and automatically capitalizing words following spaces or other punctuation (like ~). Thus [[Wiki sandbox]], [[wiki sandbox]], and [[WikiSandbox]] all display differently but create the same link to the page titled WikiSandbox.

In other words, PmWiki will automatically create the link path name using title case as a rule, but link text will display in the format you have entered it.

A suffix can also be added to the end of a link, which becomes part of the link text but not the target. Thus [[wiki sandbox]]es is a link to WikiSandbox but displays as wiki sandboxes.

Link text in (parentheses) will not be not displayed, so that [[(wiki) sandbox]] links to WikiSandbox and displays as sandbox.

Finally, you can specify the link text via a vertical brace, thus [[WikiSandbox | a play area]], which links to WikiSandbox but displays as a play area. You can use an arrow (->) to reverse the order of the text and target, as in [[a play area -> WikiSandbox]] (a play area).

Some sites also recognize WikiWord links, in which a camel case (capitalised) WikiWord appearing in the text is automatically treated as a link to a page of the same name.

Link shortcuts

Use of special characters in title is not a problem for PmWiki, but sometimes the character set is different from your computer and the server computer or the client computer that is used to read your wiki. Specially UTF-8 gives some problems. So it's better not to use these and keep ASCII characters if possible. Any page can have a (:title <name>:) directive to display a localized title instead of the page file name. In this case, the following tip is important and usefull.

[[PageName|+]] creates a link to PageName and uses that page's title as the link text, e.g., [[PmWiki.BasicEditing|+]] where the page BasicEditing has the directive (:title Basic PmWiki editing rules:) gives Basic PmWiki editing rules. Since PmWiki version 2.2.14 this works also for those technical pages that have an entry in the XLPage, without the need to add a (:title <name>:) directive in that page (for more details see Localization.Localization).

[[PageName|#]] creates a reference link as shown below[1].

[[!PageName]] creates a link to the PageName in the group called Category. See Categories.

[[~Author]] link creates a link to the page called Author in the Profiles group.

~~~ markup creates a link for the current Author when it encounters three tilde characters (~) in a row (~~~).

~~~~ markup creates a link for the current author and appends the current date and time when four tilde characters (~) in a row are encountered

Links to specific locations within a page -- "anchors"

To define a location within a page to which you may jump directly, use the markup [[#name]]. This creates an "anchor" that uniquely identifies that location in the page. Then to have a link jump directly to that anchor, use one of

  • [[#name|link text]] within the same page, or
  • [[PageName#name]] or [[PageName#name|link text]] for a location on another page
  • The form [[PageName(#name)]] may be useful for hiding the anchor text in a link.

For example, here's a link to the Intermaps section, below.

Notes:
  • the anchor itself must begin with a letter, not a number
  • a link to an anchor must have the same capitalization as the anchor itself.
  • Spaces are not allowed in an anchor: "[[#my anchor]]" won't work, "[[#myanchor]]" will.

Links to actions

To link to a specific action for the current page use [[{$FullName}?action=actionname|linkname]].

Examples:
  • [[{$FullName}?action=edit|Edit]] for the editing or
  • [[{$FullName}?action=diff|differences]] for differences.

Links outside the wiki

Links to external sites (URLs)

Links to external sites simply begin with a prefix such as 'http:', 'ftp:', etc. Thus http://google.com/ and [[http://google.com/]] both link to Google. As with the above, an author can specify the link text by using the vertical brace or arrow syntax, as in [[http://google.com/ | Google]] and [[Google -> http://google.com]].

It is possible to set a "tooltip title" of the external link by adding it in quotes after the address:

The tooltip title of the link is "Home of PmWiki"
[[http://www.pmwiki.org/"Home of
PmWiki"|link]]

link

If the external link includes (parentheses), escape these using %28 for "(" and %29 for ")" :

[[http://en.wikipedia.org/wiki/Wiki_%28disambiguation%29 | link to "Wiki
(disambiguation)" ]]

link to "Wiki (disambiguation)"

Links to intranet (local) files

You can link to a file system by including the prefix 'file:///' (for Internet Explorer at least). So file:///S:\ProjPlan.mpp and [[Shared S drive->file:///S:\]] are both valid links. On a Windows file system you may want to use network locations (eg \\server1\rootdirectory\subdirectory) rather than drive letters which may not be consistent across all users. Not all browsers will follow such links.

Link characteristics

Links as References

Links may also be specified as References, so the target appears as an anonymous numeric reference rather than a textual reference. The following markup is provided to produce sequential reference numbering within a PmWiki page:

Formatting the link as: [[http://google.com |#]] produces: [2] as the link.

Subsequent occurrence of the reference link format on the same page will be incremented automatically as per the following example: Entering [[http://pmwiki.com |#]] produces [3], [[#intermaps |#]] produces [4], and so on for further reference links.

Intermaps

Inter Map links are also supported (see Inter Map). In particular, the Path: InterMap entry can be used to create links using relative or absolute paths on the current site (e.g., Path:../../somedir/foo.html or Path:/dir/something.gif).

Links to pages in other wiki groups

See Wiki Group.

Links that open a new browser window

To have a link open in another window, use %newwin%...%%:

You can also specify that links should open in a new window via the %target=_blank%...%% attribute:

The following link %target=_blank%
http://pmichaud.com %%
will open in a new window.

The following link http://pmichaud.com will open in a new window.

Links that are not followed by robots

Prefix a link with %rel=nofollow% to advise robots and link checkers not to follow it.

Links and CSS Classes

PmWiki automatically gives classes to several types of links. Among other things, this enables you to format each type differently.

Note: This may be an incomplete list.
.selflink
A link to the current page. Useful in sidebars to show "you are here".
.wikilink
A link to another page within the wiki.
.urllink
A link to a page outside the wiki.

Notes

Note: The default behavior of "+" above can be overridden to display the spaced title, rather than simply the title by adding the following to config.php:

## [[target |+]] title links
Markup('[[|+', '<[[|',
  "/(?>\\[\\[([^|\\]]+))\\|\\s*\\+\\s*]]/e",
  "Keep(MakeLink(\$pagename, PSS('$1'),
                 PageVar(MakePageName(\$pagename,PSS('$1')), '\$Titlespaced')
                ),'L')");

How do I create a link that will open as a new window?

Use the %newwin% wikistyle, as in:

%newwin% http://example.com/ %%

http://example.com/

How do I create a link that will open a new window, and configure that new window?

This requires javascript. See Cookbook:PopupWindow.

How do I place a mailing address in a page?

Use the mailto: markup, as in one of the following:

* mailto:myaddress@example.com
* [[mailto:myaddress@example.com]]
* [[mailto:myaddress@example.com |
email me]]
*
[[mailto:myaddress@example.com?subject=Some
subject | email me]]

The markup [[mailto:me@example.com?cc=someoneelse@example.com&bcc=else@example.com&subject=Pre-set Subject&body=Pre-set body | display text]] =] lets you specify more parameters like the message body and more recipients (may not work in all browsers and e-mail clients).

See also Cookbook:DeObMail for information on protecting email addresses from spammers.

How can I enable links to other protocols, such as nntp:, ssh:, xmpp:, etc?

See Cookbook:Add Url schemes

How do I make a WikiWord link to an external page instead of a WikiPage?

Use link markup. There are two formats:

[[http://example.com/ | WikiWord]]
[[WikiWord -> http://example.com/]]

How do I find all of the pages that link to another page (i.e., backlinks)?

In the wiki search form, use link=Group.Page to find all pages linking to Group.Page.

Use the link= option of the (:pagelist:) directive, as in

(:pagelist link=SomePage list=all:)   -- show all links to SomePage
(:pagelist link={$FullName} list=all:)  -- show all links to the current page

What link schemes does PmWiki support?

See PmWiki:Link schemes

How do I open external links in a new window or mark them with an icon?

See Cookbook:External links

How can I use an image as a link?

Use [[Page| Attach:image.jpg ]] or [[ http://site | http://site/image.jpg ]] See Images#links

  • Links to other Page (In another Wiki group)

PmWiki pages are organized into groups of related pages. This feature was added to PmWiki to allow authors to create their own wiki spaces of specialized content on their own, without having to become, or rely on, wiki administrators. See Pm's post to the pmwiki-users mailing list.

By default, page links are between pages of the same group; to create a link to a page in another group, add the name of the other group and a dot or slash to the page name. For example, links to Main/WikiSandbox could be written as:

* [[Main.WikiSandbox]]
* [[Main/WikiSandbox]]
* [[(Main.Wiki)Sandbox]]
* [[Main.WikiSandbox | link text]]
* [[Main.WikiSandbox | +]]

To link to the default home page of a group, the name of the page can be omitted, like this:

* [[Main.]]
* [[Main/]]

Creating groups

Creating a new group is as easy as creating new pages; simply edit an existing page to include a link to the new group's default home page (or any page in the new group) then click on the '?' to edit the page. As a rule, group names must start with a letter (but this can be changed by the wiki administrator by adding

$GroupPattern = '[[:upper:]\\d][\\w]*(?:-\\w+)*';

in config.php).

For example, to make a default page in the group Foo, create a link to [[Foo/]] (or [[Foo.]]). To make a page called Bar in the group Foo, create a link to [[Foo/Bar]] and follow the link to edit that page.

Groups in a standard PmWiki distribution

  • Main?: The default group. On many wikis, it contains most of the author-contributed content. Main.HomePage and Main.WikiSandbox come pre-installed.
  • PmWiki: An edit-protected group that contains PmWiki documentation and help pages.
  • Site?: Holds a variety of utility and configuration pages used by PmWiki, including
    SideBar, Search, Preferences, Templates, and AllRecentChanges.
  • SiteAdmin: Holds a number of password protected administration and configuration pages used by PmWiki, including
    ApprovedUrls, and Blocklist
  • To list all the groups in a site, try searching for "fmt=group".
  • To list all the pages in a group, try searching for "GroupName/".

Special Pages in a Group

By default, the Recent Changes page of each group shows only the pages that have changed within that group; the Site.All Recent Changes page shows all pages that have changed in all groups.

Each group can also have Group Header or Group Footer pages that contain text to be automatically prepended or appended to every page in the group. A group can also have a Group Attributes page that defines attributes (read and edit passwords) shared by all pages within the group.

Each page can also have its own individual read/edit password that overrides the group passwords (see Passwords).

Finally, wiki administrators can set local customizations on a per-group basis--see Group Customizations.

Group's default page

The default "start page" for a group is a page whose name is:

  1. the same as the group (Foo/Foo)
  2. HomePage (Foo/HomePage)
  3. a name that the administrator has assigned to the {$DefaultName} variable in the configuration.php file.

Note, on this site, the value of {$DefaultName} is HomePage and, thus, the default home page would be Foo/HomePage.

You can usefully change the default search order for an entered page name by setting the variable $PagePathFmt in config.php, eg

$PagePathFmt = array('$Group.$1', '$1.$DefaultName', '$1.$1', '$DefaultGroup.$1', 'Profiles.$1');

where "$1" is the name of the page entered.

As noted above, when linking to the default home page, authors can omit the page name and simply identify the group followed by a forward slash ([[Foo/]]).

Note the forward slash is required to ensure that the link unambiguously points to the identified group. If the slash is omitted, the link can end up being interpreted as pointing to an existing (or new) page in the current group (if the group, or its default home page, do not exist).

Subgroups? Subpages?

No, PmWiki does not have subpages. Pm's reasons for not having subgroups are described at PmWiki:Hierarchical Groups, but it comes down to not having a good page linking syntax. If you create a link or pagename like [[A.B.C]] PmWiki doesn't think of "B.C" as being in group "A", it instead thinks of "C" as being in group "AB", which is a separate group from "A". Wiki administrators can look at Cookbook:Subgroup Markup and Cookbook:Include With Edit for recipes that may be of some help with developing subgroups or subpages.

Restricting the creation of new groups

You can set PmWiki's $GroupPattern variable to only accept the group names you want to define. For example, to limit pages to the "PmWiki", "Main", "Profiles", and "Example" groups, add the following to local/config.php:

$GroupPattern = '(?:Site|SiteAdmin|PmWiki|Main|Profiles|Example)';

With this setting, only the listed groups will be considered valid WikiGroups. You can add more groups to the list by placing additional group names separated by pipes (|).

See other solutions to this at Cookbook:Limit Wiki Groups and Cookbook:New Group Warning.

How can I get rid of the 'Main' group in urls for pages pointing to Main?

See Cookbook:Get Rid Of Main.

How can I limit the creation of new groups?

See Cookbook:Limit Wiki Groups.

Why doesn't [[St. Giles and St. James]] work as a link? (It doesn't display anything.)

Because it contains periods, and destroys PmWiki's file structure, which saves pages as Group.PageName. Adding those periods disrupts this format. Links may only contain words. If you need a link precisely as shown, the page must be named eg StGilesAndStJames then you can use the (:title:) directive to have the page's title appear with periods (:title St. Giles and St. James:). (Although modern US and UK grammar now tend to drop the period to simplify style).

How can I delete a wiki group?

Normally you can't, as this requires an admin with server-side access to delete the file that makes up the group's RecentChanges page. But there is an option method of making it possible to delete RecentChanges pages from within the wiki if the admin enables the code found on Cookbook:RecentChanges Deletion.

How can I delete a wiki group's Group.RecentChanges page?

Normally you can't, as this requires an admin with server-side access to delete a file. But there is an optional method of making it possible to delete RecentChanges pages from within the wiki if the admin enables the code found on Cookbook:RecentChanges Deletion.

Text Formating Rules

more infos about text formating rules.

This page provides a more complete list of some of the markup sequences available in PmWiki. Note that it's easy to create and edit pages without using any of the markups below, but if you ever need them, they're here.

To experiment with the rules, please edit the Wiki Sandbox.


Paragraphs

To create paragraphs, simply enter text. Use a blank line to start a new paragraph.

Words on two lines in a row will wrap and fill as needed (the normal XHTML behavior). To turn off the automatic filling, use the (:linebreaks:) directive above the paragraph.

  • Use \ (single backslash) at the end of a line to join the current line to the next one.
  • Use \\ (two backslashes) at the end of a line to force a line break.
  • Use \\\ (three backslashes) at the end of a line to force 2 line breaks.
  • Use [[<<]] to force a line break that will clear floating elements.

Indented Paragraphs (Quotes)

Arrows (->) at the beginning of a paragraph can be used to produce an indented paragraph. More hyphens at the beginning (--->) produce larger indents.

->Four score and seven years ago our fathers placed upon this continent
a new nation, conceived in liberty and dedicated to the proposition that
all men are created equal.
Four score and seven years ago our fathers placed upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal.

Inverted Arrows (-<) at the beginning of a paragraph can be used to produce a paragraph with a hanging indent. Adding hyphens at the beginning (---<) causes all the text to indent.

-<Four score and seven years ago our fathers placed upon this continent
a new nation, conceived in liberty and dedicated to the proposition that
all men are created equal. 
Four score and seven years ago our fathers placed upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal.
--<Four score and seven years ago our fathers placed upon this continent
a new nation, conceived in liberty and dedicated to the proposition that
all men are created equal.  And that food would be good too.
Four score and seven years ago our fathers placed upon this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal. And that food would be good too.

Blocks of text to which (:linebreaks:) has been applied can be indented by preceding the first line of the block with indention arrows (->) and aligning subsequent lines under the first. An unindented line stops the block indentation. See Cookbook:Markup Tricks for an example.

Bulleted and Numbered Lists

Bullet lists are made by placing asterisks at the beginning of the line. Numbered lists are made by placing number-signs (#) at the beginning of the line. More asterisks/number-signs increases the level of bullet:

* First-level list item
** Second-level list item
### Order this
#### And this (optional)
### Then this
** Another second-level item
* A first-level item: cooking
## Prepare the experiment
### Unwrap the pop-tart
### Insert the pop-tart into the toaster
## Begin cooking the pop tart
## Stand back
  • First-level list item
    • Second-level list item
      1. Order this
        1. And this (optional)
      2. Then this
    • Another second-level item
  • A first-level item: cooking
    1. Prepare the experiment
      1. Unwrap the pop-tart
      2. Insert the pop-tart into the toaster
    2. Begin cooking the pop tart
    3. Stand back
# A list is terminated
by the first line that is not a list.
# Also terminate a list using the escape sequence [@[==]@]
[==]
# Continue a list item by lining
  up the text with leading whitespace.
# Use a forced linebreak \\
  to force a newline in your list item.
  1. A list is terminated

by the first line that is not a list.

  1. Also terminate a list using the escape sequence [==]

  1. Continue a list item by lining up the text with leading whitespace.
  2. Use a forced linebreak
    to force a newline in your list item.
## Text between list items can cause numbering to restart
## %item value=3% this can be dealt with
  1. Text between list items can cause numbering to restart
  2. this can be dealt with

Also see: PmWiki:ListStyles, Cookbook:WikiStylesPlus.

Definition Lists

Powerful new* feature
When you define terms using this markup
PmWiki will recognize them as PageTextVariables
that you can use on any page or PageList.
* Added in PmWiki version 2.2.0

Definition lists are made by placing colons at the left margin (and between each term and definition):

:term:definition of term
::second-level item: definition of 2nd-level item
term
definition of term
second-level item
definition of 2nd-level item

Whitespace Rules

Whitespace indentation in lists. Any line that begins with whitespace and aligns with a previous list item (whether bulleted, numbers or definitional) is considered to be "within" that list item. Text folds and wraps as normal, and the (:linebreaks:) directive is honored.

# First-level item\\
  Whitespace used to continue item on a new line
# Another first-level item
  # Whitespace combined with a single # to create a new item one level
deeper
  1. First-level item
    Whitespace used to continue item on a new line
  2. Another first-level item
    1. Whitespace combined with a single # to create a new item one level deeper

Otherwise, lines that begin with whitespace are treated as preformatted text, using a monospace font and not generating linebreaks except where explicitly indicated in the markup. Note to administrators: Starting with version 2.2.0-beta41, this feature can be modified using $EnableWSPre. (Another way to create preformatted text blocks is by using the [@...@] markup.)

Horizontal Line

Four or more dashes (----) at the beginning of a line produce a horizontal line.

Emphasis and character formatting

  • Enclose text in doubled single-quotes (''text''), i.e., two apostrophes, for emphasis (usually italics)
  • Enclose text in tripled single-quotes ('''text'''), i.e. three apostrophes, for strong (usually bold)
  • Enclose text in five single-quotes ('''''text'''''), or triples within doubles (five apostrophes), for strong emphasis (usually bold italics)
  • Enclose text in doubled at-signs (@@text@@) for monospace text
  • Use [+large+] for large text, [++larger++] for larger, [-small-] for small text, and [--smaller--] for smaller.
  • Emphasis can be used multiple times within a line, but cannot span across markup line boundaries (i.e., you can't put a paragraph break in the middle of bold text).
  • '~italic~' and '*bold*' are available if enabled in config.php

Other styling

'+big+', '-small-', '^super^', '_sub_', 

{+insert or underscore+}, 

{-delete or strikethrough or strikeout-}

big, small, super, sub,

insert or underscore,

delete or strikethrough or strikeout

  • `WikiWord WikiWord neutralisation

See also Wiki Styles for advanced text formatting options.

References

  • Use words and phrases in double brackets (e.g., [[text formatting rules]]) to create links to other pages on this wiki.
  • On some PmWiki installations, capitalized words joined together (e.g., WikiWords) can also be used to make references to other pages without needing the double-brackets.
  • Precede URLs with "http:", "ftp:", "gopher:", "mailto:", or "news:" to create links automatically, as in http://www.pmichaud.com/toast.
  • URLs ending with .gif, .jpg, or .png are displayed as images in the page
  • Links with arbitrary text can be created as either [[target | text]] or [[text -> target]]. Text can be an image URL, in which case the image becomes the link to the remote url or WikiWord.
  • Anchor targets within pages (#-links) can be created using [[#target]].

See Links for details.

Headings

Headings are made by placing an exclamation mark (!) at the left margin. More exclamation marks increase the level of heading. For example,

!! Level 2 Heading
!!! Level 3 Heading
!!!! Level 4 Heading
!!!!! Level 5 Heading

Level 2 Heading

Level 3 Heading

Level 4 Heading

Level 5 Heading

Note that level 1 heading is already used as page title (at least in the PmWiki skin), so you should start with level 2 headings to create well formed, search engine optimized web pages.

See Cookbook:Numbered Headers for numbered headings.

Escape sequence

Anything placed between [= and =] is not interpreted by PmWiki, but paragraphs are reformatted. This makes it possible to turn off special formatting interpretations and neutralise WikiWords that are not links (even easier is to use a tick ` in front, like `WikiWord).

For preformatted text blocks, use the [@...@] markup. It does neither reformat paragraphs nor process wiki markup:

[@
Code goes here like [[PmWiki.PmWiki]]
'$CurrentTime $[by] $AuthorLink:  [=$ChangeSummary=]'; #just some code
@]
Code goes here like [[PmWiki.PmWiki]]
'$CurrentTime $[by] $AuthorLink:  [=$ChangeSummary=]'; #just some code

The multiline [@...@] is a block markup, and in order to change the styling of these preformatted text blocks, you need to apply a "block" WikiStyle.

%block blue%[@ 
  The font color of 
  this text is blue
@]
 
  The font color of 
  this text is blue

It is also useful to use [= =] within other wiki structures, as this enables the inclusion of new lines in text values. The example below shows how to include a multi-line value in a hidden form field.

(:input hidden message "[=Line1
Line2=]":)

Comments

(:comment Some information:) can be very kind to subsequent authors, especially around complicated bits of markup.

Special Characters

Tables

Tables are defined by enclosing cells with '||'. A cell with leading and trailing spaces is centered; a cell with leading spaces is right-aligned; all other cells are left-aligned. An empty cell will cause the previous cell to span multiple columns. (There is currently no mechanism for spanning multiple rows.) A line beginning with '||' specifies the table attributes for subsequent tables. A '!' as the first character in a cell provides emphasis that can be used to provide headings.

||border=1 width=50%
||!Table||!Heading||!Example||
||!Left   || Center || Right||
||A       ||!  a B   ||     C||
||        || single ||      ||
||        || multi span   ||||
TableHeadingExample
LeftCenterRight
Aa BC
 single 
 multi span

See Table Directives for advanced tables.

Can't find it here?

See Markup Master Index.

Images and Image Thumbnails

http://www.pmwiki.org/wiki/Cookbook/ThumbList#basic-usage

Tables

more infos about tables.

Table basics

PmWiki has two types of table markup; the markup described in this page is useful for creating simple tables with lots of small cells, while table directive markups help with larger scale tables. For more possibilities with table formatting see Cookbook:Rowspan in simple tables and Cookbook:Formatting tables.

Tables are created via use of double pipe characters: ||. Lines beginning with this markup denote rows in a table or a formatting line. Within table row lines the double-pipe is used to delimit cells. In the examples below a border is added for illustration (the default is no border).

The first line in the markup contains formatting commands for the table. It only has double pipe characters at the start of the line.

Basic table
|| border=1
|| cell 1 || cell 2 || cell 3 ||
|| cell 1 || cell 2 ||
cell 1cell 2cell 3
cell 1cell 2

Header cells can be created by placing ! as the first character of a cell. Note that these are table headers, not headings, so it doesn't extend to !!, !!!, etc.

Table headers
|| border=1
||! cell 1 ||! cell 2 ||! cell 3 ||
|| cell 1  ||  cell 2 ||  cell 3 ||
cell 1cell 2cell 3
cell 1cell 2cell 3

A table can have a caption, indicated by ||!caption!||. Any caption must appear prior to other rows of the table.

Table caption
|| border=1
||! A special table !||
||! cell 1 ||! cell 2 ||! cell 3 ||
|| cell 1  ||  cell 2 ||  cell 3 ||
A special table
cell 1cell 2cell 3
cell 1cell 2cell 3

Formatting cell contents

Cell contents may be aligned left, centered, or aligned right.

  • To left-align contents, place the cell contents next to the leading ||.
  • To center contents, add a space before and after the cell contents.
  • To right-align contents, place a space before the cell contents and leave the cell contents next to the trailing ||.
Cell alignments
|| border=1 width=100%
||!cell 1      ||! cell 2  ||!       cell 3||
||left-aligned || centered || right-aligned||
cell 1cell 2cell 3
left-alignedcenteredright-aligned
Default cell alignments
|| border=1 width=100%
||!cell default||!cell left ||
||default-aligned||left-aligned ||
cell defaultcell left
default-alignedleft-aligned

Note that header and detail cells have different default alignments.

To get a cell to span multiple columns, follow the cell with empty cells. (At present there is no markup for spanning rows.)

Column spanning
|| border=1 width=100%
|| |||| right column ||
|| || middle column ||||
|| left column ||||||
|| left column || middle column || right column ||
 right column
 middle column
left column
left columnmiddle columnright column

Table attributes

Any line that begins with || but doesn't have a closing || sets the table attributes for any tables that follow. These attributes can control the size and position of the table, borders, background color, and cell spacing. (In fact these are just standard HTML attributes that are placed in the <table> tag.)

Use the width= attribute to set a table's width, using either a percentage value, an absolute size, or *.

Table width
|| border=1 width=100% 
|| cell 1 || cell 2 || cell 3 ||
|| c1 || cellcellcellcell2 || cell 3 ||
cell 1cell 2cell 3
c1cellcellcellcell2cell 3

The border= attribute sets the size of a table's borders.

Bordered table
|| border=10 width=70%
||!cell 1      ||! cell 2  ||!      
cell 3||
||left-aligned || centered ||
right-aligned||
cell 1cell 2cell 3
left-alignedcenteredright-aligned
Borderless table
|| border=0 width=70%
||!cell 1      ||! cell 2  ||!      
cell 3||
||left-aligned || centered ||
right-aligned||
cell 1cell 2cell 3
left-alignedcenteredright-aligned

Use align=center, align=left, and align=right to center, left, or right align a table. Note that align=left and align=right create a floating table, such that text wraps around the table.

Table alignment: center
|| border=1 align=center width=50%
||!cell 1      ||! cell 2  ||!       cell 3||
||left-aligned || centered || right-aligned||
Notice how text does not wrap with a table using "align=center".
cell 1cell 2cell 3
left-alignedcenteredright-aligned

Notice how text does not wrap with a table using "align=center".

Table alignment: left
|| border=1 align=left width=50%
||!cell 1      ||! cell 2  ||!       cell 3||
||left-aligned || centered || right-aligned||
Notice how text wraps to the right of a table using "align=left".
cell 1cell 2cell 3
left-alignedcenteredright-aligned

Notice how text wraps to the right of a table using "align=left".

Table alignment: right
|| border=1 align=right width=50%
||!cell 1      ||! cell 2  ||!       cell 3||
||left-aligned || centered || right-aligned||
Notice how text wraps to the left of a table using "align=right".
cell 1cell 2cell 3
left-alignedcenteredright-aligned

Notice how text wraps to the left of a table using "align=right".

Note: to get a table to align left (but not "float left") requires CSS, as in
||style="margin-left:0px;"

The bgcolor= attribute sets the background color for a table. At present there is no way to specify the color of individual rows or cells in this type of table (but see Cookbook:FormattingTables).

|| border=1 align=center bgcolor=yellow
width=70%
||!cell 1    ||! cell 2 ||!     cell
3||
||left-align || center  ||
right-align||
cell 1cell 2cell 3
left-aligncenterright-align

How do I create a basic table?

Tables are created via use of the double pipe character: ||. Lines beginning with this markup denote rows in a table; within such lines the double-pipe is used to delimit cells. In the examples below a border is added for illustration (the default is no border).

Basic table
|| border=1 rules=rows frame=hsides
|| cell 1 || cell 2 || cell 3 ||
|| cell 1 || cell 2 || cell 3 ||
cell 1cell 2cell 3
cell 1cell 2cell 3

How do I create cell headers?

Header cells can be created by placing ! as the first character of a cell. Note that these are table headers, not headings, so it doesn't extend to !!, !!!, etc.

Table headers
|| border=1 rules=cols frame=vsides
||! cell 1 ||! cell 2 ||! cell 3 ||
|| cell 1  ||  cell 2 ||  cell 3 ||
cell 1cell 2cell 3
cell 1cell 2cell 3

How do I obtain a table with thin lines and more distance to the content?

"Thin lines" is tricky and browser dependent, but the following works for Firefox and IE (Nov. 2009):

Thin lines and cell padding
||border="1" bordercolordark="black"
bordercolorlight="black"
style="border-collapse:collapse"
cellpadding="5" width=66%
||!Header || !Header|| '''Header'''||
||cells   || with   ||      padding||
||        ||        ||             ||
Header!HeaderHeader
cellswithpadding
   

How do I create an advanced table?

See table directives

My tables are by default centered. When I try to use '||align=left' they don't align left as expected.

Use ||style="margin-left:0px;" instead.

How can I specify the width of columns?

You can define the widths via custom styles, see Cookbook:FormattingTables and $TableCellAttrFmt. Add in config.php : $TableCellAttrFmt = 'class=col\$TableCellCount';

And add in pub/css/local.css :
table.column td.col1 { width: 120px; }
table.column td.col3 { width: 40px; }

How can I display a double pipe "||" in cell text using basic table markup?

Escape it with [=||=] to display || unchanged.

How to I apply styles to the elements of the table, like an ID to the table row, or a class/style to the TD?

See $WikiStyleApply.

Toggle Buttons

http://www.pmwiki.org/wiki/Cookbook/Toggle

Source Code

SyntaxHighlighter is a fully functional self-contained code syntax highlighter developed in JavaScript. Use the following markup to embed source code within your page.

(:code PARAMETERS:)[@
source code
@]
      or      (:code PARAMETERS:)
source
(:codeend:)

Parameters

ParameterDefault ValueDescription
auto_linkstrueAllows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won't be clickable.
collapsefalseAllows you to force highlighted elements on the page to be collapsed by default.
first_line1Allows you to change the first (starting) line number.
guttertrueAllows you to turn gutter with line numbers on and off.
highlightnullAllows you to highlight one or more lines to focus user's attention. When specifying as a parameter, you have to pass an array looking value, like [1, 2, 3] or just an number for a single line.
html_scriptfalseAllows you to highlight a mixture of HTML/XML code and a script which is very common in web development. Setting this value to true requires that the brush you are using supports this feature.
lightfalseAllows you to disable toolbar and gutter with a single property.
rulerfalseAllows you to show column ruler on top of highlighted elements.
smart_tabstrueAllows you to turn smart tabs feature on and off.
tab_size4Allows you to adjust tab size.
toolbartrueToggles toolbar on/off.
langplainSelects the language.
wrap_linestrueAllows you to turn line wrapping feature on and off.

Supported Languages

Brush NameBrush Aliases
ActionScript3as3, actionscript3
Bash/Shellbash, shell
ColdFusioncf, coldfusion
C#c-sharp, csharp
C++cpp, c
CSScss
Delphidelphi, pas, pascal
Diffdiff, patch
Erlangerl, erlang
Groovygroovy
JavaScriptjs, jscript, javascript
Javajava
JavaFXjfx, javafx
Perlperl, pl
PHPphp
Plain Textplain, text
PowerShellps, powershell
Pythonpy, python
Rubyrails, ror, ruby
Scalascala
SQLsql
Visual Basicvb, vbnet
XMLxml, xslt, html, xhtml

Demonstration

Example HTML code with embedded PHP script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>SyntaxHighlighter Demo</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<body>
	<div style="font-weight: bold"><?= str_replace("\n", "<br/>", $var) ?></div>

	<?
	/***********************************
	 ** Multiline block comments
	 **********************************/

	$stringWithUrl = "http://alexgorbatchev.com";
	$stringWithUrl = 'http://alexgorbatchev.com';

	ob_start("parseOutputBuffer");		// Start Code Buffering
	session_start();
	?>
</body>
</html>

If JavaScript is disabled it will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>SyntaxHighlighter Demo</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<body>
	<div style="font-weight: bold"><?= str_replace("\n", "<br/>", $var) ?></div>

	<?
	/***********************************
	 ** Multiline block comments
	 **********************************/

	$stringWithUrl = "http://alexgorbatchev.com";
	$stringWithUrl = 'http://alexgorbatchev.com';

	ob_start("parseOutputBuffer");		// Start Code Buffering
	session_start();
	?>
</body>
</html>