Giter VIP home page Giter VIP logo

shins's Introduction

shins

Shins Is Not Slate

Beautiful static documentation for your API.

logo

Shins is a port of Slate to Javascript / Nodejs, and would not be possible without all of that hard work.

Version numbers of Shins aim to track the version of Slate they are compatible with.

screenshot

Usage

  • Fork the repository
  • Clone the fork
  • Edit source/index.html.md
  • npm install
  • node shins.js or
    • node shins.js --minify or
    • node shins.js --customcss or
    • node shins.js --inline or
    • node shins.js --unsafe
  • To check locally: node arapaho and browse to localhost:4567 - changes to your source .html.md files will automatically be picked up and re-rendered
  • Add, commit and push
  • Then (in your fork) press this button

Deploy

Or, to deploy to GitHub Pages:

  • Change the setting on your fork so Github Pages are served from the root directory
  • Browse to https://{yourname}.github.io/{repository-name}

API

var shins = require('shins');
var options = {};
options.minify = false;
options.customCss = false;
options.inline = false;
options.unsafe = false; // setting to true turns off markdown sanitisation
//options.source = filename; // used to resolve relative paths for included files
shins.render(markdownString, options, function(err, html) {
  // ...
});

or, with Promises:

var shins = require('shins');
var options = {};
options.minify = false;
options.customCss = false;
options.inline = false;
options.unsafe = false; // setting to true turns off markdown sanitisation
//options.source = filename; // used to resolve relative paths for included files
shins.render(markdownString, options)
.then(html => {
  // ...
});

The err parameter is the result of the ejs rendering step.

Setting customCss to true will include the pub/css/screen_overrides.css,pub/css/print_overrides.css and pub/css/theme_override.css files, in which you can override any of the default Slate theme, to save you from having to alter the main css files directly. This should make syncing up with future Shins / Slate releases easier.

Setting inline to true will inline all page resources (except resources referenced via CSS, such as fonts) to output html. This way HTML can be used stand-alone, without needing any other resources. It will also set minify to true.

Updating from Slate

  • Note: changes to Slate CSS, Javascript etc may break assumptions made in Shins. Use at your own risk.
  • The script updateFromSlate assumes you have Ruby Slate checked-out by the side of shins (i.e. in a sibling directory) and will copy .scss files, fonts, Javascript files etc.
  • The buildstyle.js program can be used to process the .scss files to their .css equivalents. It takes one optional parameter, the outputStyle used by node-sass. This can be either nested, expanded, compact or compressed. Default is nested.

Notes

  • Windows is definitely supported
  • Syntax highlighting in 176 languages and 79 themes (you can specify the highlighter theme to use by setting highlighter_theme in your slate markdown header)
  • Multiple language tabs per language are supported
  • Static TOC as per Slate v2.0
  • GitHub emoji shortcuts are supported
  • For converting OpenApi / Swagger or AsyncAPI definitions to Shins or Slate, see widdershins
  • If you need a CLI with more control over the options, why not try make-shins
  • Shins ships with an alternate theme by TradeGecko which is also under the Apache 2.0 license
  • Shins supports AsciiDoc include::filename[] syntax as well as !INCLUDE filename from markdown-pp
  • If you are using Node.js 4, please specify the --harmony flag

Shins in the wild

Please feel free to add a link to your API documentation here

shins's People

Contributors

mikeralphson avatar tomitakussaari 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.