Git Product home page Git Product logo

emmett's Introduction

Emmett

Emmett is a tool named after Dr Emmett Brown from Back to the Future.

It's purpose is simple - given an index page and a bunch of API documents, it'll take them and generate a nice, usable website people can use to consume the documentation.

It doesn't automate the docs or the like - it just does the simplest thing possible.

Doc Generation

Emmett is simply a pipeline for building documentation. It expects very little, namely:

  • There is a specific api index page.
  • There is a directory holding all API section information as markdown files
  • Each page has a h1 with the section name
  • Each page has one or more h2's with an api endpoint described inside a single one.

From this, it will generate compiled HTML from a template (the default is built on bootstrap) with:

  • Markdown processed much like on GitHub.
  • A nav bar with your api name + drop downs of section titles.
  • An index of endpoints in each section before any of the endpoints are described.
  • An api index on the home page.

It'll automatically use Pygments for code highlighting, so for http examples we encourage the syntax like:

```http
GET /1/your/endpoint HTTP/1.1
Authorization: Bearer TOKEN
``

```http
HTTP/1.1 200 OK
Content-Type: text/plain

Alrighty then!
```

AKA, Calls described in the form of a simplified request lifecycle.

Installation

Add this line to your application's Gemfile:

gem 'emmett'

And then execute:

$ bundle

Or install it yourself as:

$ gem install emmett

Usage

Emmett is primarily intended to be used as a rake task.

Emmett + Rails

Want to generate the documentation directly in your application?

To configure it, the following options are available - simply put them in config/application.rb and change them as fit:

config.emmett.name        = "Your App"
config.emmett.index_page  = "doc/api.md" # Relative to doc/
config.emmett.section_dir = "doc/api" # Relative to doc/
config.emmett.output_dir  = "doc/generated-api"
config.emmett.template    = :default

It will use sane defaults (all being the same as above except the name, which is the rails root dir titleize. I do suggest changing this). In Rails, it will be available via rake doc:api.

Emmett on it's own.

Likewise, you can use emmett inside any application thanks to the Rake Task.

In your Rakefile, simply add:

require 'emmett/rake_task'

Emmett::RakeTask.new :docs do |t|
  t.name        = "Your App"
  t.index_page  = "api.md"
  t.section_dir = "api"
  t.output_dir  = "output"
  t.template    = :default
end

Like the rails version, this will use the values above as output, with the name being based on the current directory name.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Emmett is released under the MIT License (see the license file) and is copyright Filter Squad, 2012.

emmett's People

Contributors

sutto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.