summaryrefslogtreecommitdiffstats
path: root/docs/internals/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/internals/README.md')
-rw-r--r--docs/internals/README.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/internals/README.md b/docs/internals/README.md
new file mode 100644
index 0000000..7ee13c3
--- /dev/null
+++ b/docs/internals/README.md
@@ -0,0 +1,33 @@
+# Using GitBook programmatically
+
+GitBook is mainly designed to work as a command line utility, but it can also be integrated into javascript application (Node.js or browser).
+
+Its API can be used for parsing a book, modifying the structure of a book, or generating outputs.
+
+### Installation
+
+```
+$ npm install gitbook
+```
+
+### Design
+
+The GitBook Core API is built around **promises** and **immutable** models.
+
+### Example
+
+```js
+const GitBook = require('gitbook');
+
+// Create a filesystem interface
+const fs = GitBook.createNodeFS(__dirname + '/mybook');
+
+// Create a book instance
+const book = GitBook.Book.createForFS(fs);
+
+// Parse it
+GitBook.Parse.parseBook(book)
+.then(newBook => {
+ console.log('Done!');
+})
+```