paduc/apidoc

A javascript template for documenting an API

★ 3Forks 0GitHub ↗Compare

README

#API Documentor#

Api Documentor is a simple javascript/html workbench to help you easily document your api.

See live example

Please feel free to add or fix things!

##Features##

  • Describe your api in full detail in a json file
  • Group your actions into sections
  • Syntax-highlighted JSON samples of your inputs and outputs
  • Generated summary of your sections and actions

##How it works## Take a look at the example.

  • scheme.json contains the description of the api.
  • index.html loads scheme.json through api documentor and contains all the templates
var AD = new ApiDocumentor({
  // templates, don't bother if you like them the way they are
  section_template: $('#section-template').html(),
  action_template: $('#action-template').html(),
  example_template: $('#example-template').html(),
  
  // wherever you want the api actions to be appended
  target: $(".main"), 
  
  // set to true if you want a summary to be generated
  generateSummary: true, 
  
  // where you want the summary to be appended (if generateSummary: true)
  summaryTarget: $('.summary-container'), 
  
  // set to true if you want to load external fixtures automatically
  // if set to false, loads when user clicks
  autoLoadFixtures: true 
});

// load the scheme file
AD.fetch('scheme.json');
  • fixtures/ contains some request samples mentionned in scheme.json
  • css/style.css contains all styles (including css normalize)
  • css/theme.css gives a gist-like highlighting to the json samples

##Dependencies##

##Licence## Everything is Public Domain. Use it as you like. A link to this project would be appreciated.

Contributors

paduc

Issues