Marsdawn
MarsDawn is simple static document builder and traverser. You can create your own document site easily using this gem.
Installation
Add this line to your application's Gemfile:
gem 'marsdawn'
And then execute:
$ bundle
Or install it yourself as:
$ gem install marsdawn
Usage
Create your document source
Use marsdawn command.
marsdawn create "My Document"
Then the document and files will be created like below.
The file .marsdawn.yml
includes the information of whole document set. .index.md
is the top page. You can edit the file to add your content.
To create new page.
marsdawn page "About the document"
To create new directory.
marsdawn dir "Tutorial"
Build the documents
Setting config file is the easiest way to build the document.
Create config file names "marsdawn.yml" under "config" directory of your framework.
your_document_key:
source: path/to/your/source/documents
storage:
path: path/to/build/directory
This time we will build the document onto the file system. You can choose RDBMS storage instead.
Then simply hit the rake command.
rake marsdawn:build
Traverse the documents
Once you have built the document, you can traverse the document easily from your own site.
This is a sample controller for Padrino.
YourWeb::App.controllers :docs do
get :index, :map => '/docs/*path' do
docset = Marsdawn::Site.new(key: 'your_document_key', lang: 'en', version: '1.0.0', base_path: '/docs')
@page = docset.page("/#{params[:path].join('/')}")
@title = @page.title
render 'docs'
end
end
Now you can create your templete for the document page.
Contributing
- Fork it ( http://github.com/nao58/marsdawn/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request