Skip to content

Commit 7f013f3

Browse files
author
Sethen Maleno
committed
Added travis ci, tweaked some docs
1 parent cf29740 commit 7f013f3

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed

Diff for: .travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- "0.12"
4+
script: gulp test

Diff for: README.md

+1-19
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
* [Make a table of contents](#make-a-table-of-contents)
66
* [How To Install](#how-to-install)
77
* [How To Use From The Command Line](#how-to-use-from-the-command-line)
8-
* [markdown.json](#markdownjson)
8+
* [markdown.json](#markdown-json)
99
* [How To Use As A Module](#how-to-use-as-a-module)
10-
* [API](#api)
1110
* [How It Works](#how-it-works)
1211

1312

@@ -94,23 +93,6 @@ var markdownInclude = require('markdown-include');
9493
From there, you can use markdown-include's API to fit your needs.
9594

9695

97-
## API
98-
99-
When using as a module, markdown-include offers an API for you to work with markdown files as detailed below:
100-
101-
### `buildLinkString(str)`
102-
103-
```javascript
104-
var markdownInclude = require('markdown-include');
105-
markdownInclude.buildLinkString("My Link String"); // my-link-string
106-
```
107-
108-
| Parameter(s) | Type | Returns | Description |
109-
|:---------------:|:--------:|:---------|:----------------------------------------------------------------------:|
110-
| `string` | `String` | `String` | File path of where everything should be compiled, like `README.md`. |
111-
112-
---
113-
11496
# How It Works
11597

11698
markdown-include works by recursively going through files based on the tags that are found. For instance, consider the following in a `_README.md` file:

Diff for: docs/_README.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
#include "docs/how_to_use_command_line.md"
44
#include "docs/markdown-json.md"
55
#include "docs/how_to_use_module.md"
6-
#include "docs/api.md"
76
#include "docs/how_it_works.md"

Diff for: docs/api.md

+30-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,39 @@ When using as a module, markdown-include offers an API for you to work with mark
44

55
### `buildLinkString(str)`
66

7+
| Parameter(s) | Type | Returns | Description |
8+
|:---------------:|:--------:|:---------|:----------------------------------------------------------------------:|
9+
| `string` | `String` | `String` | File path of where everything should be compiled, like `README.md`. |
10+
11+
#### Description
12+
13+
A method for taking strings and building friendly markdown links. This is mostly used internally for building the table of contents.
14+
15+
#### Example
16+
717
```javascript
818
var markdownInclude = require('markdown-include');
919
markdownInclude.buildLinkString("My Link String"); // my-link-string
1020
```
1121

12-
| Parameter(s) | Type | Returns | Description |
13-
|:---------------:|:--------:|:---------|:----------------------------------------------------------------------:|
14-
| `string` | `String` | `String` | File path of where everything should be compiled, like `README.md`. |
15-
1622
---
23+
24+
### `compileFiles(path)`
25+
26+
| Parameter(s) | Type | Returns | Description |
27+
|:--------------:|:--------:|:------------------|:----------------------------------------------------------------------:|
28+
| `path` | `String` | `Object (Promise)` | Compiles files when given the path to `markdown.json` |
29+
30+
#### Description
31+
32+
This is probably the most important method in markdown-include. It takes a path to your markdown.json file, reads your options and returns a promise. When the promise is resolved it returns the data to you. This is exactly the same as running markdown-include in the command line as it runs through the whole lifecycle.
33+
34+
#### Example
35+
36+
```javascript
37+
var markdownInclude = require('markdown-include');
38+
markdownInclude.compileFiles("path/to/markdown.json").then(function (data) {
39+
// do something with compiled files
40+
});
41+
```
42+

0 commit comments

Comments
 (0)