omnilaboratory / api.doc

OmniBOLT and OmniWallet(HD) API document. Powered by slate.

Home Page:https://spectrum.chat/slate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slate: API Documentation Generator
Build Status

Slate helps you create beautiful, intelligent, responsive API documentation.

Screenshot of Example Documentation created with Slate

The example above was created with Slate. Check it out at lord.github.io/slate.

Features

  • Clean, intuitive design — With Slate, the description of your API is on the left side of your documentation, and all the code examples are on the right side. Inspired by Stripe's and PayPal's API docs. Slate is responsive, so it looks great on tablets, phones, and even in print.

  • Everything on a single page — Gone are the days when your users had to search through a million pages to find what they wanted. Slate puts the entire documentation on a single page. We haven't sacrificed linkability, though. As you scroll, your browser's hash will update to the nearest header, so linking to a particular point in the documentation is still natural and easy.

  • Slate is just Markdown — When you write docs with Slate, you're just writing Markdown, which makes it simple to edit and understand. Everything is written in Markdown — even the code samples are just Markdown code blocks.

  • Write code samples in multiple languages — If your API has bindings in multiple programming languages, you can easily put in tabs to switch between them. In your document, you'll distinguish different languages by specifying the language name at the top of each code block, just like with GitHub Flavored Markdown.

  • Out-of-the-box syntax highlighting for over 100 languages, no configuration required.

  • Automatic, smoothly scrolling table of contents on the far left of the page. As you scroll, it displays your current position in the document. It's fast, too. We're using Slate at TripIt to build documentation for our new API, where our table of contents has over 180 entries. We've made sure that the performance remains excellent, even for larger documents.

  • Let your users update your documentation for you — By default, your Slate-generated documentation is hosted in a public GitHub repository. Not only does this mean you get free hosting for your docs with GitHub Pages, but it also makes it simple for other developers to make pull requests to your docs if they find typos or other problems. Of course, if you don't want to use GitHub, you're also welcome to host your docs elsewhere.

  • RTL Support Full right-to-left layout for RTL languages such as Arabic, Persian (Farsi), Hebrew etc.

Getting started with Slate is super easy! Simply fork this repository and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the sample docs.

Getting Started with Slate

Prerequisites

You're going to need:

  • Linux or macOS — Windows may work, but is unsupported.
  • Ruby, version 2.3.1 or newer

The following instruction is for Ubuntu installation:

>sudo apt-get update
>sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Download and install Ruby:

>wget https://cache.ruby-china.com/pub/ruby/ruby-2.3.1.tar.gz
>tar -zxvf ruby-2.3.1.tar.gz
>cd ruby-2.3.1
>./configure
>make&&make install
>ruby -v

Download rubygems-2.7.7

>wget https://rubygems.org/rubygems/rubygems-2.7.7.tgz
>tar -zxvf rubygems-2.7.7.tgz 
>cd rubygems-2.7.7 
>ruby setup.rb

Install Zlib

>cd ruby-2.3.1/ext/zlib
>ruby ./extconf.rb
>make&&make install
>cd rubygems-2.7.7
>ruby setup.rb

Install Openssl, which is needed in running ruby:

>sudo apt-get install openssl
>sudo apt-get install libssl-dev
>sudo apt-get install libssl0.9.8

Then go to the Ruby source code directory:

>cd ruby-2.3.1/ext/openssl
>ruby extconf.rb
>make 
>sudo make install

If you encounter make: *** No rule to make target /include/ruby.h , needed by ossl.o . Stop., then you need to edit {ruby source code path}/ext/openssl/Makefile, and add evaluate top_srcdir(the third line of the following snippet):

srcdir = .
topdir = /usr/local/include/ruby-2.1.0
top_srcdir = {ruby source code path}
hdrdir = $(topdir)
arch_hdrdir = /usr/local/include/ruby-2.1.0/x86_64-linux

Save, and run make && make install again. It works.

  • 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

# on ubuntu, you may need to use sudo to run bundle install
sudo bundle install

# OR run this to run with vagrant
vagrant up

If encounters failure of JS runtime:

bundler: failed to load command: middleman (/usr/local/bin/middleman)
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. 

You will need to install node.js to solve it:

sudo apt-get install nodejs

Then run bundle exec middleman server again, the following prompt shows success:

== The Middleman is loading
== View your site at "http://localhost:4567", "http://127.0.0.1:4567"

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

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

Be noticed, every time you run ./deploy.sh, the Custom domain will be changed back to https://github.com/you_organization/your_api_doc_repo. So you need to add a new document CNAME under directoy /source, with content of your domain information. In our case, the content is api.omnilab.online. Push CNAME to this repository.

If you'd prefer to use Docker, instructions are available in the wiki.

Note on JavaScript Runtime

For those who don't have JavaScript runtime or are experiencing JavaScript runtime issues with ExecJS, it is recommended to add the rubyracer gem to your gemfile and run bundle again.

Companies Using Slate

You can view more in the list on the wiki.

Questions? Need Help? Found a bug?

If you've got questions about setup, deploying, special feature implementation in your fork, or just want to chat with the developer, please feel free to start a thread in our Spectrum community!

Found a bug with upstream Slate? Go ahead and submit an issue. And, of course, feel free to submit pull requests with bug fixes or changes to the dev branch.

Contributors

Slate was built by Robert Lord while interning at TripIt.

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

Also, thanks to Sauce Labs for sponsoring the development of the responsive styles.

Special Thanks

About

OmniBOLT and OmniWallet(HD) API document. Powered by slate.

https://spectrum.chat/slate

License:Other


Languages

Language:JavaScript 64.1%Language:HTML 27.6%Language:SCSS 5.8%Language:Ruby 1.4%Language:Shell 1.1%