Project

marsdawn

0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Make it easy to create static document site by building markdown documents and traverse them.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 10.3
~> 3.0

Runtime

~> 1.3
 Project Readme

Gem Version Build Status Coverage Status Code Climate

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.

└── my_document
    ├── .marsdawn.yml
    └── .index.md

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"
└── my_document
    ├── .marsdawn.yml
    ├── .index.md
    └── 010_about-the-document.md

To create new directory.

marsdawn dir "Tutorial"
└── my_document
    ├── .marsdawn.yml
    ├── .index.md
    ├── 010_about-the-document.md
    └── 020_tutorial
        └── .index.md

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

  1. Fork it ( http://github.com/nao58/marsdawn/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request