WikiStyles allow authors to modify the color and other styling attributes of a page's contents. A wikistyle is written using percent-signs, as in
The most basic use of wikistyles is to change text attributes such as color, background color, and font. PmWiki defines several wikistyles for changing the text color to %black%, %white%, %red%, %yellow%, %blue%, %gray%, %silver%, %maroon%, %green%, %navy%, and %purple%.
The basket contains %red% apples, %blue% blueberries, %purple% eggplant, %green% limes, %% and more.
The basket contains apples, blueberries, eggplant, limes, and more.
For colors other than the predefined colors, use the
%color=...% wikistyle. (Note: RGB colors (#rrggbb) should always be specified with lowercase letters to avoid WikiWord conflicts.)
I'd like to have some %color=#ff7f00% tangerines%%, too!
I'd like to have some tangerines, too!
To change the background color, use
%bgcolor=...% as a wikistyle:
This sentence contains %bgcolor=green yellow% yellow text on a green background.
This sentence contains yellow text on a green background.
Wikistyles can also specify a scope; with no scope, the style is applied to any text that follows up to the next wikistyle specification or the end of the paragraph, whichever comes first. Including a scope changes the specification to apply to the whole paragraph (
%p ...%), an entire list (
%list ...%), an item within a list (
%item ...%), or any block (
%p bgcolor=#ffeeee% The wikistyle specification at the beginning of this line applies to the entire paragraph, even if there are %blue% other wikistyle specifications %% in the middle of the paragraph.
The wikistyle specification at the beginning of this line applies to the entire paragraph, even if there are other wikistyle specifications in the middle of the paragraph.
>>style<< block can be used to apply a wikistyle to a large block of items. The style is applied until the next
>><< is encountered.
>>blue font-style=italic bgcolor=#ffffcc<< Everything after the above line is styled with blue italic text, This includes preformatted text * lists -> indented items >><<
Everything after the above line is styled with blue italic text,
The style attributes recognized within a wikistyle specification are:
------------ CSS ------------- --HTML-- color bgcolor class background-color margin id text-align padding hspace text-decoration border vspace font-size float target font-family list-style rel font-weight width* accesskey font-style height* value Special: define, apply
The attributes in the first two columns correspond to the cascading style sheet (CSS) properties of the same name. The attributes in the last column apply only to specific items:
id=assign a CSS class or identifier to an HTML element
target=nameopens links that follow in a browser window called "name"
rel=namein a link identifies the relationship of a target page
accesskey=xuses 'x' as a shortcut key for the link that follows
value=9sets the number of the current ordered list item
define= attribute can be used to assign a shorthand name to any wikistyle specification. This shorthand name can then be reused in later wikistyle specifications.
%define=box block bgcolor=#ddddff border="2px dotted blue"% %box% [@ $ echo "Hello world" Hello World $ exit @] %box font-weight=bold color=green% [@ $ echo "I said, HELLO" @]
$ echo "Hello world" Hello World $ exit
$ echo "I said, HELLO"
Tip: It's often a good idea to put common style definitions into Group Header pages so that they can be shared among multiple pages in a group. Or, the wiki administrator can predefine styles site-wide as a local customization (see CustomWikiStyles).
Tip: Use custom style definitions to associate meanings with text instead of just colors. For example, if warnings are to be displayed as green text, set
%define=warn green% and then use
%warn% instead of
%green% in the document. Then, if you later decide that warnings should be styled differently, it's much easier to change the (one) definition than many occurrences of
%green% in the text.
PmWiki defines a number of style shortcuts.
%ALPHA%(see also Cookbook:OutlineLists)
WikiStyleExamples contains a number of examples of ways to use wikistyles in pages.
%block width=50% %) don't work currently, as there's a problem to separate them from style-markup ending ones.