Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

MarkupTricks

Summary: Markup tricks
Version:
Prerequisites: Should work on any v 2.0 PmWiki
Status:
Maintainer:
Categories: Markup

This page provides "markup tricks". Some workarounds to get to certain display results using existing markup.

Do not confuse this page with MarkupExtensions, which adds new markup to PmWiki.

Commenting out long blocks on a page

Also known as: multiline comments

If you want to put many lines of comments on a page that are only visible in edit view and that can include directives that you don't want processed, use the "if false" trick:

this text will be visible
(:if false:)
here is some
text
(:searchbox:)
with other directives
(:if:)
but the intervening lines will only show in edit view

this text will be visible
but the intervening lines will only show in edit view

Spaceless block preformat

How can I do spaceless block preformat - that is, preformat multiple lines without prefixing each line with a single space? For instance, I want to display a code block in the wiki.

The answer is our old friend, [=...=], but with a space on the line before the opening bracket. Here is an example:

 
 [= 
int main(int argc, char** argv)
{
  time_t epoch;
  char sdate[MAXS];
  struct tm* tmP;
  if (argc<2) {
    USAGE(NULL);
  }
} 

=]

In newer releases (~beta52) this is a good markup for code

[@ 
  a=b;
  c=b;

@]

If you are marking up a lot of code samples, you should check out SourceBlock.

Indenting blocks of text with line breaks

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.

(:linebreaks:)

This is normal text, no indentation.

-> Here is some indented
   text with line breaks
   in the middle of the text.

   We can even continue the indentation 
   across paragraphs.

Now we're back to normal again.

This is normal text, no indentation.

Here is some indented
text with line breaks
in the middle of the text.
We can even continue the indentation
across paragraphs.

Now we're back to normal again.

Displaying directives

I tried to post a note to my authors saying:

If you enter 3 tildes (~~~) in a row, PmWiki will automatically insert your name. My markup was:

 ... 3 tildes [=(~~~)=] in a row ...

which renders exactly the way I want in preview, but renders when saved as:

 ... 3 tildes (NeilHerber) in a row ...

The problem is that the 3 tildes are a "replace on save" markup -- the tildes are replaced with the
author's name at the time the page is saved. For a variety of reasons, it's not a trivial matter to preserve them when they appear inside of [=...=].

The workarounds are anything that causes the three tildes to not directly appear together, such as:

    [=~~=]~
    ~&#126;~

This trick can be generalized to display any markup that you don't want rendered. The rule of thumb is to break up the markup with the [=...=] construct. WARNING: Reading the markup on this page in edit mode makes my head hurt!

Insert spacing within a text line

To insert additional spacing in a textline you can use space characters from the SpecialCharactersList like &ensp; &emsp; &thinsp; &nbsp; .

 

Some &ensp; &ensp; spacing

Some     spacing

Notes and Comments

I put these items here just to keep them from getting lost. Feel free to move them elsewhere if it makes more sense.

-- NeilHerber March 16, 2005, at 12:24 PM

See Also

Contributors

NeilHerber March 16, 2005, at 12:24 PM

Edit - History - Print - Recent Changes - Search
Page last modified on March 23, 2007, at 09:03 PM