Wiki Styles allow an author to modify the color and other attributes of wiki text.

Specifying styles

A style specification is written as

  %scope style=value style=value ...%

The scope part defines what is affected by the style:

  • No scope: everything from the style specification to the end of the paragraph, the next style specification, or an empty style specification , whichever comes first.
  • item: The list item that contains the style specification.
  • list: The list that contains the style specification.
  • p: The paragraph that contains the style specification.
  • block: The block element (paragraph, section, list, list item, preformatted text, or header) that contains the style specification.

The style parts define what aspect is changed:

  • color: What color to use for text (CSS).
  • bgcolor: What background color to use (CSS).
  • text-align: How to align text (CSS).
  • text-decoration: How to decorate text (underline, line-through etc.) (CSS).
  • font-size: What %font-size:−1% to use for text (CSS).
  • font-family: What font family to use for text (CSS).
  • font-weight: What font weight to use for text (CSS).
  • font-style: What font style to use for text (CSS).
  • height: The height of images (HTML <img>).
  • width: The width of images (HTML <img>).
  • vspace: How much vertical space to reserve for images (HTML <img>).
  • hspace: How much horizontal space to reserve for images (HTML <img>).
  • align: What alignment to use for images (HTML <img>).
  • target: What browser window any links should refer to (HTML <img>).
  • rel: What kind of reference the link will be (HTML <img>).

The value parts define values. For attributes that are marked with (CSS), they are passed through as CSS styles; for those that are marked with (HTML <tag>), they are passed to all HTML <tag> tags.

Canned styles

It is possible to define a name for a style specification. This is written as

  %define=name style=value style=value ...%

This makes name stand in as a replacement for the style=value pairs in style definitions.

Predefined styles

See Custom Wiki Styles.

Tips

It’s often a good idea to put common style definitions into Group Headers so that they can be shared among multiple pages in a group. Or, the Wiki Administrator can predefine styles as a Local Customization — see Custom Wiki Styles.

Examples

See also Wiki Style Examples.

Actually the remaining text on this page should go to Wiki Style Examples.

Use predefined styles for text following the markup:

%red% This text is red and %blue% this text is blue %% but this text
is normal.

This text is red and this text is blue but this text is normal.

Use a predefined style to affect all links that follow it:

%newwin%Now all links like http://www.pmichaud.com go to a new window.

Now all links like http://www.pmichaud.com go to a new window.

Using an ad-hoc style:

%color=red% This text is red and %color=blue% this text is blue %% but
this text is normal.

This text is red and this text is blue but this text is normal.

Applying an ad-hoc style to the entire block (This isn’t working - why?):

This is some text %block color=red% that is being colored red by the
wikistyle in the line.

This is some text that is being colored red by the wikistyle in the line.

Fun with lists:

* Fir%bgcolor=silver%st
* second
* third
  • First
  • second
  • third

* Fir%item bgcolor=silver%st
* second
* third
  • First
  • second
  • third

* Fir%list bgcolor=silver%st
* second
* third
  • First
  • second
  • third

NOT WORKING - why?

* Fir%p bgcolor=silver%st
* second
* third
  • First
  • second
  • third

* Fir%block bgcolor=silver%st
* second
* third
  • First
  • second
  • third

Mucking around with the background color:

%color=black bgcolor=green% This text is black on green %color=green
bgcolor=black% and this is green on black.%% 

This text is black on green and this is green on black.

Image resizing:

  %height=50% http://www.example.com/some.gif

will display some.gif scaled to a height of 50 pixels.

Style definitions:

  %define=hotpink color=#ff69b4%

will make hotpink stand in for color=#ff69b4 in any style definitions.
One can specify multiple items in a definition, as in

  %define=reverse color=white bgcolor=black%

which gives us

%reverse%reverse video%%\\
%reverse hotpink%reverse hotpink%%

reverse video
reverse hotpink

Predefined and custom styles

See Custom Wiki Styles for a description of the Wiki Styles that are predefined in a standard installation of PmWiki. That page also describes how an administrator can predefine additional Wiki Styles.

Colors

For some examples of colors, see Wiki Style Colors?.

« Advanced tables | PmWiki.Documentation Index | WikiStyleColors? »

Last edited by Ed Wildgoose.   Page last modified on June 16, 2005

Legal Information |  Designed and built by Emergency Digital. | Hosted by Steadfast Networks