Skip to content

Commit a2217f3

Browse files
committed
Update reference.md
1 parent bd986c1 commit a2217f3

File tree

2 files changed

+56
-4
lines changed

2 files changed

+56
-4
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ legacy.js: \
2121
%.css: %.styl
2222
(echo "/*\n\nPlease don't edit this file directly.\nInstead, edit the stylus (.styl) files and compile it to CSS on your machine.\n\n*/" ; $(STYLUS) < $<) > $@
2323

24-
Reference.md: src/flatdoc.js
24+
Reference.md: flatdoc.js
2525
$(DOX) -r < $< | node support/dox2md.js --default-level 3 > $@
2626

2727
# $ make v/0.1.0

Reference.md

+55-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ Flatdoc.run({
1111
});
1212
```
1313

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+
1427

1528

1629
### Flatdoc.run()
@@ -39,6 +52,28 @@ See [Runner#run()] for a description of fetcher functions.
3952

4053
See: http://developer.github.com/v3/repos/contents/
4154

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+
4277
Parser
4378
------
4479

@@ -49,10 +84,7 @@ on the Markdown document.
4984
```js
5085
var data = Flatdoc.parser.parse('markdown source here');
5186
console.log(data);
52-
```
5387

54-
55-
```js
5688
data == {
5789
title: 'My Project',
5890
content: '<p>This project is a...',
@@ -163,6 +195,24 @@ The following options are available:
163195

164196
See: [Flatdoc.run()]
165197

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+
166216
### Runner#run()
167217

168218
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`.
177227
[Flatdoc.run()]: #flatdoc-run
178228
[Flatdoc.file()]: #flatdoc-file
179229
[Flatdoc.github()]: #flatdoc-github
230+
[Flatdoc.bitbucket()]: #flatdoc-bitbucket
180231
[Parser]: #parser
181232
[Parser.parse()]: #parser-parse
182233
[Transformer]: #transformer
@@ -189,5 +240,6 @@ Applies given doc data `data` to elements in object `elements`.
189240
[Highlighters.js]: #highlighters-js
190241
[MenuView]: #menuview
191242
[Runner]: #runner
243+
[Runner#highlight()]: #runner-highlight
192244
[Runner#run()]: #runner-run
193245
[Runner#applyData()]: #runner-applydata

0 commit comments

Comments
 (0)