Rails Wiki

A small Rails engine that provides a git-based Markdown wiki.

WARNING: this has been abstracted from a proprietary tool, and so is poorly documented and lacks a standalone test suite. It would be premature to include it as a blind dependency.

How it Works

Rails Wiki is based on gollum-lib. None of Gollum's layout (e.g. sidebars, headers, footers) are implemented, and a many of the text filters (e.g. macros, code, diagrams) have been disabled. Also unlike Gollum, the hierarchy of pages is considered meaningful.

The storage structure will be familiar to users of Middleman or Jekyll. Each page is an .md file with YAML frontmatter for metadata. Other files are treated as attachments to the page associated with their containing directory.

All storage is via a local Git repository. Optionally, a remote can be specified and changes will be pushed to it.

TODO: review and document remote behavior

Installation

Add Rails Wiki to your Gemfile

gem 'rails-wiki'

Your application controller needs to provide two methods:

  • auth_required is called on every request
  • current_user returns a user object

The user object must response to .name and .email with string values.

Configuration

In your routes.rb, specify a mount point:

mount Wiki::Engine, at: '/wiki'

In your config/environment/* files, configure the wiki:

require 'rails-wiki'
Wiki.local_directory = 'db/wiki'

TODO: move this configuration to an initializer?

Usage

Pathnames that begin with underscore (_) are reserved.

Feature Roadmap

  1. Markdown link rooting
  2. Recursive page deletion
  3. Individual attachment deletion
  4. Path redirection rules
  5. Configurable help paths
  6. Nicer attachment upload
  7. Nicer page editing