commit a70a8d122ed27fb7bebd009c35b1d6705df8be00 Author: Ghost Date: Mon Jul 4 10:59:50 2016 +0200 GitBook API Example diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a366fb --- /dev/null +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3586eed --- /dev/null +++ b/README.md @@ -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. diff --git a/SUMMARY.md b/SUMMARY.md new file mode 100644 index 0000000..578117a --- /dev/null +++ b/SUMMARY.md @@ -0,0 +1,9 @@ +# Summary + +## Overview + +* [My Awesome API](README.md) + +## Methods + +* [Defining Methods](methods.md) \ No newline at end of file diff --git a/book.json b/book.json new file mode 100644 index 0000000..b955195 --- /dev/null +++ b/book.json @@ -0,0 +1,18 @@ +{ + "plugins": [ "theme-api" ], + "pluginsConfig": { + "theme-api": { + "languages": [ + { + "lang": "js", + "name": "JavaScript", + "default": true + }, + { + "lang": "go", + "name": "Go" + } + ] + } + } +} diff --git a/methods.md b/methods.md new file mode 100644 index 0000000..f9a8be2 --- /dev/null +++ b/methods.md @@ -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 %}