Skip to content

Rio517/slate

 
 

Repository files navigation

ControlShift Labs API Documentation

The ControlShift Labs API documentation uses Slate - a middleman static site template of sorts for API documentation.

Updating Content

  • This branch is based on the v1.3.2 release (tag)
  • The only files you should need to edit:
    • /build/index.html.md
    • /build/includes/*.md
  • Webhooks documentation is auto-updated from https://demo.controlshiftlabs.com/api/webhooks.json at build. Just redeploy to update.
  • The source XML for the chart under BulkData is in /build/images. You can edit it by opening that file on https://www.draw.io/.

Content Considerations:

  • Our audience includes very junior developers and even non-coders, attempting to pull content into their WISIWYG CRM pages.
  • All examples and JS should be exceedingly basic, with generally linear control flows, and extremly easy to follow.

Editing "External" Codepen.io Examples

Our codepen.io code examples are actually generated/spawned on the fly using codepen.io's prefill API. Our "Launch Example" button links are actually form submit buttons sending post requests to the prefill endpoint.

  • All the JS and HTML is handled at the bottom of the json_*.md files. The most complete example of the options were utilizing is in the _json_effort_petitions_near.md file.
  • There is JS and some default options at the bottom of layout.erb. This JS transforms the inline HTML content into the proper format for the API endpoint.

This approach has two key benefits. First, there are no external dependencies/assets we need to maintain. It also puts in a position where we could let clients set their own domains or arrive at the documents with their domain in the URL, have our examples use this domain, and potential populate examples JSON payloads with the client's actual content.

Deploying to github pages

You just need to run ./deploy.sh, and that script will deploy to whatever git's origin is set-up as. If you're not deploying master, you will need to specify the branch name. Example:

GIT_DEPLOY_BRANCH=mf-cs-documentation ./deploy.sh

Getting Started with Slate

Prerequisites

You're going to need:

  • Linux or OS X — Windows may work, but is unsupported.
  • Ruby, version 1.9.3 or newer
  • Bundler — If Ruby is already installed, but the bundle command doesn't work, just run gem install bundler in a terminal.

Getting Set Up

  1. Fork this repository on Github.
  2. Clone your forked repository (not our original one) to your hard drive with git clone https://github.com/YOURUSERNAME/slate.git
  3. cd slate
  4. Initialize and start Slate. You can either do this locally, or with Vagrant:
# either run this to run locally
bundle install
bundle exec middleman server

# OR run this to run with vagrant
vagrant up

You can now see the docs at http://localhost:4567. Whoa! That was fast!

Now that Slate is all set up your machine, you'll probably want to learn more about editing Slate markdown, or how to publish your docs.

Companies Using Slate

You can view more in the list on the wiki.

Need Help? Found a bug?

Read our contribution guidelines, and then submit a issue to the Slate Github if you need any help. And, of course, feel free to submit pull requests with bug fixes or changes.

Contributors

Slate was built by Robert Lord while at TripIt.

Thanks to the following people who have submitted major pull requests:

Also, thanks to Sauce Labs for helping sponsor the project.

Special Thanks

About

Beautiful static documentation for your API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.7%
  • CSS 6.0%
  • SQLPL 4.0%
  • Shell 1.4%
  • HTML 1.4%
  • Ruby 1.0%
  • PLpgSQL 0.5%