Skip to content

Wikitext syntax ​

Pages on a ProjectWikit site are written in wikitext, the markup language used by Wikidot. Pages written for Wikidot display the same way here.

This document describes every construct the renderer understands. Modules ([[module ...]]) are described in Modules. To try a piece of wikitext without saving a page, use the editor preview, or pwikit render on the server (see Command line).

Where Markdown can reproduce the output, an example is followed by its result.

Basics ​

Blocks ​

Most constructs are blocks written in double square brackets:

text
[[name argument="value"]]
content
[[/name]]
  • Block names are case-insensitive: [[DIV]] and [[div]] are the same. Spaces inside the brackets are allowed: [[ div ]] … [[/ div ]].
  • Blocks without content, such as [[image]] or [[toc]], have no closing tag.
  • Argument values must be in double quotes: class="note". An argument written without quotes is ignored. Write a quote inside a value as \". A value may continue onto the next line; the line breaks are removed from it.
  • Some blocks take a plain value after the name instead of, or before, named arguments: [[size 150%]], [[image photo.png width="200"]].
  • An underscore after the name changes how line breaks inside are handled, for example [[div_]] (see Containers and attributes). The closing tag is written without it: [[/div]].
  • A star before the name selects a variant, for example [[*user name]] (with avatar) or [[*a]] (opens in a new tab).
  • A block that is never closed is shown as plain text.

To put a closing tag of the same name inside a block whose content is not parsed, give the outer block an identifier after a colon and close it with the same identifier:

text
[[code:example]]
[[code]]
Sample
[[/code]]
[[/code:example]]

Result:

[[code]]
Sample
[[/code]]

Where syntax is limited ​

