[Home]TextFormattingRules

HomePage | RecentChanges | Preferences | My Website home page

The Usemod markup extension is a Module?. Installing a module is easy: Create a subdirectory called "modules" in your data directory, and put the Perl file in there. It will be loaded automatically.

Download module:

[Usemod] is Oddmuse's predecessor. It inherited a lot of the formatting rules from the original [Portland Pattern Repository], and added some more. Usemod was used in the very early stages of Wikipedia, so it influenced the most famous wiki project significantly.

Using the Usemod markup extension will give you the following text formatting rules:

[::Numbered List]

Numbered list items start with one or more hashes (#) and a space. The number of hashes indicates the indentation level. An empty line ends the list.

Example:

# One item
# Another item
## One More

Result:

  1. One item
  2. Another item
    1. One More

[::Definition List]

Definition lists start with a semicolon (;) and a space. A colon (:) is used between term and definition. The number of semicolons indicates the indentation level. An empty line ends the list.

Example:

; foo: a generic placeholder
; bar: a generic placeholder
;; baz: a variation

Result:

foo
a generic placeholder
bar
a generic placeholder
baz
a variation

[::Join Lists Together]

You can join lists together just like what you do in HTML. Here is an example:

# 1st item
** item
** item
### subitem1
### subitem2
# items

Result:

  1. 1st item
  1. items

(The HTML will be wrong, however...)

[::Tables]

'''Table rows start and end with two vertical bars (||), with two vertical bars between cells.''' Empty cells fuse with the next cell; in other words, ||||bar|| is a table row with a cell spanning two columns.

Example:

||foo||bar||
||||bar||

Result:

foobar
bar

Whitespace around cell-content controls alignment. If you leave whitespace on both sides, the cell is centered. If you leave whitespace on the right, the cell is aligned to the left, and if you leave whitespace on the left, the cell is aligned to the right.

||fnordifnord||
||  foo  ||
||bar    ||
||    baz||

Result:

fnordifnord
foo
bar
baz

[::Indented Paragraphs]

Indented paragraphs start with one or more colons (:). The number of colons indicates the indentation level. An empty line ends the indented paragraph.

Example:

: One item
: Another item
:: One More

Result:

One item
Another item
One More

[::Headings]

Headings are enclosed in equals signs (=) on a line of their own. You can use up to six equals signs to produce headings of level one to six. Level one is the most important one, and should not be used because the page title already uses a level one heading. This is why level one headings are automatically translated to level two headings.

Using two or three equal signs is recommended (== like this ==).

Example:

=== Heading 3 ===
==== Heading 4 ====

Result:

Heading 3

Heading 4

[::Horizontal Lines]

'''Four or more consecutive hyphens on a line of their own (


) are replaced with a horizontal line.'''

Example:

----

Result:


[::Source Code]

'''Lines starting with spaces are shown using a fixed width font with whitespace preserved.''' I suggest the use of a uniform indentation of four spaces.

Example:

    foo bar

Result:

    foo bar

[::Traditional Wiki Markup]

Two and three apostrophes are used for emphasis and strong emphasis.

Example:

''two apostrophes'' and '''three apostrophes'''

Result:

two apostrophes and three apostrophes

[::HTML Tags]

Some HTML tags are also allowed. These tags are used exactly like HTML tags.

Example:

<b>this will be bold</b>

Result:

this will be bold

Supported tags without extra configuration:

em
Emphasis (usually italics)
i
Italics
strong
Strong (usually bold)
b
Bold
u
<u>Underline</u>
tt
Teletype (usually monospaced)

See HTML?.

Traditional HTML links are enabled if HtmlLinks? is set

Example:

<a href="http://example.com/">text</a>

Result:

[text]

[::Disable Text Formatting Rules]

The following tags will disable text formatting rules:

nowiki
disable text formatting rules
code
monospaced font, disable text formatting rules
pre
monospaced fonts, no line wrapping, disable text formatting rules

Example:

<code>[[foo]]</code>

Result:

[[foo]]

[::Special Link Patterns]

In order to link to Request For Comments (RFC), just write them into the text (the keyword RFC and the number should be on the same line).

Example: RFC 822.

In order to link to a book, just write the International Standard Book Number (ISBN) into the text (the keyword ISBN and the number should be on the same line).

Example: ISBN 020171499X (amazon.com, search)

In order to change the websites an ISBN links to, use the translation mechanism to translate the URLs. See Translations?.

Here is a very simple example if you don't normally use translation. Put the following in your config file:

    %Translate = split('\n',<<END_OF_TRANSLATION);
    http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=%s
    http://www.buchkatalog.de/kod-bin/isuche.cgi?lang=deutsch&caller=butotest&field1=SB&name1=%s
    alternate
    amazon.de
    http://www.amazon.com/exec/obidos/ISBN=%s
    http://www.amazon.de/exec/obidos/ISBN=%s
    search
    isbn.nu
    http://www.pricescan.com/books/BookDetail.asp?isbn=%s
    http://isbn.nu/%s
    END_OF_TRANSLATION

CSS

table.user
Tables produced by this module belong to the class user.

CSS Example

    table.user {
        border-style:solid;
        border-width:thin;
    }
    table.user tr td {
        border-style:solid;
        border-width:thin;
        padding:5px;
    }

Option: $UseModSpaceRequired

Default: 1

You can set this to 0 if you want to make this extension a bit more compatible with the original Usemod rules. When set to 0, no space is required after *, #, :, and ;. Conversely you may be bothered by the small annoyances that prompted the original change: If your users use a smiley at the beginning of a line, or use *bold* at the beginning of a line, they will be surprised:

This turns into a list item:

    *bold* at the beginning of a line

This turns into an indented closing parenthesis followed by some text:

    :) some text

The default value of $UseModSpaceRequired avoids these issues.

Option: $UseModExtraSpaceRequired

Default: 0

You can set this to 1 if you want to change the default behavior for definition lists.

This is the default behavior:

{{{

meeting
a boring event
}}}

It's problematic if you want a term containing a colon in the term:

{{{

meeting at 10
30: a boring event
}}}

This will not work as expected. If you set ##$UseModExtraSpaceRequired = 1## in your config file, you can write it as follows:

{{{

meeting at 10
30 : a boring event
}}}

The *extra space* required is the space *before the colon*.

Option: $UseModMarkupInTitles

Default: 0

You can set this to 1 if you want to make this extension a bit more compatible with the original Usemod rules. When set to 1, you can use wiki markup inside the title.

By default, the title does not linked:

FooBar

If you set this option to 1, the above would link to the page FooBar.

Option: $HtmlLinks

Default: 0

This option controls whether HTML links are rendered correctly.

Example: <a href="http://www.emacswiki.org/>Emacs Wiki</a> is an HTML link.


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions
Last edited October 1, 2013 8:51 pm by dougrice.plus.com
Search: