UNPKG

5.67 kBMarkdownView Raw
1# FireDoc [![Circle CI](https://circleci.com/gh/fireball-x/firedoc/tree/master.svg?style=shield)](https://circleci.com/gh/fireball-x/firedoc/tree/master)
2
3API Doc generator rewritten from [YUIDoc](https://github.com/yui/yuidoc). We use this tool to document a large JavaScript game engine [Fireball](http://github.com/fireball-x/fireball) at [docs-zh.fireball-x.com/api](http://docs-zh.fireball-x.com/api/) and self-document firedoc itself at:
4
5- English: http://fireball-x.github.io/firedoc/ or http://fireball-x.github.io/firedoc/en
6- 中文: http://fireball-x.github.io/firedoc/zh
7
8[![NPM](https://nodei.co/npm/firedoc.png?stars&downloads)](https://nodei.co/npm/firedoc/)
9
10
11Overview
12--------
13
14FireDoc is forked and rewritten from [YUIDoc](https://github.com/yui/yuidoc) and added some powerful enhanced features at [Syntax Guide](GUIDE.md).
15
16> YUIDoc is a [Node.js](http://nodejs.org/) application used at build time to
17> generate API documentation for JavaScript code. YUIDoc is comment-driven and supports a wide
18> range of JavaScript coding styles. The output of YUIDoc is API documentation formatted as a
19> set of HTML pages including information about methods, properties, custom events and
20> inheritance for JavaScript objects.
21
22> YUIDoc was originally written for the YUI Project; it uses YUI JavaScript and CSS in the
23> generated files and it supports common YUI conventions like Custom Events. That said,
24> it can be used easily and productively on non-YUI code.
25
26Installation
27------------
28
29```sh
30$ npm install -g firedoc
31```
32
33Usage
34-------
35
36```
37Usage: firedoc [options] [command]
38
39
40Commands:
41
42 build [path] build document from the directory
43 install [path] install theme or plugin
44 preview [path] build and preview the document from directory
45 help [cmd] display help for [cmd]
46
47Options:
48
49 -h, --help output usage information
50 -V, --version output the version number
51
52```
53
54Get Started
55-----------
56
57```sh
58$ firedoc build <path> --lang <lang>
59```
60
61Or using a shortcut command:
62
63```sh
64$ firedoc <path> --lang <lang>
65```
66
67The following is the helper of `firedoc-build(1)`:
68
69```
70 Usage: firedoc-build [options]
71
72 Options:
73
74 -h, --help output usage information
75 -l --lint lint the parser
76 --parse-only only parse
77 -H --http build doc for web
78 -M --markdown generate markdown docs
79 -T --theme <dir> specify theme directory
80 -D --dest <dir> the destination folder to build
81 -L --lang <language> the i18n language
82 -v --verbose print all verbose information
83```
84
85`--lang` option is required for multi-language description. Currently firedoc supports `en` and `zh` language option. Adding those option will generate docs for that specific language.
86
87
88`--markdown` or `-M` is optional flag, which lets you get the markdown-based documentation to
89directly host at Github or Bitbucket. [Firedoc](https://github.com/fireball-x/firedoc)'s github
90hosted documentation is generated by itself.
91
92For sites that requires a base url (such as `http://mysite.com/docs`), specify a `baseurl` property in your `yuidoc.json` file:
93
94```json
95{
96 "name": "My Site",
97 "baseurl": "/docs",
98 "options": {
99 "baseUrl": "",
100 "outdir": "path/to/output",
101 "linkNatives": true,
102 "paths": [
103 "path/to/my/src"
104 ],
105 "tabtospace": 4
106 }
107}
108```
109
110If you want to preview your api docs with local html files, add a
111```json
112"local": "true"
113```
114
115to your config file.
116
117Themes
118------------
119
120By default the firedoc provides the following 3 themes:
121
1221. [default](https://github.com/fireball-x/firedoc/tree/master/themes/default) the default theme of firedoc
1232. [default(zh)](https://github.com/fireball-x/firedoc/tree/master/themes/default_zh) the Chinese version of default
1243. [markdown](https://github.com/fireball-x/firedoc/tree/master/themes/markdown) the default markdown theme for firedoc
125
126#### Specify a theme locally
127
128```
129firedoc build <path> --theme [path/to/your/theme]
130```
131
132#### Install a theme remotely
133
134Firedoc supports that you can install a theme from [Github](https://github.com), [Bitbucket](https://bitbucket.org) or any other valid url.
135
136```sh
137$ firedoc install notab
138$ firedoc install firedoc-theme-notab
139$ firedoc install https://github.com/fireball-x/firedoc-theme-notab
140```
141
142The above command will install the theme [firedoc-theme-notab](https://github.com/fireball-x/firedoc-theme-notab) into installed firedoc directory in your machine. Then you would be able to use the theme just like this:
143
144```sh
145$ firedoc build <path> --theme notab
146```
147
148However if the remote url has a same basename with what you have installed in your machine, then you can specify a different name to install it:
149
150```sh
151$ firedoc install <url> --name different-theme-name
152```
153
154If you are wanting to write a new theme and need some details, you could go to: [themes README](themes).
155
156**Note**: please make sure you have the installed following dependencies before using theme functionality:
157
158- Node.js or IO.js which supports:
159 + Template string
160 + Synchronous `child_prcess` spawn
161- `git` command-line tool
162
163Test
164-------------
165
166To run test
167
168```sh
169$ npm test
170```
171
172Documentation
173-------------
174
175* [User Guides](GUIDE.md)
176* [Change Logs](https://github.com/fireball-x/firedoc/releases)
177* [API Docs(markdown)](docs)
178* [API Docs(html)](http://fireball-x.github.io/firedoc/)
179* [中文文档](http://fireball-x.github.io/firedoc/zh/)
180
181Contributing
182------------
183
184Please see the [CONTRIBUTING.md](CONTRIBUTING.md).
185
186License
187-------
188
189This software is free to use under the Yahoo Inc. BSD license. See the [LICENSE file](LICENSE) for license text and copyright information.