Skip to content

Commit

Permalink
GitBook API Example
Browse files Browse the repository at this point in the history
  • Loading branch information
gitbook-bot committed Sep 17, 2016
0 parents commit a70a8d1
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Summary

## Overview

* [My Awesome API](README.md)

## Methods

* [Defining Methods](methods.md)
18 changes: 18 additions & 0 deletions book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"plugins": [ "theme-api" ],
"pluginsConfig": {
"theme-api": {
"languages": [
{
"lang": "js",
"name": "JavaScript",
"default": true
},
{
"lang": "go",
"name": "Go"
}
]
}
}
}
30 changes: 30 additions & 0 deletions methods.md
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit a70a8d1

Please sign in to comment.