Zoom.Quiet@gmail.com | My favorites | Profile | Sign out
Google
             
Search
for
Updated Jun 08, 2009 by jrobbins
Labels: Featured
WikiSyntax  
The reference to the wiki syntax for Google Code projects

Introduction

Each wiki page is stored in a .wiki file under the /wiki directory in a project's repository. Each file's name is the same as the wiki page name. And, each wiki file consists of optional pragma lines followed by the content of the page.

Pragmas

Optional pragma lines provide metadata about the page and how it should be displayed. These lines are only processed if they appear at the top of the file. Each pragma line begins with a pound-sign (#) and the pragma name, followed by a value.

Pragma Value
#summary One-line summary of the page
#labels Comma-separated list of labels (filled in automatically via the web UI)
#sidebar See Side navigation

Wiki-style markup

Paragraphs

Use one or more blank lines to separate paragraphs.

Typeface

Name/Sample Markup
italic _italic_
bold *bold*
code `code`
code {{{code}}}
superscript ^super^script
subscript ,,sub,,script
strikeout ~~strikeout~~

You can mix these typefaces in some ways:

Markup Result
_*bold* in italics_ bold in italics
*_italics_ in bold* italics in bold
*~~strike~~ works too* strike works too
~~as well as _this_ way round~~ as well as this way round

Code

If you have a multiline code block that you want to display verbatim, use the multiline code delimiter:

{{{
def fib(n):
  if n == 0 or n == 1:
    return n
  else:
    # This recursion is not good for large numbers.
    return fib(n-1) + fib(n-2)
}}}

Which results in:

def fib(n):
  if n == 0 or n == 1:
    return n
  else:
    # This recursion is not good for large numbers.
    return fib(n-1) + fib(n-2)

Headings

= Heading =
== Subheading ==
=== Level 3 ===
==== Level 4 ====
===== Level 5 =====
====== Level 6 ======

Dividers

Four or more dashes on a line by themselves results in a horizontal rule.

Lists

Google Code wikis support both bulleted and numbered lists. A list must be indented at least one space to be recognized as such. You can also nest lists one within the other by appropriate use of indenting:

The following is:
  * A list
  * Of bulleted items
    # This is a numbered sublist
    # Which is done by indenting further
  * And back to the main bulleted list

 * This is also a list
 * With a single leading space
 * Notice that it is rendered
  # At the same levels
  # As the above lists.
 * Despite the different indentation levels.

The following is:

Quoting

Block quotes place emphasis on a particular extract of text in your page. Block quotes are created by indenting a paragraph by at least one space:

Someone once said:

  This sentence will be quoted in the future as the canonical example
  of a quote that is so important that it should be visually separate
  from the rest of the text in which it appears.

Someone once said:

This sentence will be quoted in the future as the canonical example of a quote that is so important that it should be visually separate from the rest of the text in which it appears.

Links

Links are central to the wiki principle, as they create the web of content. Google Code wiki permits both internal (within the wiki) and external links, and in some cases automatically creates a link when it recognizes either a WikiWord or an URL.

Internal wiki links

Internal links within a wiki are created using the syntax below. If you add a wiki link to a page that does not exist, the link will appear with a LittleLink? to all project members and owners. Clicking that link will take you to the page creation form where you can enter content for that page.

If you are not logged in, wiki links that point to non-existent pages will appear as plain text, without the link to the page creation form. When you create the target page as a project member or owner, the link will switch to being an actual hyperlink for all viewers of the page.

WikiSyntax is identified and linked automatically

Wikipage is not identified, so if you have a page named [Wikipage] you
need to link it explicitly.

If the WikiSyntax page is actually about reindeers, you can provide a
description, so that people know you're actually linking to a page on
[WikiSyntax reindeer flotillas].

If you want to mention !WikiSyntax without it being autolinked, use an
exclamation mark to prevent linking.

WikiSyntax is identified and linked automatically

Wikipage is not identified, so if you have a page named Wikipage you need to link it explicitly.

If the WikiSyntax page is actually about reindeers, you can provide a description, so that people know you're actually linking to a page on reindeer flotillas.

If you want to mention WikiSyntax without it being autolinked, use an exclamation mark to prevent linking.

Links to anchors within a page

Each heading defines a HTML anchor with the same name as the heading, but with spaces replaced by underscores. You can create a link to a specific heading on a page like this:

[WikiSyntax#Wiki-style_markup]

And it will render as: WikiSyntax#Wiki-style_markup.

Links to external pages

You can of course link to external pages from your own wiki pages, using a syntax similar to that for internal links:

Plain URLs such as http://www.google.com/ or ftp://ftp.kernel.org/ are
automatically made into links.

You can also provide some descriptive text. For example, the following
link points to the [http://www.google.com Google home page].

If your link points to an image, it will get inserted as an image tag
into the page:

http://code.google.com/images/code_sm.png

You can also make the image into a link, by setting the image URL as
the description of the URL you want to link:

[http://code.google.com/ http://code.google.com/images/code_sm.png]

Plain URLs such as http://www.google.com/ or ftp://ftp.kernel.org/ are automatically made into links.

You can also provide some descriptive text. For example, the following link points to the Google home page.

You can also make the image into a link, by setting the image URL as the description of the URL you want to link:

[http://code.google.com/ http://code.google.com/images/code_sm.png]

Links to images

If your link points to an image (that is, if it ends in .png, .gif, .jpg or .jpeg), it will get inserted as an image into the page:

http://code.google.com/images/code_sm.png

If the image is produced by a server-side script, you may need to add a nonsense query string parameter to the end so that the URL ends with a supported image filename extension.

http://chart.apis.google.com/chart?chs=200x125&chd=t:48.14,33.79,19.77|83.18,18.73,12.04&cht=bvg&nonsense=something_that_ends_with.png

Tables

Tables are created by entering the content of each cell separated by || delimiters. You can insert other inline wiki syntax in table cells, including typeface formatting and links.

|| *Year* || *Temperature (low)* || *Temperature (high)* ||
|| 1900 || -10 || 25 ||
|| 1910 || -15 || 30 ||
|| 1920 || -10 || 32 ||
|| 1930 || _N/A_ || _N/A_ ||
|| 1940 || -2 || 40 ||

Year Temperature (low) Temperature (high)
1900 -10 25
1910 -15 30
1920 -10 32
1930 N/A N/A
1940 -2 40

HTML support

To aid in the presentation of a wiki page there is some support for HTML. HTML tags are only supported in wiki pages, not in page comments.

HTML syntax can be used in conjunction with wiki syntax, but it is recommended against doing so where possible.

The following HTML tags and attributes are currently supported:

HTML TagSupported Attributes
atitle dir lang href
btitle dir lang
brtitle dir lang
blockquotetitle dir lang
codetitle dir lang language [1]
ddtitle dir lang
divtitle dir lang
dltitle dir lang
dttitle dir lang
emtitle dir lang
fonttitle dir lang face size color
h1title dir lang
h2title dir lang
h3title dir lang
h4title dir lang
h5title dir lang
ititle dir lang
imgtitle dir lang src alt border
lititle dir lang
oltitle dir lang type start
ptitle dir lang align
pretitle dir lang
qtitle dir lang
stitle dir lang
spantitle dir lang
striketitle dir lang
strongtitle dir lang
subtitle dir lang
suptitle dir lang
tabletitle dir lang align valign cellspacing cellpadding border width height
tbodytitle dir lang align valign cellspacing cellpadding border width height
tdtitle dir lang align valign cellspacing cellpadding border width height
tfoottitle dir lang align valign cellspacing cellpadding border width height
thtitle dir lang align valign cellspacing cellpadding border width height
theadtitle dir lang align valign cellspacing cellpadding border width height colspan rowspan
trtitle dir lang align valign cellspacing cellpadding border width height colspan rowspan
tttitle dir lang
utitle dir lang
ultitle dir lang type
vartitle dir lang

[1] The language attribute of the code tag is the file extension of the language used in the code block. It is used as a hint for the syntax highlighter.

Escaping HTML Tags

When you want to display html tags directly on your wiki page (as opposed to rendered), you will need to escape each HTML tag.

HTML tags can be escaped as shown in the table below:

MarkupResult
`<hr>`<hr>
{{{<hr>}}}<hr>


Comments

The wiki supports embedded comments to help explain the contents of a wiki page. Anything inside the comment block is removed from the rendered page, but is visible when editing or viewing the source for that page.

<wiki:comment>
This text will be removed from the rendered page.
</wiki:comment>

Gadgets

You can embed Gadgets on your wiki pages with the following syntax:

<wiki:gadget url="http://example.com/gadget.xml" height="200" border="0" /> 

Valid attributes are:

  • url: the URL of the gadget
  • width: the width of the gadget
  • height: the height of the gadget
  • title: a title to display above the gadget
  • border: "0" or "1", whether to draw a border around the gadget
  • up_*: Gadget user preference parameters

WorkingWithGoogleGadgets describes how to create gadgets for Google Code. It also provides a few helpful suggestions that can make it easier to publish gadgets and to integrate with other Google products such as iGoogle.

InterestingDeveloperGadgets shows some sample gadgets you may want to include on your project pages.

Videos

You can embed videos with the following syntax:

<wiki:video url="http://www.youtube.com/watch?v=3LkNlTNHZzE"/>

Valid attributes are:

Right now we support videos from Youtube and Google Video, but other containers can be added to our open source gadgets project.

Navigation

Table of Contents

An inline table of contents can be generated from page headers on a wiki page. Add the following syntax to a page in the location the table of contents should be displayed:

<wiki:toc max_depth="1" />

Valid attributes are:

Side navigation

You can specify the sidebar for a wiki page by selecting another wiki page that defines your side navigation. The doctype project uses the sidebar extensively across its wiki.

One way of adding a sidebar is by setting the #sidebar pragma, as shown below. Alternatively, the sidebar pragma can be left blank if no side navigation is desired.

#sidebar TableOfContents

The side navigation that is defined should be in the format of a simple list, as shown below.

  * [Articles HOWTO articles]
    * [ArticlesXSS Web security]
    * [ArticlesDom DOM manipulation]
    * [ArticlesStyle CSS and style]
    * [ArticlesTips Tips and tricks]
  * [DOMReference DOM reference]
  * [HTMLElements HTML reference]
  * [CSSReference CSS reference]

A default sidebar page can also be specified for all wiki pages by project owners through the Wiki settings in the Administer tab. If a #sidebar pragma is also specified, it will take precedence on the page.

Localizing Wiki Content

Along with the default language for the wiki, which can be set through the Wiki settings in the Administer tab, additional languages are also supported. If more than one language is available, based on a user's language preference (e.g. browser language), the wiki will try to serve the page for the appropriate language. If no wiki page exists for that language, it will fall back to the default language. Comments, however, are shared amongst all translations of a wiki page.

New translations for a page cannot be added through the web interface and have to be added through the Subversion repository.

To add a translation of a page, first checkout the wiki from Subversion:
svn checkout https://yourproject.googlecode.com/svn/wiki/ yourdirectory -username yourusername

Then create a new directory under /wiki/ using the two letter ISO-639 code as the name of that directory. Place all translated files in the new directory and submit those changes to the Subversion repository.

The following is an example of a valid wiki directory:

wiki/
   ja/
      ProjectHistory.wiki
      StyleGuide.wiki
   zh-CN/
      ProjectHistory.wiki
      StyleGuide.wiki
   zh-TW/
      ProjectHistory.wiki
      StyleGuide.wiki
   ProjectHistory.wiki
   StyleGuide.wiki

Once the files been be submitted to the project's subversion repository, they can now be edited through the wiki's web editor.

Note: The wiki accepts a subset of ISO-639 two letter language codes, where a few of the codes (such as zh_CN) contain locale-specific codes. Such locale-specific codes should use a hyphen (zh-CN) separator. A few example language codes have been specified in the table below.

Language (Locale) Directory Name
Arabic ar
Bulgarian bg
Chinese (China) zh-CN
Chinese (Taiwan) zh-TW
Croatian hr
Czech cs
Danish da
Dutch nl
English (United Kingdom) en-GB
English (United States) en-US
Finnish fi
French fr
German de
Greek el
Hebrew he
Hungarian hu
Italian it
Japanese ja
Korean ko
Norwegian no
Polish pl
Portuguese (Brazil) pt-BR
Romanian ro
Russian ru
Slovak sk
Spanish es
Swedish sv
Turkish tr

The content on this page created by Google is licensed under the Creative Commons Attribution 3.0 License. User-generated content is not included in this license.


Comment by azmatali...@gmail.com, Mar 11, 2009

Please do not file issues here or ask questions about Wiki syntax here

Issues: http://code.google.com/p/support/issues Questions: http://groups.google.com/group/google-code-hosting

Feel free to add comments that you think will be useful to others and will improve the documentation.

Comment by andrew.fedoniouk, Mar 11, 2009

How to escape sequences of text from being interpreted as Wiki markup?

Say I want to write literally this: "bold"

I am trying to put it as *bold* but it produces this sequence: "<tt></tt>bold<tt></tt>" that is wrong IMO.

Comment by phenxdes...@gmail.com, Mar 11, 2009

I think a wysiwyg editor would be great. I made a dynamic preview tool for the Google Code wiki syntax : http://phenxdesign.net/projects/wikiwyg/ Just paste and edit the code on the textarea, and it will be automatically shown as you type on the area below. For now, it only works on mozilla/firefox browsers.

I got inspiration from this code : http://code.google.com/p/chrisroos/source/browse/trunk/google-wiki-syntax/lib/wiki_syntax.rb

Please tell we what you think about it and if you find it helpful.

Comment by easybuilder, Mar 12, 2009

Year Temperature (low) Temperature (high)
1900 -10 25
1910 -15 30
Comment by easybuilder, Mar 12, 2009

目录 描述 Temperature (high)
%tomcat%\shared\lib 发布服务组件api、数据持久api和一些公共jar包的目录 25
%tomcat%\components 发布服务组件api的实现 30
Comment by marius.scurtescu, Mar 13, 2009

@andrew.fedoniouk

Just put an exclamation mark in front of the TextThatIsNotWiki:

If you want to mention WikiSyntax without it being autolinked, use an exclamation mark to prevent linking.
Comment by anton.danilchenko, Mar 17, 2009

How insert link to my project labeled page? I have link to page list?q=label:Component-Smarty

Now I insert full path to this page. This is bad! Please, parse this links:

- [wiki:PageName Link to wiki page] - [PageName Link to wiki page] - [label:My-Label,Another-Label Text to link] - [issue:148 Link to project issue] (strikeout if completed) - for all outer links add icon

Thanks!

Comment by bojl...@mail.ru, Mar 20, 2009

After adding localization and then deletion, wiki does not fall back to use default wiki pages (without language). Now always after choosing page in wiki hows this:

Page blabla Not Found Create a New Page for blabla

Comment by xizhi.zhu, Mar 29, 2009

inline code

Comment by Abdiqani...@gmail.com, Mar 30, 2009

Abdi.qani'

Comment by georgenava, Apr 01, 2009

How to insert unicode like &#x2721;?

Comment by vinu76jsr, Apr 05, 2009

how to insert picasa images to summary page??

Comment by gonghan1989, Apr 07, 2009

how to localise home page??

Comment by pantaz.alexandru, Apr 09, 2009

how to create a "bulleted or numbered lists" in tables. is it posible?

Comment by yanegomi, Apr 16, 2009

@andrew.fedoniouk: bold?

Comment by windypower, Apr 16, 2009

@pantaz.alexandru: Make a table with HTML, and add bulleted/numbered lists inside.

Comment by joshuav, Apr 24, 2009

is there support for latex based equations in the google wiki markup?

Comment by archville.devel, Apr 24, 2009

Is it possible to syntax highlight Scheme or Lisp code? Thanks.

Comment by tatter10, Apr 29, 2009

run all link

Comment by shoanleer, May 01, 2009

http://www.tjet-turkiye.com/ Dijital Tekstil Baskı Makineleri. Wiki support that link?

Comment by avr.iob, May 01, 2009

excellent

Comment by truefusion, May 03, 2009

How does one work with HTML entities?

Comment by chengpengsu, May 04, 2009

<img src="http://supported/?">

Comment by jhondigital21, May 07, 2009

Comment by andreas....@s-square.de, May 09, 2009

So i added several languages to the wiki svn, how can they be accessed explivitly through the web interface?

Comment by kevinc1846, May 09, 2009

Is there a way to say you do not want syntax highlighting in code blocks:

if x == 20 
   print("i do not want syntax highlighting for my custom language
end
Comment by lisndoo, May 20, 2009

Year Temperature (low) Temperature (high)
1900 -10 25
1910 -15 30
1920 -10 32
1930 N/A N/A
1940 -2 40
Comment by ecasbas, May 27, 2009

How could I make links within the same page since the "name" attribute is not supported?

Thanks

Comment by mrcons...@gmail.com, Jun 01, 2009

Reboot

Comment by marcogood411, Jun 02, 2009

List 1 List 2 List 3

Comment by ecasbas, Jun 04, 2009

OK, I answer myself. Following the instructions from http://code.google.com/p/support/issues/detail?id=376&can=1&q=anchor colspec=ID%20Type%20Status%20Milestone%20Priority%20Stars%20Owner%20Summary

Anchors are automatically created for each heading. e.g.

My second chapter

Can be linked to using My second chapter

It would be great to add this to the wiki syntax documentation.

Comment by ecasbas, Jun 04, 2009

with code

== My second chapter ==

can be linked using [#My_second_chapter My second chapter]
Comment by memon.faheem, Jun 08, 2009

This is test code

code 
Comment by pbirnie, Jun 08, 2009
Comment by pbirnie, Jun 08, 2009
Comment by G.Andrew.Stone, Jun 09, 2009

I read that you can check images into your svn repository and then reference them from the wiki. Maybe an example of this would be good

Comment by Metal3d, Jun 11 (6 days ago)

Is there a way to create directories:

project/wiki
          |---/tutorials
          |      |----- /tutorial1
          |      +----- /tutorial2
          |
          +--/manual
                 |---- /Introduction
                 |---- /the functions
|                +---- /the methods
Comment by chitawarlock, Jun 15 (2 days ago)

I create second locale in wiki (en - default, add russian). After creation locale russian wiki-page only browse, no edit link.

Comment by david.vas1, Yesterday (30 hours ago)

Nice desc.

Thanks

Enter a comment:


show hide Wiki markup help
=Heading1=
==Heading2==
===Heading3===

*bold*     _italic_
`inline code`
escape: `*`

Indent lists 2 spaces:
  * bullet item
  # numbered list

{{{
verbatim code block
}}}

Horizontal rule
----

WikiWordLink
[http://domain/page label]
http://domain/page

|| table || cells ||

More examples