Skip to content

Commit a70a8d1

Browse files
committed
GitBook API Example
0 parents  commit a70a8d1

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Node rules:
2+
## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
3+
.grunt
4+
5+
## Dependency directory
6+
## Commenting this out is preferred by some people, see
7+
## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
8+
node_modules
9+
10+
# Book build output
11+
_book
12+
13+
# eBook build output
14+
*.epub
15+
*.mobi
16+
*.pdf

README.md

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

SUMMARY.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Summary
2+
3+
## Overview
4+
5+
* [My Awesome API](README.md)
6+
7+
## Methods
8+
9+
* [Defining Methods](methods.md)

book.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"plugins": [ "theme-api" ],
3+
"pluginsConfig": {
4+
"theme-api": {
5+
"languages": [
6+
{
7+
"lang": "js",
8+
"name": "JavaScript",
9+
"default": true
10+
},
11+
{
12+
"lang": "go",
13+
"name": "Go"
14+
}
15+
]
16+
}
17+
}
18+
}

methods.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Defining Methods
2+
3+
Methods allow you to smoothly display code examples in different languages.
4+
5+
{% method %}
6+
## My first method
7+
8+
My first method exposes how to print a message in JavaScript and Go.
9+
10+
{% sample lang="js" %}
11+
Here is how to print a message to `stdout` using JavaScript.
12+
13+
```js
14+
console.log('My first method');
15+
```
16+
17+
{% sample lang="go" %}
18+
Here is how to print a message to `stdout` using Go.
19+
20+
```go
21+
fmt.Println("My first method")
22+
```
23+
24+
{% common %}
25+
Whatever language you are using, the result will be the same.
26+
27+
```bash
28+
$ My first method
29+
```
30+
{% endmethod %}

0 commit comments

Comments
 (0)