Madman

Gem Version Build Status Maintainability Test Coverage


The Markdown Swiss Armi Knife


Installation

$ gem install madman

Or with Bundler:

gem 'madman', require: false

Key Features

  • GitHub-style markdown generation.
  • Convert markdown to a single HTML file (including CSS).
  • Ad-hoc server to serve a markdown file locally for preview.
  • Markdown generation with GitHub API (optional).
  • [Planned] Table of Contents generation for a single file.
  • [Planned] Table of Contents generation for a folder of markdown files.
  • [Planned] Combine multiple markdown files to one.
  • [Considered] Web server for an entire folder (like Madness)

Usage

$ madman
Commands:
  render  Render markdown to HTML
  serve   Run a webserver and serve the markdown file as HTML

$ madman render --help
Render markdown to HTML

Usage:
  madman render INFILE [OUTFILE] [--rtl --github]
  madman render (-h|--help|--version)

Options:
  --github
    Render using the GitHub API
    Requires setting the GITHUB_ACCESS_TOKEN environment variable

  --rtl
    Render text Right to Left

  -h --help
    Show this help

Parameters:
  INFILE
    The input markdown file

  OUTFILE
    The output HTML file
    If not provided, the input filename will be used with .html extension

Environment Variables:
  GITHUB_ACCESS_TOKEN
    Your GitHub API access token
    Generate one here: https://github.com/settings/tokens

Examples:
  madman render README.md
  madman render README.md --github
  madman render README.md out.html --rtl

$ madman serve --help
Run a webserver and serve the markdown file as HTML

This command will start a local server with two endpoints:
  /         will render the markdown with the default renderer
  /github   will render with the GitHub API

Usage:
  madman serve INFILE [--port N --bind ADDRESS --rtl]
  madman serve (-h|--help|--version)

Options:
  --rtl
    Render text Right to Left.

  -p --port N
    Set server port [default: 3000]

  -b --bind ADDRESS
    Set server listen address [default: 0.0.0.0]

  -h --help
    Show this help

Parameters:
  INFILE
    The input markdown file

Environment Variables:
  GITHUB_ACCESS_TOKEN
    Your GitHub API access token
    Required only if you wish to use the '/github' endpoint
    Generate one here: https://github.com/settings/tokens

Examples:
  madman serve README.md
  madman serve README.md -p4000 --rtl