Skip to content

Commit b34b60f

Browse files
committed
Dox2md.
1 parent 84525b5 commit b34b60f

File tree

6 files changed

+317
-146
lines changed

6 files changed

+317
-146
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
UGLIFY := ./node_modules/.bin/uglifyjs --comments "/^!/"
22
STYLUS := ./node_modules/.bin/stylus -U -u nib
3-
DOX := dox
3+
DOX := ./node_modules/.bin/dox
44

55
all: \
66
flatdoc.js \
@@ -25,7 +25,7 @@ theme-white/script.js: theme-white/setup.js vendor/jquery.scrollagent.js vendor/
2525
cat $^ > $@
2626

2727
Reference.md: src/flatdoc.js
28-
$(DOX) -a < $< | sed "s/^## \(.*\.\)/### \1/g" > $@
28+
$(DOX) -r < $< | node support/dox2md.js > $@
2929

3030
# $ make v/0.1.0
3131
# Makes a distribution.

Reference.md

+110-87
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
1-
- [Flatdoc](#flatdoc)
2-
- [Flatdoc.run()](#flatdocrun)
3-
- [Flatdoc.file()](#flatdocfile)
4-
- [Flatdoc.github()](#flatdocgithub)
5-
- [Parser](#parser)
6-
- [Parser.parse()](#parserparse)
7-
- [Transformer](#transformer)
8-
- [Transformer.mangle()](#transformermangle)
9-
- [Transformer.addIDs()](#transformeraddids)
10-
- [Transformer.getMenu()](#transformergetmenu)
11-
- [Transformer.buttonize()](#transformerbuttonize)
12-
- [Transformer.smartquotes()](#transformersmartquotes)
13-
- [Highlighters](#highlighters)
14-
- [MenuView](#menuview)
15-
- [Runner](#runner)
16-
- [Runner.run()](#runnerrun)
17-
- [Runner.applyData()](#runnerapplydata)
18-
19-
## Flatdoc
20-
21-
Flatdoc.
1+
Flatdoc
2+
=======
3+
4+
Basic Flatdoc module.
5+
6+
The main entry point is `Flatdoc.run()`, which invokes the [Runner].
7+
8+
```js
9+
Flatdoc.run({
10+
fetcher: Flatdoc.github('rstacruz/backbone-patterns');
11+
});
12+
```
13+
14+
2215

2316
### Flatdoc.run()
2417

25-
Runs.
18+
Creates a runner.
19+
See [Flatdoc].
2620

2721
### Flatdoc.file()
2822

29-
File fetcher function.
30-
31-
Fetches a given `url` via AJAX.
32-
See [Runner#run()] for a description of fetcher functions.
23+
File fetcher function.
24+
25+
Fetches a given `url` via AJAX.
26+
See [Runner#run()] for a description of fetcher functions.
3327

3428
### Flatdoc.github()
3529

36-
Github fetcher.
37-
Fetches from repo `repo` (in format 'user/repo').
38-
39-
If the parameter `filepath` is supplied, it fetches the contents of that
40-
given file in the repo.
41-
42-
See [Runner#run()] for a description of fetcher functions.
43-
44-
See: http://developer.github.com/v3/repos/contents/
30+
Github fetcher.
31+
Fetches from repo `repo` (in format 'user/repo').
4532

46-
## Parser
33+
If the parameter `filepath` is supplied, it fetches the contents of that
34+
given file in the repo.
35+
36+
See [Runner#run()] for a description of fetcher functions.
37+
38+
See: http://developer.github.com/v3/repos/contents/
39+
40+
Parser
41+
------
42+
43+
Parser module.
44+
Parses a given Markdown document and returns a JSON object with data
45+
on the Markdown document.
4746

48-
Parser module.
49-
Parses a given Markdown document and returns a JSON object with data
50-
on the Markdown document.
51-
5247
```js
5348
var data = Flatdoc.parser.parse('markdown source here');
5449
console.log(data);
@@ -63,41 +58,43 @@ data == {
6358
}
6459
```
6560

61+
62+
6663
### Parser.parse()
6764

68-
Parses a given Markdown document.
69-
See `Parser` for more info.
65+
Parses a given Markdown document.
66+
See `Parser` for more info.
7067

71-
## Transformer
68+
Transformer
69+
-----------
70+
71+
Transformer module.
72+
This takes care of any HTML mangling needed. The main entry point is
73+
`.mangle()` which applies all transformations needed.
7274

73-
Transformer module.
74-
This takes care of any HTML mangling needed. The main entry point is
75-
`.mangle()` which applies all transformations needed.
76-
7775
```js
7876
var $content = $("<p>Hello there, this is a docu...");
7977
Flatdoc.transformer.mangle($content);
8078
```
8179

82-
83-
If you would like to change any of the transformations, decorate any of
84-
the functions in `Flatdoc.transformer`.
80+
If you would like to change any of the transformations, decorate any of
81+
the functions in `Flatdoc.transformer`.
8582

8683
### Transformer.mangle()
8784

88-
Takes a given HTML `$content` and improves the markup of it by executing
89-
the transformations.
90-
91-
> See: [Transformer](#transformer)
85+
Takes a given HTML `$content` and improves the markup of it by executing
86+
the transformations.
87+
88+
> See: [Transformer](#transformer)
9289
9390
### Transformer.addIDs()
9491

95-
Adds IDs to headings.
92+
Adds IDs to headings.
9693

9794
### Transformer.getMenu()
9895

99-
Returns menu data for a given HTML.
100-
96+
Returns menu data for a given HTML.
97+
10198
```js
10299
menu = Flatdoc.transformer.getMenu($content);
103100
menu == {
@@ -108,61 +105,87 @@ menu == {
108105
items: [...]}, ...]}
109106
```
110107

108+
109+
111110
### Transformer.buttonize()
112111

113-
Changes "button >" text to buttons.
112+
Changes "button >" text to buttons.
114113

115114
### Transformer.smartquotes()
116115

117-
Applies smart quotes to a given element.
118-
It leaves `code` and `pre` blocks alone.
116+
Applies smart quotes to a given element.
117+
It leaves `code` and `pre` blocks alone.
119118

120-
## Highlighters
119+
Highlighters
120+
------------
121+
122+
Syntax highlighters.
123+
124+
You may add or change more highlighters via the `Flatdoc.highlighters`
125+
object.
121126

122-
Syntax highlighters.
123-
124-
You may add or change more highlighters via the `Flatdoc.highlighters`
125-
object.
126-
127127
```js
128128
Flatdoc.highlighters.js = function(code) {
129129
};
130130
```
131131

132-
133-
Each of these functions
132+
Each of these functions
134133

135-
## MenuView
134+
### Highlighters.js
136135

137-
Menu view. Renders menus
136+
JavaScript syntax highlighter.
138137

139-
## Runner
138+
Thanks @visionmedia!
139+
140+
MenuView
141+
--------
142+
143+
Menu view. Renders menus
144+
145+
Runner
146+
------
147+
148+
A runner module that fetches via a `fetcher` function.
140149

141-
A runner module that fetches via a `fetcher` function.
142-
143150
```js
144151
var runner = new Flatdoc.runner({
145152
fetcher: Flatdoc.url('readme.txt')
146153
});
147154
runner.run();
148155
```
149156

150-
151-
The following options are available:
152-
153-
- `fetcher` - a function that takes a callback as an argument and
154-
```js
155-
executes that callback when data is returned.
156-
```
157+
The following options are available:
157158

158-
159-
See: [Flatdoc.run()]
159+
- `fetcher` - a function that takes a callback as an argument and
160+
executes that callback when data is returned.
161+
162+
See: [Flatdoc.run()]
163+
164+
### Runner#run()
165+
166+
Loads the Markdown document (via the fetcher), parses it, and applies it
167+
to the elements.
160168

161-
### Runner.run()
169+
### Runner#applyData()
162170

163-
Loads the Markdown document (via the fetcher), parses it, and applies it
164-
to the elements.
171+
Applies given doc data `data` to elements in object `elements`.
165172

166-
### Runner.applyData()
167173

168-
Applies given doc data `data` to elements in object `elements`.
174+
[Flatdoc]: #flatdoc
175+
[Flatdoc.run()]: #flatdoc-run
176+
[Flatdoc.file()]: #flatdoc-file
177+
[Flatdoc.github()]: #flatdoc-github
178+
[Parser]: #parser
179+
[Parser.parse()]: #parser-parse
180+
[Transformer]: #transformer
181+
[Transformer.mangle()]: #transformer-mangle
182+
[Transformer.addIDs()]: #transformer-addids
183+
[Transformer.getMenu()]: #transformer-getmenu
184+
[Transformer.buttonize()]: #transformer-buttonize
185+
[Transformer.smartquotes()]: #transformer-smartquotes
186+
[Highlighters]: #highlighters
187+
[Highlighters.js]: #highlighters-js
188+
[MenuView]: #menuview
189+
[Runner]: #runner
190+
[Runner#run()]: #runner-run
191+
[Runner#applyData()]: #runner-applydata

0 commit comments

Comments
 (0)