snowboard

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2016 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

snowboard

Build Status GoDoc Docker Automated build

API blueprint parser and formatter.

Installation

The latest executables for supported platforms are available from the release page.

Just extract and start using it:

$ wget https://github.com/subosito/snowboard/releases/download/${version}/snowboard-${version}.${os}-${arch}.tar.gz
$ tar -zxvf snowboard-${version}.${os}-${arch}.tar.gz
$ ./snowboard -h

Alternatively, you can also use options below:

Homebrew
$ brew install --HEAD https://raw.github.com/subosito/snowboard/master/tools/homebrew/snowboard.rb
Docker

You can also use automated build docker image on subosito/snowboard:

$ docker pull subosito/snowboard
$ docker run subosito/snowboard -h

Note: Besides image on docker hub, you can also use image on quay.io/subosito/snowboard.

Manual
$ git clone https://github.com/subosito/snowboard.git
$ cd snowboard
$ make install

Note: ensure you have installed Go and configured your GOPATH and PATH.

Usage

Let's say we have API Blueprint document called API.apib, like:

$ cat API.apib
# My API
## GET /message
+ Response 200 (text/plain)

        Hello World!

There are some scenarios we can perform:

Generate HTML Documentation

To generate HTML documentation we can do:

$ snowboard -i API.apib -o output.html

Above command will generate ouput.html using snowboard default template (called alpha).

Using Custom Template

If you want to use custom template, you can use flag -t for that:

$ snowboard -i API.apib -o output.html -t awesome-template.html

To see how the template looks like, you can see snowboard default template located in templates/alpha.html.

Auto-Regenerate HTML Documentation

If you want toauto-regenerate HTML documentation, especially on local development, you can pass -w flag:

$ snowboard -i API.apib -o output.html -t awesome-template.html -w

With this flag, any updates on both input and template file will trigger auto-regeneration.

Use Drafter CLI

If you have drafter command line installed, you can use that for parsing API blueprint within snowboard, just pass -e flag:

$ snowboard -i API.apib -o output.html -e cli

Note: Ensure drafter is already on your PATH directories.

Help

As usual, you can also see all supported flags by passing -h:

$ snowboard -h
Usage:
  snowboard [OPTIONS]

Options:
  -e string
        Use different engine. Supported engines: cgo, cli (default "cgo")
  -i string
        API Blueprint file
  -l    Validate input only
  -o string
        HTML output file (default "index.html")
  -s    Serve HTML via 0.0.0.0:8088
  -t string
        Custom template for documentation (default "alpha")
  -v    Display version information
  -w    Watch input (and template, if any) file for changes

Examples

You can see examples of snowboard default template outputs, in examples/alpha directory. They looks like:

All of the examples are generated from official API Blueprint examples

Documentation

Overview

Package snowboard parses API Blueprint and renders it as HTML document

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(tpl string, w io.Writer, b *api.API) error

HTML renders blueprint.API struct as HTML document

func Parse

func Parse(r io.Reader, engine Parser) (*api.API, error)

Parse formats API Blueprint as blueprint.API struct using selected Parser

func Validate added in v0.2.0

func Validate(r io.Reader, engine Checker) (*api.API, error)

Validate validates API Blueprint using selected Parser

Types

type Checker added in v0.2.0

type Checker interface {
	Validate(r io.Reader) ([]byte, error)
	Version() map[string]string
}

type Markdowner added in v0.3.0

type Markdowner interface {
	Markdown([]byte) []byte
}

type Parser added in v0.1.1

type Parser interface {
	Parse(r io.Reader) ([]byte, error)
	Version() map[string]string
}

Directories

Path Synopsis
cmd
snowboard command
engines
plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL