Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Unsupported — use!
Ruby JavaScript CSS

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

gollum -- A wiki built on top of Git


Gollum is a simple wiki built on top of Git that powers GitHub Wikis. Gollum is designed so that you can create a compliant Git repository (known as a Gollum repository) either by hand, by calling API methods, or via the web interface.

We are making the source available so that you may test your wikis locally if you choose to edit them by hand.


A Gollum repository's contents are designed to be human editable. Page content is written in page files and may be organized into directories any way you choose. Special footers can be created in footer files. Other content (images, PDFs, etc) may also be present and organized in the same way.


Page files may be written in any format supported by GitHub-Markup. The current list of formats and allowed extensions is:

  • Markdown: .markdown, .mdown, .mkdn, .mkd, .md
  • Textile: .textile
  • RDoc: .rdoc
  • Org Mode: .org
  • Creole: .creole
  • ReStructured Text: .rest.txt, .rst.txt, .rest, .rst
  • ASCIIDoc: .asciidoc
  • POD: .pod
  • Roff: .1, .2, .3, ...

Gollum detects the page file format via the extension, so files must have one of the supported extensions in order to be converted.

Page file names may contain any printable UTF-8 character except space (U+0020) and forward slash (U+002F). If you commit a page file with any of these characters in the name it will not be accessible via the web interface.

Even though page files may be placed in any directory, there is still only a single namespace for page names, so all page files should have globally unique names regardless of where they are located in the repository.

The special page file Home.ext (where the extension is one of the supported formats) will be used as the entrance page to your wiki. If it is missing, an automatically generated table of contents will be shown instead.


Footer files allow you to add a simple footer to your wiki. Footer files must be named _Footer.ext where the extension is one of the supported formats. Footers affect all pages in their directory and any subdirectories that do not have a footer file of their own.


For security and compatibility reasons Gollum wikis may not contain custom CSS or JavaScript. These tags will be stripped from the converted HTML.


To link to another Gollum wiki page, use the Gollum Page Link Tag.

[[Frodo Baggins]]

The above tag will create a link to the corresponding page file named Frodo-Baggins.ext where ext may be any of the allowed extension types. The conversion is as follows:

  1. Replace any spaces (U+0020) with dashes (U+002D)
  2. Replace any slashes (U+002F) with dashes (U+002D)

If you'd like the link text to be something that doesn't map directly to the page name, you can specify the actual page name after a pipe:

[[Frodo|Frodo Baggins]]

The above tag will link to Frodo-Baggins.ext using "Frodo" as the link text.

The page file may exist anywhere in the directory structure of the repository. Gollum does a breadth first search and uses the first match that it finds.

Here are a few more examples:

[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
[[モルドール]] -> モルドール.ext


For Gollum tags that operate on static files (images, PDFs, etc), the paths may be referenced as either relative or absolute. Relative paths point to a static file relative to the page file within the directory structure of the Gollum repo (even though after conversion, all page files appear to be top level). These paths are NOT prefixed with a slash. For example:


Absolute paths point to a static file relative to the Gollum repo's root, regardless of where the page file is stored within the directory structure. These paths ARE prefixed with a slash. For example:


All of the examples in this README use relative paths, but you may use whatever works best in your situation.


To link to static files that are contained in the Gollum repository you should use the Gollum File Link Tag.


The first part of the tag is the link text. The filename appears after the pipe.


To display images that are contained in the Gollum repository you should use the Gollum Image Tag. This will display the actual image on the page.


In addition to the simple format, there are a variety of options that you can specify between pipe delimiters.

To specify alt text, use the alt= option. Default is no alt text.

[[gollum.png|alt=Gollum and his precious wiki]]

To place the image in a frame, use the frame option. When combined with the alt= option, the alt text will be used as a caption as well. Default is no frame.

[[gollum.png|frame|alt=Gollum and his precious wiki]]

To specify the alignment of the image on the page, use the align= option. Possible values are left, center, and right. Default is left.


To float an image so that text flows around it, use the float option. When float is specified, only left and right are valid align options. Default is not floating. When floating is activated but no alignment is specified, default alignment is left.


To specify a max-width, use the width= option. Units must be specified in either px or em. Default is 250px.


To specify a max-height, use the height= option. Units must be specified in either px or em. Default is 250px.


Any of these options may be composed together by simply separating them with pipes.


If you need the literal text of a wiki or static link to show up in your final wiki page, simply preface the link with a single quote (like in LISP):

'[[Page Link]]
'[[File Link|file.pdf]]

This is useful for writing about the link syntax in your wiki pages.


In page files you can get automatic syntax highlighting for a wide range of languages (courtesy of Pygments) by using the following syntax:

  def foo
    puts 'bar'

The block must start with three backticks (as the first characters on the line). After that comes the name of the language that is contained by the block. The language must be one of the short name lexer strings supported by Pygments. See the list of lexers for valid options.

If the block contents are indented two spaces or one tab, then that whitespace will be ignored (this makes the blocks easier to read in plaintext).

The block must end with three backticks as the first characters on a line.


The Gollum API allows you to retrieve raw or formatted wiki content from a Git repository, write new content to the repository, and collect various meta data about the wiki as a whole.

Initialize the Gollum::Repo object:

# Require rubygems if necessary
require 'rubygems'

# Require the Gollum library
require 'gollum'

# Create a new Gollum::Wiki object by initializing it with the path to the
# Git repository.
wiki ="my-gollum-repo.git")
# => <Gollum::Wiki>

By default, internal wiki links are all absolute from the root. To specify a different base path, you can send specify the :base_path option:

wiki ="my-gollum-repo.git", :base_path => "/wiki")

Get the latest version of the given human or canonical page name:

page ='page-name')
# => <Gollum::Page>

# => "# My wiki page"

# => "<h1>My wiki page</h1>"

# => :markdown

vsn = page.version
# => <Grit::Commit>
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'

Get a list of versions for a given page:

vsns ='page-name').versions
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'

# => Sun Mar 28 19:11:21 -0700 2010

Get a specific version of a given canonical page file:'page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')

Get the latest version of a given static file:

file = wiki.file('asset.js')
# => <Gollum::File>

# => "alert('hello');"

# => <Grit::Commit>

Get a specific version of a given static file:

wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')

Methods that write to the repository require a Hash of commit data that takes the following form:

commit = { :message => 'commit message',
           :name => 'Tom Preston-Werner',
           :email => '' }

Write a new version of a page (the file will be created if it does not already exist) and commit the change. The file will be written at the repo root.

wiki.write_page('Page Name', :markdown, 'Page contents', commit)

Update an existing page (keeps the same name, format, and directory location).

page ='Page Name')
wiki.update_page(page, 'Page contents', commit)

To delete a page and commit the change:

wiki.delete_page(page, commit)
Something went wrong with that request. Please try again.