GitBook API Example

This commit is contained in:
Ghost 2016-07-04 10:59:50 +02:00
commit a70a8d122e
5 changed files with 76 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
# Node rules:
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
## Dependency directory
## Commenting this out is preferred by some people, see
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
node_modules
# Book build output
_book
# eBook build output
*.epub
*.mobi
*.pdf

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# My Awesome API
This file file serves as your book's preface, a great place to describe your book's content and ideas.

9
SUMMARY.md Normal file
View File

@ -0,0 +1,9 @@
# Summary
## Overview
* [My Awesome API](README.md)
## Methods
* [Defining Methods](methods.md)

18
book.json Normal file
View File

@ -0,0 +1,18 @@
{
"plugins": [ "theme-api" ],
"pluginsConfig": {
"theme-api": {
"languages": [
{
"lang": "js",
"name": "JavaScript",
"default": true
},
{
"lang": "go",
"name": "Go"
}
]
}
}
}

30
methods.md Normal file
View File

@ -0,0 +1,30 @@
# Defining Methods
Methods allow you to smoothly display code examples in different languages.
{% method %}
## My first method
My first method exposes how to print a message in JavaScript and Go.
{% sample lang="js" %}
Here is how to print a message to `stdout` using JavaScript.
```js
console.log('My first method');
```
{% sample lang="go" %}
Here is how to print a message to `stdout` using Go.
```go
fmt.Println("My first method")
```
{% common %}
Whatever language you are using, the result will be the same.
```bash
$ My first method
```
{% endmethod %}