-
Notifications
You must be signed in to change notification settings - Fork 52
Home
- Gollum
- Repo Structure
- Page Files
- ASCIIDoc: .asciidoc
- Creole: .creole
- Markdown: .markdown, .mdown, .mkdn, .mkd, .md
- Org Mode: .org
- Pod: .pod
- RDoc: .rdoc
- ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
- Textile: .textile
- MediaWiki: .mediawiki, .wiki
Gollum::Markup.register(:angry, "Angry") do |content|
content.upcase
end
Gollum detects the page file format via the extension, so files must have one of the default or registered 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.
- Sidebar Files
- Header Files
- Footer Files
- Html Sanitization
- Titles
The first `h1` tag can be set to always override the page title, without needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
- Bracket Tags
[[Link]]
Some tags will accept attributes which are separated by pipe symbols. For example:
[[Link|Page Title]]
In all cases, the first thing in the link is what is displayed on the page. So, if the tag is an internal wiki link, the first thing in the tag will be the link text displayed on the page. If the tag is an embedded image, the first thing in the tag will be a path to an image file. Use this trick to easily remember which order things should appear in tags.
Some formats, such as MediaWiki, support the opposite syntax:
[[Page Title|Link]]
- Page Links
[[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
- External Links
[[http://example.com]]
External links must begin with either "http://" or "https://". If you need something more flexible, you can resort to the link syntax in the page's underlying markup format.
- Absolute vs. Relative vs. External path
gollum.pdf docs/diagram.png
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:
/pdfs/gollum.pdf /docs/diagram.png
External paths are full URLs. An external path must begin with either "http://" or "https://". For example:
http://example.com/pdfs/gollum.pdf http://example.com/images/diagram.png
All of the examples in this README use relative paths, but you may use whatever works best in your situation.
- File Links
[[Gollum|gollum.pdf]]
The first part of the tag is the link text. The path to the file appears after the pipe.
- Images
[[gollum.png]]
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`.
[[gollum.png|align=center]]
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`.
[[gollum.png|float]]
By default text will fill up all the space around the image. To control how much should show up use this tag to stop and start a new block so that additional content doesn't fill in.
[[_]]
To specify a max-width, use the `width=` option. Units must be specified in either `px` or `em`.
[[gollum.png|width=400px]]
To specify a max-height, use the `height=` option. Units must be specified in either `px` or `em`.
[[gollum.png|height=300px]]
Any of these options may be composed together by simply separating them with pipes.
- Escaping Gollum Tags
'[[Page Link]]
'[[File Link|file.pdf]]
'[[image.jpg]]
This is useful for writing about the link syntax in your wiki pages.
- Table Of Contents
[[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted into the `_Header`, `_Footer` or `_Sidebar` files too.
There is also a wiki option `:universal_toc` which will display a table of contents at the top of all your wiki pages if it is enabled. The `:universal_toc` is not enabled by default. To set the option, add the option to the `:wiki_options` hash before starting the frontend app:
Precious::App.set(:wiki_options, {:universal_toc => true})
- Syntax Highlighting
```ruby
def foo
puts 'bar'
end
```
The block must start with three backticks, at the beginning of a line or indented with any number of spaces or tabs. 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](http://pygments.org/docs/lexers/) for valid options.
The block contents should be indented at the same level than the opening backticks. If the block contents are indented with an additional 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 indented at the same level than the opening backticks.
- GitHub Syntax Highlighting
```html:github:gollum/gollum/master/test/file_view/1_file.txt```
This will make the builder look at the **gollum user**, in the **gollum project**, in the **master branch**, at path **test/file_view/1_file.txt**. It will be rewritten to:
```html
<ol class="tree">
<li class="file"><a href="0">0</a></li>
</ol>
```
Which will be parsed as HTML code during the Pygments run, and thereby coloured appropriately.
- Mathematical Equations
Inline math:
\\\(2^2\\\)
Display math:
$$2^2$$
\\\[2^2\\\]
- Sequence Diagrams
{{{{{{ blue-modern alice->bob: Test bob->alice: Test response }}}}}}
You can replace the string "blue-modern" with any supported style.
- Include other pages
[[include:pagename]]