WhereNot available
PagesEverything in this document is available
Forum posts[[toc]], [[include]], [[module]], [[button]], [[gallery]], [[input]]…[[/input]], images of attached files, [[#expr]], [[#ifexpr]], [[ifexpr]], script variables and math
BioAll [[...]] blocks, including [[$ … $]], and {@name}. Formatting, lists and links work.

Text formatting ​

SyntaxResult
**bold**bold
//italic//italic
__underline__underline
--strikethrough--strikethrough
{{monospace}}monospace
^^superscript^^superscript
,,subscript,,subscript
##red|colored text##text in red
##ff8800|colored text##text in #ff8800
  • There must be no space between a marker and the text: ** bold ** is not bold.
  • Formatting may continue over several lines of one paragraph, but not over a blank line.
  • Formatting can be nested and can contain other elements, including blocks.
  • The color can be any CSS color, such as blue or rgba(255, 127, 0, 0.5). For hexadecimal colors the # is optional.
  • {{...}} changes only the font. Markup inside it is still interpreted; use @@...@@ for literal text.

The same styles are available as blocks, which also accept attributes:

StyleBlock names
Bold[[b]], [[bold]], [[strong]]
Italic[[i]], [[italics]], [[em]], [[emphasis]]
Underline[[u]], [[underline]]
Strikethrough[[s]], [[strikethrough]]
Deleted text[[del]], [[deletion]]
Inserted text[[ins]], [[insertion]]
Superscript[[sup]], [[super]], [[superscript]]
Subscript[[sub]], [[subscript]]
Monospace[[tt]], [[mono]], [[monospace]]
Highlight[[mark]], [[highlight]]
text
Some [[b]]bold[[/b]] and [[mark class="key"]]highlighted[[/mark]] text.
This is [[size 150%]]larger[[/size]] and this is [[size 0.8em]]smaller[[/size]].

[[size]] takes any CSS font size and no other arguments.

Paragraphs and line breaks ​

  • A single line break inside a paragraph becomes a line break.
  • A blank line starts a new paragraph. Several blank lines count as one.
  • An underscore at the end of a line, after a space ( _), forces a line break. Use it inside list items and table cells. A line holding only _ adds an empty line:
text
First line
_
_
Two empty lines above this one.

Result:

First line


Two empty lines above this one.

  • A backslash at the end of a line joins the next line to it without any break. This applies everywhere, including inside [[code]].
  • A line holding only an empty element, such as @@@@ or [[span]][[/span]], displays as an empty line without starting a new paragraph.
  • [[lines 3]] inserts the given number of line breaks, from 1 to 100. [[newlines 3]] is the same.
  • [[p]]...[[/p]] (or [[paragraph]]) applies attributes to the paragraphs inside it:
text
[[p style="color: red"]]
A red paragraph.
[[/p]]
  • A line of three or more hyphens (---) is a horizontal rule.
  • ~~~ on its own line clears floating elements on both sides; ~~~< clears the left side and ~~~> the right side.

Headings and table of contents ​

text
+ Heading level 1
++ Heading level 2
+++ Heading level 3
++++ Heading level 4
+++++ Heading level 5
++++++ Heading level 6
++* Heading left out of the table of contents
  • A heading starts at the beginning of a line, and a space must follow the plus signs.
  • A heading occupies one line. Formatting and inline blocks are allowed inside it.

[[toc]] inserts a table of contents listing the page's headings. [[f<toc]] and [[f>toc]] float it to the left or right so that text flows around it.

When a page has a table of contents, its headings get the anchors toc0, toc1, toc2 … in order, skipping headings marked with *. Link to one with [#toc1 Second heading].

SyntaxResult
[[[page-name]]]Link labeled with the page name
[[[page-name|]]]Link labeled with the page title, or with the name if the page does not exist
[[[page-name|Label]]]Link with your own label
[[[category:page-name]]]Link to a page in a category, labeled page-name
[[[page-name#anchor|Label]]]Link to an anchor on that page
[[[*page-name|Label]]]Link that opens in a new tab
  • The name is normalized the way page addresses are: [[[Some Page Title]]] links to /some-page-title.
  • A link to a page that does not exist yet gets the newpage class, which themes usually show in a different color.
  • Links to pages are recorded, so the target page lists this page under Backlinks.
  • The label cannot continue onto another line.
SyntaxResult
[https://example.com Label]Link to an address
[*https://example.com Label]The same, opening in a new tab
[/some/path Label]Link to an address on this site
[[[https://example.com|Label]]]Link to an address, triple-bracket form
https://example.comPlain addresses starting with http://, https:// or ftp:// become links
  • In the single-bracket form the address cannot contain spaces; the label can.
  • To stop a plain address from becoming a link, write it as literal text: @@https://example.com@@.
  • Addresses starting with javascript: are not turned into links. The only exception is javascript:;, a link that does nothing.

A triple-bracket link whose target starts with ! and a known prefix points to another website:

text
[[[!wikipedia:Wiki|Wiki on Wikipedia]]]
[[[!google:wikitext]]]

Result:

Wiki on Wikipedia
wikitext

PrefixDestination
wikipedia, wpWikipedia article
commonsWikimedia Commons page
googleGoogle search
duckduckgo, ddgDuckDuckGo search
dictionaryDictionary.com entry
thesaurusThesaurus.com entry

Spaces in the target are encoded in the address.

Anchors ​

SyntaxResult
[[# section-name]]Creates an anchor named section-name. The space after # is required.
[#section-name Label]Link to an anchor on the same page
[# Label]A link that goes nowhere, for use with scripts or styles

The [[a]] block ​

[[a]] (or [[anchor]]) is a link whose content can hold any markup, with attributes:

text
[[a href="/some-page" class="button-link"]]**Open** the page[[/a]]
[[*a href="https://example.com"]]Opens in a new tab[[/a]]

Result:

Open the page
Opens in a new tab

[[a_]] removes line breaks at the start and end of its content.

Lists ​

text
* Bulleted item
* Another item
 # Numbered item inside it
 # Second numbered item
* Item with a line break _
continued on the next line

Result:

  • Bulleted item

  • Another item

    1. Numbered item inside it
    2. Second numbered item
  • Item with a line break
    continued on the next line

  • * starts a bulleted item and # a numbered item, at the start of a line followed by a space.

  • Leading spaces set the nesting level. Bulleted and numbered lists can be nested inside each other.

  • To continue an item on a new line, end the line with _, or wrap the text in [[span]]...[[/span]].

Definition lists:

text
: Term : Definition
: Another term : Its definition

Result:

Term
Definition
Another term
Its definition

Lists can also be written as blocks, which accept attributes:

text
[[ul class="steps"]]
[[li]]First[[/li]]
[[li]]Second
[[ol]]
[[li]]Nested[[/li]]
[[/ol]]
[[/li]]
[[/ul]]

Result:

  • First
  • Second
    1. Nested

[[ul]] is a bulleted list, [[ol]] a numbered list and [[li]] an item.

Tables ​

text
||~ Heading ||~ Heading ||
|| Cell || Cell ||
||> Right-aligned ||= Centered ||
|||| Cell spanning two columns ||
|| First line _
second line || Cell ||

Result:

HeadingHeading
CellCell
Right-alignedCentered
Cell spanning two columns
First line
second line
Cell
Cell startMeaning
||Normal cell
||~Heading cell
||>Right-aligned cell
||=Centered cell
||||Cell spanning two columns; each additional || adds a column

Each row starts on a new line and ends with ||. Use _ for line breaks inside a cell. Cells that span rows need the block form:

text
[[table class="wiki-content-table"]]
[[row]]
[[hcell]]Heading 1[[/hcell]]
[[hcell]]Heading 2[[/hcell]]
[[cell rowspan="2"]]Two rows high[[/cell]]
[[/row]]
[[row]]
[[cell colspan="2"]]Two columns wide[[/cell]]
[[/row]]
[[/table]]

Result:

Heading 1Heading 2Two rows high
Two columns wide

[[table]] may contain only [[row]] blocks, and a row only [[cell]] and [[hcell]] (heading) blocks. All four accept attributes. Content inside [[table]] is not split into paragraphs; wrap it in [[div]] if you need paragraphs in a cell.

Quotes ​

text
> First level
>> Second level
> Back to the first level

Result:

First level

Second level

Back to the first level

[[blockquote]]...[[/blockquote]] (or [[quote]]) does the same and accepts attributes:

text
[[blockquote]]
Quoted text.
[[/blockquote]]

Result:

Quoted text.

Alignment and floats ​

= at the start of a paragraph centers the whole paragraph:

text
= This paragraph is centered,
including this line.

Result:

This paragraph is centered,
including this line.

Alignment blocks:

BlockAlignment
[[<]]...[[/<]]Left
[[>]]...[[/>]]Right
[[=]]...[[/=]]Centered
[[==]]...[[/==]]Justified

To stop text from flowing around floated images or blocks, see ~~~ in Paragraphs and line breaks.

Containers and attributes ​

[[div]] is a general block container and [[span]] a general inline container. Both are used mainly to attach classes and styles:

text
[[div class="notice" style="border: 1px solid #ccc; padding: 1em"]]
First paragraph.

Second paragraph.
[[/div]]

Text with [[span style="color: green"]]a green part[[/span]].
  • [[div]] splits its content into paragraphs. [[div_]] does not: blank lines inside become line breaks.
  • [[span_]] removes line breaks at the start and end of its content.

Allowed attributes ​

Blocks that accept attributes pass them to the page. Only these attributes are kept; all others, such as onclick, are removed:

accept, align, alt, autocapitalize, autoplay, background, bgcolor, border, buffered, checked, cite, class, cols, colspan, contenteditable, controls, coords, datetime, decoding, default, dir, dirname, disabled, download, draggable, for, form, frameborder, headers, height, hidden, high, href, hreflang, id, inputmode, ismap, itemprop, kind, label, lang, list, loop, low, max, maxlength, min, minlength, multiple, muted, name, optimum, pattern, placeholder, poster, preload, readonly, required, reversed, role, rows, rowspan, scope, scrolling, selected, shape, size, sizes, span, spellcheck, src, srclang, srcset, start, step, style, tabindex, target, title, translate, type, usemap, value, width, wrap, and any attribute starting with data- or aria-.

  • id values get the prefix u-: [[div id="intro"]] produces the id u-intro, so link to it with [#u-intro Label]. Anchors made with [[# name]] are not prefixed.
  • href values are checked the same way as link addresses.
  • autoplay, checked, controls, default, disabled, hidden, ismap, loop, multiple, muted, readonly, required, reversed and selected are switches: true, t, 1 or yes turns them on, and false, f, 0 or no leaves them out.

Literal text, code and comments ​

SyntaxResult
@@**not bold**@@The text exactly as written, without interpreting markup
@@@@Nothing (an empty literal)
@@@@@@@@
@<&copy; &mdash;>@HTML entities are displayed as characters; any other text inside is shown as written
[[char copy]], [[char &mdash;]], [[char #x2603]]One character, by entity name or number. [[character]] is the same.
[!-- comment --]Nothing. Comments can span several lines.

Literal text cannot contain a blank line.

Code blocks ​

text
[[code type="css"]]
#page-title { color: purple; }
[[/code]]

Result:

css
#page-title { color: purple; }
  • The content of [[code]] is displayed as written and not interpreted.
  • type names the language for syntax highlighting, for example css, html, javascript (js), python, go, sql, bash, json or yaml. Without type, or with a language that is not recognized, the code is shown without highlighting.
  • Each code block on a page is also available as a plain file at /local--code/<page-name>/<n>, where n counts the code blocks in the page's source from 1. Blocks with type html, css, javascript (js) or xml are served with the matching content type, so they can be loaded as a stylesheet or script. Page variables are not replaced in these files.

Typography ​

These replacements are made automatically:

SyntaxResult
``text''“text”
`text'‘text’
,,text''„text”
-- (not part of --strikethrough--)—
<< and >>« and »

The quotation mark replacements are made before anything else, so they also apply inside @@...@@ and [[code]]. Dashes and angle quotes are not replaced inside literal text or code.

Collapsible blocks ​

text
[[collapsible show="+ Show details" hide="- Hide details"]]
Hidden until the reader opens it.
[[/collapsible]]

Result:

+ Show details

Hidden until the reader opens it.

ArgumentMeaning
showLink text while the block is closed. The default comes from the interface language.
hideLink text while the block is open
foldedSwitch; no makes the block start open. Default: yes.
hideLocationWhere the closing link appears when open: top (default), bottom, both, or neither (also none)
alignAlignment of the link text: left, right, center or justify

Collapsible blocks can be nested.

Tabs ​

text
[[tabview]]
[[tab First tab]]
Content of the first tab.
[[/tab]]
[[tab title="Second tab"]]
Content of the second tab.
[[/tab]]
[[/tabview]]
  • [[tabs]] is the same as [[tabview]].
  • The tab label follows the block name, or is given as title="...".
  • [[tabview]] may contain only [[tab]] blocks; any other content makes the whole block display as plain text.

Footnotes ​

text
The first recorded use[[footnote]]Source: the 1998 archive.[[/footnote]] was much later.

Result:

The first recorded use[^demo-footnote] was much later.

[^demo-footnote]: Source: the 1998 archive.

  • Footnotes are numbered in order. The list of footnotes appears at the end of the page.
  • [[footnoteblock]] places the list at that position instead. title="..." sets its heading; hide="true" hides the list, leaving only the numbered references.
  • A footnote cannot contain another footnote.

Images and galleries ​

Images ​

SyntaxImage
[[image photo.png]]File attached to this page
[[image other-page/photo.png]]File attached to another page of the site
[[image https://example.com/photo.png]]Image at an address
Block namePlacement
[[image]]As is
[[=image]]Centered
[[<image]]Aligned left
[[>image]]Aligned right
[[f<image]]Floating left, with text flowing around it
[[f>image]]Floating right, with text flowing around it
text
[[f>image diagram.png width="240" link="details"]]
[[=image https://example.com/banner.png link="*https://example.com" style="border: 1px solid #000"]]
  • link makes the image a link to a page name or address. A * before the target opens it in a new tab.
  • Attributes such as width, height, class, style and title are passed to the image.
  • An image always forms its own block and is never placed inside a paragraph.
  • Files are attached to a page with Attachments in the page options.

Galleries ​

[[gallery]] shows thumbnails of every image attached to the current page. Clicking a thumbnail shows it enlarged over the page.

text
[[gallery]]
[[gallery size="small"]]
sizeThumbnail
square75 × 75 pixels, cropped to a square
thumbnailLongest side 100 pixels
smallLongest side 240 pixels
medium (default)Longest side 500 pixels
  • Any other size shows an error in place of the gallery. size is the only argument.
  • [[gallery]] is short for [[module Gallery]]. The shorthand is replaced everywhere in the page source, including inside [[code]] and @@...@@.

Embedded content ​

Frames ​

[[iframe]] embeds another web page:

text
[[iframe https://example.com/widget width="100%" height="300" frameborder="0"]]

The address follows the block name and is checked like a link address. Attributes are passed to the frame.

Embed codes ​

[[embed]] accepts an embed code copied from a video or map service, containing exactly one <iframe> tag:

text
[[embed]]
<iframe src="https://player.example.com/video/123" width="640" height="360" allowfullscreen></iframe>
[[/embed]]
  • The frame is placed directly in the page, so site styles can size it.
  • The src address must start with https://, http:// or //. Other attributes are kept if they are in the allowed list.
  • Anything other than a single <iframe> tag, or an address starting differently, makes the block display as plain text.

HTML blocks ​

[[html]] runs your own HTML, CSS and JavaScript in a separate frame that adjusts its height to its content:

text
[[html]]
<button onclick="document.body.style.background='gold'">Try me</button>
[[/html]]
  • The frame is isolated from the site: its scripts cannot read the site's cookies or local storage.
  • With external="true" the frame is loaded from the site's media domain. It can then use cookies and local storage. Its content always comes from the latest saved version of the page, so it does not show unsaved changes in a preview or the content of older revisions.

Dates ​

[[date]] shows a point in time converted to the time zone of the reader's browser:

text
[[date 1700000000]]
[[date 2024-02-18T08:30:00 format="%Y-%m-%d %H:%M"]]
[[date 1700000000 format="%d %b %Y|agohover"]]
ValueMeaning
1700000000Unix timestamp in seconds
2024-02-18 or 2024/02/18Date
2024-02-18T08:30:00Date and time in UTC
2024-02-18T08:30:00+08:00Date and time with an offset from UTC. Give a format with this form.
now or .The time the page was displayed

Without format, a date is shown as %m.%d.%Y and a date with time as %m.%d.%Y %H:%M.

Format codeMeaning
%Y / %yYear, four or two digits
%mMonth, two digits
%b (or %h)Month name in the interface language
%d / %eDay of the month, two digits / padded with a space
%aDay of the week in the interface language
%u / %wDay of the week as a number, 1–7 from Monday / 0–6 from Sunday
%H / %kHour 00–23 / padded with a space
%I / %lHour 01–12 / padded with a space
%p / %PAM/PM / am/pm
%MMinute
%SSecond
%RSame as %H:%M
%sUnix timestamp
%OThe time between then and now, without "ago", such as "5 minutes". Future dates work too

Add a modifier after | at the end of the format:

ModifierEffect
|agoShows the time between then and now, without "ago"; hovering shows the formatted date
|agohoverShows the formatted date; hovering shows the time between then and now, without "ago"

Users ​

SyntaxResult
[[user name]]Link to the user's profile
[[*user name]]The same, with the user's avatar
[[user wd:Name]]An account imported from Wikidot, by its Wikidot name
[[user external:name]]Link to that name's profile on wikidot.com, without looking up a local account

The name is matched against account names and display names. A name that matches no account shows a message that the user does not exist.

Ruby annotations ​

text
[[ruby]]漢字[[rt]]かんじ[[/rt]][[/ruby]]
[[rb 漢字|かんじ]]

[[rt]] (or [[rubytext]]) holds the annotation inside [[ruby]]. [[rb base|annotation]] (or [[ruby2]]) is the short form. [[ruby]] and [[rt]] accept attributes.

Forms and fields ​

Forms that open a page ​

[[form]] collects values and opens a page of the site with the values in its address:

text
[[form target="search-results"]]
[[input type="text" name="q" placeholder="Search"]]
[[input type="submit" value="Go"]]
[[/form]]

Submitting the form opens /search-results/q/<entered text>. On that page the value is available as %%path|q%% (see URL parameters).

  • target is a page name, not an address. target="." means the current page.
  • [[input]] without a closing tag is a single form control. It accepts attributes such as type, name, value, placeholder and checked, and can also be used outside a form.
  • A single control followed anywhere later on the page by [[/input]] is read as the start of a field list, so do not use both forms on one page.
  • [[form_]] does not split its content into paragraphs.

Field lists ​

[[input]]...[[/input]] with a closing tag displays a table of labeled fields, written as a list:

text
[[input]]
# nickname
* title: Nickname
* hint: Shown next to your posts
# theme
* type: select
* options: light: Light
* options: dark: Dark
* default: dark
# newsletter
* type: checkbox
* default: yes
[[/input]]
  • A line starting with # begins a field and gives its name.
  • The * lines below it set its properties:
PropertyMeaning
titleLabel; the field name is used without it
typetext (default), textarea, select or checkbox
sizeWidth of a text field in characters. Default: 30.
defaultInitial value. For a checkbox, 1, yes, true or checked ticks it.
hintHelp text below the field
optionsOne option of a select field, as key: Label; repeat the line for each option
  • The fields are displayed only; the block has no submit button of its own.
  • A field list without any field shows a message that no fields are defined in [[input]].
  • [[input]]...[[/input]] is short for [[module Input]]. The shorthand is replaced everywhere in the page source, including inside [[code]] and @@...@@.

Buttons ​

[[button]] shows a button that acts on the current page. Buttons stay in the line of text, so several can stand side by side.

text
[[button edit]] [[button edit text="Edit this page"]]
[[button set-tags +reviewed -needs-review text="Mark as reviewed"]]
TypeEffect
editOpens the editor, like Edit. On a page that does not exist yet, it opens the editor for creating it.
set-tagsAdds the tags written with + and removes those written with -, then reloads the page. A tag without a sign is added.
  • text sets the label. Without it, the label is the type, such as edit.
  • Changing tags needs the same permission as changing them with Tags; otherwise an error message appears.
  • Any other type shows a message that the button type is not supported.
  • [[button ...]] is short for [[module Button type="..."]]. The shorthand is replaced everywhere in the page source, including inside [[code]] and @@...@@. Each button has the class wiki-standalone-button and a data-button-type attribute for styling.

Includes ​

[[include]] inserts the source of another page at its position, before the page is interpreted:

text
[[include component:infobox
  title=Example |
  color=red
]]

In component:infobox:

text
[[div class="infobox" style="border-color: {$color}"]]
**{$title}**
[[/div]]
  • [[include must start a line, and ]] must end a line. The block may span several lines.
  • Arguments are name=value pairs separated by |. Values are not quoted; spaces around them are removed.
  • Every {$name} in the included page is replaced by the argument of that name. A {$name} without a matching argument stays as written.
  • If an argument is given twice, the first value counts.
  • [[include :site:page-name]] inserts a page from another site on the same ProjectWikit instance, by its site identifier. The page is inserted only if the reader may view it on that site.
  • Included pages can include further pages, up to 25 levels. An include that exceeds the limit shows an error about an include loop.
  • A page that does not exist shows an error with a link for creating it.
  • Because the source is inserted before the page is interpreted, a block can be opened in one included page and closed in another, or in the including page.
  • An included page reaches the variables of the page being displayed with %%this|name%% (see Page variables).

Default values ​

An argument whose value is its own placeholder, such as color={$color}, is skipped when the placeholder was not replaced. A component that includes another component can use this to pass a value on with a default:

text
[[include component:infobox-inner
  color={$color} |
  color=gray
]]

Written inside component:infobox, this passes on the color that the including page set, or gray if it set none.

Keeping text out of includes ​

text
[[noinclude]]
Documentation shown only on the component page itself.
[[/noinclude]]

Content between [[noinclude]] and [[/noinclude]] is shown on the page itself and left out when the page is included. Both tags must be on lines of their own.

Page variables ​

Page variables are written as %%name%% and are replaced with values before the page is interpreted. A variable that has no value is left as written.

Where variables apply ​

WhereVariables
Category template: category:_template, or _template for the main categoryAll page variables, for the page being displayed
[[module ListPages]] bodyAll page variables, for each listed page. See Modules.
Missing-page template: category:_404, or _404%%404_page_name%%, and %%name%%, %%category%% and %%fullname%% of the requested page
Any page, and pages it includes%%this|name%% for the page being displayed
A page and its category templateURL parameters

The replacement is made on the source text, so it also happens inside [[code]] and @@...@@. To show a variable literally, break it with an empty literal: %%ti@@@@tle%% displays %%title%%.

Common variables ​

VariableValue
%%name%%Page name without category
%%category%%Category
%%fullname%%Full page name
%%title%%Title
%%title_linked%%Link to the page showing its title
%%content%%The page's source
%%content{n}%%Section n of the source (see Content sections)
%%created_at%%, %%updated_at%%Creation time and time of the last edit
%%created_by%%, %%created_by_linked%%Authors, as text or as user links
%%rating%%, %%rating_votes%%Rating and number of votes
%%tags%%, %%tags_linked%%Tags, as text or as links
%%site_title%%Site title

The complete list, including parent page, discussion, rating and site variables, is in Modules under ListPages. All of them work in category templates too.

%%this|name%% accepts the same names, in any letter case, except index, total, date formats and link prefixes. For example, %%this|title%% in a component shows the title of the page being displayed.

Category templates ​

A page named _template in a category, such as news:_template, is displayed for every page of that category in place of the page's own source. Put %%content%% where the page's source should appear:

text
[[div class="news-header"]]
+ %%title%%
Published %%created_at%% by %%created_by_linked%%
[[/div]]

%%content%%

For the main category, the template is the page _template.

Missing-page templates ​

When a reader opens a page that does not exist, the site displays category:_404 if it exists, otherwise _404, instead of the standard message. The template is used only if the reader may view it. %%404_page_name%% is replaced with the full name that was requested:

text
The page **%%404_page_name%%** does not exist yet.
[[button edit text="Create it"]]

Content sections ​

A page's source can be split into sections by lines of four or more equals signs:

text
Summary text.
====
Full text.

In a template, %%content{1}%% is Summary text. and %%content{2}%% is Full text.. A section that does not exist gives an empty value.

Data form categories ​

A category template can define fields with a [[form]] block without arguments. The pages of that category then store field values instead of wikitext:

text
[[form]]
fields:
  status:
    type: select
    label: Status
    values:
      open: Open
      done: "**Done**"
    default: open
  summary:
    type: wiki
    label: Summary
    hint: Wikitext allowed
[[/form]]

A page in the category contains one field: value line per field:

text
status: done
summary: Finished in //March//.
Field propertyMeaning
typetext (default), wiki, select, checkbox, static or hidden
labelLabel, available as %%form_label{field}%%
hintHelp text, available as %%form_hint{field}%%
defaultValue used when the page does not set the field
valuesOptions of a select field, as key: Label pairs
valueFixed value of a static or hidden field
VariableValue
%%form_data{field}%%Value for display. wiki and static values, and the labels of select options, are interpreted as wikitext; other values are shown literally.
%%form_raw{field}%%The stored value, or the default
%%form_label{field}%%The field's label
%%form_hint{field}%%The field's hint

Field names are case-insensitive. The [[form]] definition itself is not displayed.

URL parameters ​

A page address can carry parameters after the page name:

text
/page-name/key/value/other-key/other-value

In the page and its category template:

VariableValue
%%path|key%%The value as written. Left unchanged when the parameter is missing or has no value.
%%path_expr|key%%The value as a quoted string, safe inside an argument: "value". A missing parameter gives "%%path_expr|key%%"; a key without a value gives null.
%%path_url|key%%The value encoded for use in an address. A key without a value gives an empty value; a missing parameter gives the variable itself, encoded.
%%canonical_url%%The full https:// address of the page, including its parameters

Keys are case-insensitive, but the variable prefix must be lowercase. Parameters are also read by several modules; see Modules.

Conditional content ​

Tags and categories ​

[[iftags]] shows its content only when the page's tags match:

text
[[iftags +guide -draft]]
This guide is published.
[[/iftags]]
ConditionMeaning
+tagThe page must have this tag
-tagThe page must not have this tag
tagThe page must have at least one of the tags written this way

Content that is not shown is skipped without being interpreted, so it does not have to be well formed: it may contain tags that are opened or closed elsewhere.

[[ifcategory]] does the same for the page's category. Its content must be well formed whether or not it is shown.

text
[[ifcategory news blog]]
Shown in the news and blog categories.
[[/ifcategory]]
[[ifcategory -_default]]
Shown everywhere except the main category.
[[/ifcategory]]

A category written with or without + means the page must be in one of the listed categories; - excludes a category. Both blocks are most useful in included pages and templates, where the same source is displayed on different pages.

Values ​

[[#if]] chooses between two texts depending on a value, usually an include argument or variable:

text
[[#if {$title} | Title: {$title} | No title given]]

[[if %%path|mode%%]]
A mode was chosen.
[[else]]
No mode was chosen.
[[/if]]

The value counts as false when it is false or null (in any letter case), or a placeholder that was not replaced, such as {$title} or %%path|mode%%. Anything else, including an empty value, counts as true. The second text and [[else]] are optional.

Expressions ​

[[#ifexpr]] and [[ifexpr]] decide by evaluating an expression; [[#expr]] displays the result of one:

text
[[#ifexpr {$votes} >= 10 | Popular | Not many votes yet]]

[[ifexpr {$count} > 0]]
{$count} items.
[[else]]
Empty.
[[/ifexpr]]

Total: [[#expr {$price} * {$quantity}]]

The result counts as false when it is 0, 0.0, an empty string, or when the expression cannot be evaluated. A true comparison displays as 1 and a false one as 0.

ElementSyntax
Numbers12, -3, 2.5, 1e3
Strings"text" or 'text'; + joins two strings, "ab" * 3 repeats one
ConstantsTrue, False, None
Arithmetic+, -, *, /, ^ (bitwise exclusive or), parentheses
Comparison==, !=, <, <=, >, >=; chains such as 1 < {$n} < 10 are allowed
Logicand, or
FunctionResult
min(a, b, ...), max(a, b, ...)Smallest or largest value
abs(x)Absolute value
round(x), round(x, digits)Rounded value; halves round to the even neighbor
ceil(x), floor(x)Rounded up or down to a whole number
div(a, b)Whole-number division, rounded down
sqrt(x), pow(x, y)Square root, power
random(a, b)Random whole number from a to b, both included; any 64-bit whole numbers are accepted
len(s)Number of characters
lower(s), upper(s)Lowercase or uppercase text
substr(s, start), substr(s, start, end)Part of a string, counting from 0; negative positions count from the end
unset(x)True when x is a variable that was not replaced, such as "%%path|page%%"

Write text values in quotes so that they are compared as strings: [[#ifexpr "{$type}" == "news" | ... | ...]].

An expression longer than 16 KB cannot be evaluated. Neither can one whose string result, from * or +, would be longer than 64 KB.

Script variables ​

Script variables hold values while the page is rendered:

text
[[declare count 0]]
[[*set count {@count} + 1]]
[[*set count {@count} + 1]]
Count: {@count}

Result:

Count: 2

SyntaxMeaning
[[declare name value]]Creates the variable in the current scope. Inside [[scope]], it hides a variable of the same name until the scope ends
[[set name value]]Changes the variable if it exists; otherwise creates it in the current scope
[[*declare name expression]], [[*set name expression]]Evaluate the value as an expression first and store the result
{@name}Inserts the value. A variable that does not exist inserts nothing
[[scope]]…[[/scope]]Variables created inside no longer exist after [[/scope]]. Changes made inside to variables from outside remain
  • The name is the first word after declare or set, and the rest of the block is the value, which must not be empty. {@name} recognizes names made of letters, digits, - and _.
  • A variable is available below the block that sets it. A value may contain {@other}, which is replaced when the block is read.
  • {@name} is also replaced in block arguments, module bodies, [[#expr]], [[#if]], [[#ifexpr]] and [[ifexpr]].
  • {@name} is not the same as {$name}, which is an argument of an include.
  • A [[declare]] or [[set]] has no effect and is shown as text when its value is longer than 1,024 bytes, or when it would bring the names and values in the current scope over 16 KB.
  • After 1 MB of values has been inserted on a page, further {@name} insert nothing.
  • Script variables are not available in forum posts or bios; there the blocks and {@name} are shown as text.

Math ​

[[math]] displays a formula written in LaTeX as a numbered equation. Equations are numbered (1), (2), … in the order they appear on the page. A name after math labels the equation for [[eref]]. [[$ … $]] places a formula inside a line of text:

text
[[math pythagoras]]
a^2 + b^2 = c^2
[[/math]]

By ([[eref pythagoras]]), the hypotenuse is [[$ \sqrt{a^2 + b^2} $]].

Result:

$$a^2 + b^2 = c^2 \tag{1}$$

By (1), the hypotenuse is $\sqrt{a^2 + b^2}$.

  • [[eref name]] shows the number of the equation with that name, linked to the equation. Write the parentheses around it yourself. When several equations have the same name, the first one is used. A name that no equation on the page has shows ??.
  • [[$ … $]] must be written on one line.
  • The environments align, matrix, pmatrix, bmatrix and vmatrix are available, written as \begin{matrix} … \end{matrix}. The Wikidot argument type is not supported.
  • Formulas are displayed by the browser as MathML. A formula that uses LaTeX the converter does not support is replaced by the converter's error message. A formula longer than 8 KB is replaced by a message that the formula is too long or nested too deeply to display.
  • Math is not available in forum posts or bios; there it is shown as text.

Modules ​

text
[[module Rate]]

[[module ListPages category="news" limit="5"]]
* %%title_linked%%
[[/module]]
  • A module name follows module; arguments are written like block arguments.
  • Modules that use a body end with [[/module]]. A body can contain other modules, including ones with a body of their own.
  • Opening a page with /nomodule/true after its address turns off all modules on it, which helps when a module breaks the page.

Every module and its arguments are described in Modules.

Block reference ​

BlockOther namesSee
[[a]][[anchor]]Links and anchors
[[b]], [[i]], [[u]], [[s]], [[del]], [[ins]], [[sup]], [[sub]], [[tt]], [[mark]]see the tableText formatting
[[blockquote]][[quote]]Quotes
[[button]]Buttons
[[char]][[character]]Literal text, code and comments
[[code]]Code blocks
[[collapsible]]Collapsible blocks
[[date]]Dates
[[declare]], [[set]], [[scope]][[*declare]], [[*set]]Script variables
[[div]], [[span]]Containers and attributes
[[embed]]Embed codes
[[footnote]], [[footnoteblock]]Footnotes
[[form]], [[input]]Forms and fields
[[gallery]]Galleries
[[html]]HTML blocks
[[if]], [[#if]], [[ifexpr]], [[#ifexpr]], [[#expr]], [[iftags]], [[ifcategory]]Conditional content
[[iframe]]Frames
[[image]][[=image]], [[<image]], [[>image]], [[f<image]], [[f>image]]Images
[[include]], [[noinclude]]Includes
[[lines]][[newlines]]Paragraphs and line breaks
[[math]], [[eref]], [[$ … $]]Math
[[module]][[module654]]Modules
[[p]][[paragraph]]Paragraphs and line breaks
[[ruby]], [[rt]], [[rb]][[rubytext]], [[ruby2]]Ruby annotations
[[size]]Text formatting
[[table]], [[row]], [[cell]], [[hcell]]Tables
[[tabview]], [[tab]][[tabs]]Tabs
[[toc]][[f<toc]], [[f>toc]]Headings and table of contents
[[ul]], [[ol]], [[li]]Lists
[[user]][[*user]]Users
[[<]], [[>]], [[=]], [[==]]Alignment and floats
[[# name]]Anchors