[logo]
World Carfree Network - PmWiki

PmWiki continues to use Wiki Styles as a mechanism for styling text with color and other attributes. However, PmWiki 2.0 introduces the ability to control the styling further and to even place styles on blocks.

The basics of Wiki Styles are the same as before--essentially a style is specified within a pair of %-signs and styles the text that follows, as in:

This text is %color=red% red, %color=blue% blue, %% and normal
(black).

This text is red, blue, and normal (black).

There are a wide number of available style properties, borrowed primarily from HTML and CSS. In addition, an author can define a style "shortcut" by using the define= property. For example, to define a style of %red%, one can use:

%color=red define=mystyle%
Here is some %mystyle% red text created using a style shortcut.

Here is some red text created using a style shortcut.

Shortcuts can be combined with other styles, including other shortcuts:

%color=red define=lovelyred%
%bgcolor=yellow define=likegrapefruit%

%red% This text is red, %red bgcolor=#ccc% red on a grey background,
and %lovelyred likegrapefruit% red on a yellow background.  

This text is red, red on a grey background, and red on a yellow background.

So far, this is all basically the same as what was available in PmWiki 1.0. PmWiki 2.0 includes the capability to style blocks, by using the apply= style property. Specifying apply=block in a WikiStyle will cause that style to be applied to the entire block, instead of just the text that follows:

This entire block %apply=block bgcolor=yellow% has a yellow
background, even though the `WikiStyle appears in the middle of the
line.  %bgcolor=pink% Other inline (non-block) [[Wiki Styles]] can
appear in the middle of the line,%% as before.

This entire block has a yellow background, even though the WikiStyle appears in the middle of the line. Other inline (non-block) Wiki Styles can appear in the middle of the line, as before.

This means it's now possible to do right-aligned and centered text:

%block text-align=right% The text of this paragraph is right-aligned. 

%block text-align=center% The text of this paragraph is centered.  

The text of this paragraph is right-aligned.

The text of this paragraph is centered.

In fact, PmWiki predefines %right% and %center% style shortcuts so that you can do this more simply:

%right% This is right-aligned.

%center% This is centered.

This is right-aligned.

This is centered.

Authors can define their own custom styles:

%block bgcolor=#fdf define=Pm%
%center bgcolor=#dfd border='3px dotted green' define=goofy%
%right bgcolor=#ffffcc border='1px dotted red' define=rediguana%

%Pm% Any text that is on a light purple background is a comment from
[[~Pm]].

%goofy% Here's some text from Goofy.

%rediguana% bla bla by rediguana!

Any text that is on a light purple background is a comment from Pm?.

Here's some text from Goofy.

bla bla by rediguana!

Styles can be applied to almost any kind of block:

* %block bgcolor=yellow% Here is a list item
* Here's another list item

* Here's more of a list

# A new list

  • Here is a list item
  • Here's another list item

  • Here's more of a list

  1. A new list

In particular, this means that outlines are now possible using the predefined %ROMAN%, %roman%, %ALPHA%, and %alpha% list-block styles. The style has to be specified on the first item in the list (and we may develop an alternate syntax for this sort of ordered list):

# %ROMAN% Top level
## %ALPHA% second-level
## second-level
## second-level
### third-level
### third-level
## second-level
### third-level
#### %alpha% fourth-level
##### %roman% fifth-level
##### fifth-level
#### fourth-level
# top-level
# top-level

  1. Top level
    1. second-level
    2. second-level
    3. second-level
      1. third-level
      2. third-level
    4. second-level
      1. third-level
        1. fourth-level
          1. fifth-level
          2. fifth-level
        2. fourth-level
  2. top-level
  3. top-level

Wiki Styles can be combined with CSS stylesheets to do this automatically -- see Cookbook:Outline Lists.


What about marking up an entire block of pre-formatted text? For instance, say I have the following :

ip access-list extended example-acl

 remark ** This is an example acl **
 deny ip any host 10.0.0.1
 permit ip any any

I'd like to mark the above in a green box with a border. I know I need to use %block bgcolor=#dfd border='1px solid black' padding=5px for the box, but how do I apply it to the entire block? If I place \\ at the end of each line, I lose the indent at the beginning of the line...

Use [=...=] to preserve the newlines in the block, as below (note the space at the beginning of the line containing the wikistyle):

 
 %block bgcolor=#dfd border='1px solid black' padding=5px% [=
ip access-list extended example-acl
 remark ** This is an example acl **
 deny ip any host 10.0.0.1
 permit ip any any
 =]

This results in

  
ip access-list extended example-acl
 remark ** This is an example acl **
 deny ip any host 10.0.0.1
 permit ip any any
 

Awesome, thanks! I think that's the only combination I didn't try!


Using the above example is there anyway to avoid it from making long paragraphs going off the side of the page (width wise) when it is not contained in a visable and defined box, such that I can have a long piece of text in one colour and can make amendments in another? (without it making the webpage really wide and losing easy access to edit, recent history etc)

Also I am using custom styles defined in my config.php. There is an example that uses this above but because it is using a markup box it seemes to stop it from scrolling off page. without it it does the same thing i'm experiancing. I've also noticed it seems to stop url turning into links as well. Please help!


Change a style class of a Wiki Link? (or other element)

Is there anyway to define a style that overwrites the default class value given to a wiki link?

Examples of style properties I would like to apply;

  
a.linklevel1 {background-color:#003E49; color:black;
    		width:144px; margin:0px;
		font-weight:bold; font-size:10pt; font-family: arial;}
a.linklevel1:hover {text-decoration:none; color:black; background:orange; cursor:hand;}
a.linklevel1:link {text-decoration:none; color:white;}
a.linklevel1:visited {text-decoration:none; color:white;}

I guess a usage like,

 
%class=a.linklevel1%[[TheFunkyWikiLink]]

<< WikiStyleColors | PmWiki.Documentation Index | Directives >>

Page last modified on July 07, 2005, at 10:40 PM

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.