@@ -11,6 +11,19 @@ Flatdoc.run({
11
11
});
12
12
```
13
13
14
+ These fetcher functions are available:
15
+
16
+ ``` js
17
+ Flatdoc .github (' owner/repo' )
18
+ Flatdoc .github (' owner/repo' , ' API.md' )
19
+ Flatdoc .github (' owner/repo' , ' API.md' , ' branch' )
20
+ Flatdoc .bitbucket (' owner/repo' )
21
+ Flatdoc .bitbucket (' owner/repo' , ' API.md' )
22
+ Flatdoc .bitbucket (' owner/repo' , ' API.md' , ' branch' )
23
+ Flatdoc .file (' http://path/to/url' )
24
+ Flatdoc .file ([ ' http://path/to/url' , ... ])
25
+ ```
26
+
14
27
15
28
16
29
### Flatdoc.run()
@@ -39,6 +52,28 @@ See [Runner#run()] for a description of fetcher functions.
39
52
40
53
See: http://developer.github.com/v3/repos/contents/
41
54
55
+ ### Flatdoc.bitbucket()
56
+
57
+ Bitbucket fetcher.
58
+ Fetches from repo ` repo ` (in format 'user/repo').
59
+
60
+ If the parameter ` filepath ` is supplied, it fetches the contents of that
61
+ given file in the repo.
62
+
63
+ See [ Runner#run()] for a description of fetcher functions.
64
+
65
+ See: https://confluence.atlassian.com/display/BITBUCKET/src+Resources#srcResources-GETrawcontentofanindividualfile
66
+ See: http://ben.onfabrik.com/posts/embed-bitbucket-source-code-on-your-website
67
+ Bitbucket appears to have stricter restrictions on
68
+ Access-Control-Allow-Origin, and so the method here is a bit
69
+ more complicated than for Github
70
+
71
+ If you don't pass a branch name, then 'default' for Hg repos is assumed
72
+ For git, you should pass 'master'. In both cases, you should also be able
73
+ to pass in a revision number here -- in Mercurial, this also includes
74
+ things like 'tip' or the repo-local integer revision number
75
+ Default to Mercurial because Git users historically tend to use GitHub
76
+
42
77
Parser
43
78
------
44
79
@@ -49,10 +84,7 @@ on the Markdown document.
49
84
``` js
50
85
var data = Flatdoc .parser .parse (' markdown source here' );
51
86
console .log (data);
52
- ```
53
87
54
-
55
- ``` js
56
88
data == {
57
89
title: ' My Project' ,
58
90
content: ' <p>This project is a...' ,
@@ -163,6 +195,24 @@ The following options are available:
163
195
164
196
See: [ Flatdoc.run()]
165
197
198
+ ### Runner#highlight()
199
+
200
+ Syntax highlighting.
201
+
202
+ You may define a custom highlight function such as ` highlight ` from
203
+ the highlight.js library.
204
+
205
+ ``` js
206
+ Flatdoc .run ({
207
+ highlight : function (code , value ) {
208
+ return hljs .highlight (lang, code).value ;
209
+ },
210
+ ...
211
+ });
212
+ ```
213
+
214
+
215
+
166
216
### Runner#run()
167
217
168
218
Loads the Markdown document (via the fetcher), parses it, and applies it
@@ -177,6 +227,7 @@ Applies given doc data `data` to elements in object `elements`.
177
227
[ Flatdoc.run() ] : #flatdoc-run
178
228
[ Flatdoc.file() ] : #flatdoc-file
179
229
[ Flatdoc.github() ] : #flatdoc-github
230
+ [ Flatdoc.bitbucket() ] : #flatdoc-bitbucket
180
231
[ Parser ] : #parser
181
232
[ Parser.parse() ] : #parser-parse
182
233
[ Transformer ] : #transformer
@@ -189,5 +240,6 @@ Applies given doc data `data` to elements in object `elements`.
189
240
[ Highlighters.js ] : #highlighters-js
190
241
[ MenuView ] : #menuview
191
242
[ Runner ] : #runner
243
+ [ Runner#highlight() ] : #runner-highlight
192
244
[ Runner#run() ] : #runner-run
193
245
[ Runner#applyData() ] : #runner-applydata
0 commit comments