1 |
|
2 | [![NPM](https://nodei.co/npm/ink-docstrap.png?downloads=true)](https://nodei.co/npm/ink-docstrap/)
|
3 |
|
4 | [![Dependency Status](https://david-dm.org/docstrap/docstrap.svg)](https://david-dm.org/docstrap/docstrap) [![devDependency Status](https://david-dm.org/docstrap/docstrap/dev-status.svg)](https://david-dm.org/docstrap/docstrap#info=devDependencies)
|
5 |
|
6 | # DocStrap [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
|
7 |
|
8 | DocStrap is [Bootstrap](http://twitter.github.io/bootstrap/index.html) based template for [JSDoc3](http://usejsdoc.org/).
|
9 | In addition, it includes all of the themes from [Bootswatch](http://bootswatch.com/) giving you a great deal of look
|
10 | and feel options for your documentation, along with a simple search. Additionally, it adds some options to the conf.json file that gives
|
11 | you even more flexibility to tweak the template to your needs. It will also make your teeth whiter.
|
12 |
|
13 | ## Features ##
|
14 |
|
15 | * Right side TOC for navigation in pages
|
16 | * Integrated offline search
|
17 | * Themed
|
18 | * Customizable
|
19 | * Syntax highlighting
|
20 |
|
21 | ### What It Looks Like ###
|
22 | Here are examples of this template with the different Bootswatch themes:
|
23 |
|
24 | + [Cerulean](http://docstrap.github.io/docstrap/themes/cerulean)
|
25 | + [Cosmo](http://docstrap.github.io/docstrap/themes/cosmo)
|
26 | + [Cyborg](http://docstrap.github.io/docstrap/themes/cyborg)
|
27 | + [Flatly](http://docstrap.github.io/docstrap/themes/flatly)
|
28 | + [Journal](http://docstrap.github.io/docstrap/themes/journal)
|
29 | + [Lumen](http://docstrap.github.io/docstrap/themes/lumen)
|
30 | + [Paper](http://docstrap.github.io/docstrap/themes/paper)
|
31 | + [Readable](http://docstrap.github.io/docstrap/themes/readable)
|
32 | + [Sandstone](http://docstrap.github.io/docstrap/themes/sandstone)
|
33 | + [Simplex](http://docstrap.github.io/docstrap/themes/simplex)
|
34 | + [Slate](http://docstrap.github.io/docstrap/themes/slate)
|
35 | + [Spacelab](http://docstrap.github.io/docstrap/themes/spacelab)
|
36 | + [Superhero](http://docstrap.github.io/docstrap/themes/superhero)
|
37 | + [United](http://docstrap.github.io/docstrap/themes/united)
|
38 | + [Yeti](http://docstrap.github.io/docstrap/themes/yeti)
|
39 |
|
40 | To change your theme, just change it in the `conf.json` file. See below for details.
|
41 |
|
42 | ## Ooooh, I want it! How do I get it? ##
|
43 |
|
44 | If you manage your own version of jsdoc:
|
45 |
|
46 | ```bash
|
47 | npm install ink-docstrap
|
48 | ```
|
49 |
|
50 | When using [grunt](http://gruntjs.com/), please look at [grunt-jsdoc](https://github.com/krampstudio/grunt-jsdoc) which you can use with
|
51 | docstrap.
|
52 |
|
53 | ### Command Line Example ###
|
54 |
|
55 | ```bash
|
56 | jsdoc -c path/to/conf.json -t ./node_modules/ink-docstrap/template -R README.md -r .
|
57 | ```
|
58 |
|
59 | The `-c` sets the config, and the docstrap README does talk about the options you can put in templates that docstrap is supposed to look for.
|
60 |
|
61 | The `-t` sets the template. This is the option you need to set to get the docstrap template to be used.
|
62 |
|
63 | The `-R` sets a markdown file to be the front page of the documentation.
|
64 |
|
65 | The `-r` tells jsdoc to run recursively.
|
66 |
|
67 | The `.` says from current directory.
|
68 |
|
69 | ## Configuring the template ##
|
70 |
|
71 | DocStrap ships with a `conf.json` file in the template/ directory. It is just a regular old
|
72 | [JSDoc configuration file](http://usejsdoc.org/about-configuring-jsdoc.html), but with the following new options:
|
73 |
|
74 | ```javascript
|
75 | "templates": {
|
76 | "systemName" : "{string}",
|
77 | "footer" : "{string}",
|
78 | "copyright" : "{string}",
|
79 | "includeDate" : "{boolean}",
|
80 | "navType" : "{vertical|inline}",
|
81 | "theme" : "{theme}",
|
82 | "linenums" : "{boolean}",
|
83 | "collapseSymbols" : "{boolean}",
|
84 | "inverseNav" : "{boolean}",
|
85 | "outputSourceFiles" : "{boolean}" ,
|
86 | "outputSourcePath" : "{boolean}",
|
87 | "dateFormat" : "{string}",
|
88 | "syntaxTheme" : "{string}",
|
89 | "sort" : "{boolean|string}",
|
90 | "search" : "{boolean}"
|
91 | }
|
92 |
|
93 | ```
|
94 | ### Options ###
|
95 |
|
96 | * __systemName__
|
97 | The name of the system being documented. This will appear in the page title for each page
|
98 | * __footer__
|
99 | Any markup want to appear in the footer of each page. This is not processed at all, just printed exactly as you enter it
|
100 | * __copyright__
|
101 | You can add a copyright message below the footer and above the JSDoc timestamp at the bottom of the page
|
102 | * __includeDate__
|
103 | By default, the current date is always shown in the footer of the generated documentation. You can omit the current date by setting this option to `false`
|
104 | * __navType__
|
105 | The template uses top level navigation with dropdowns for the contents of each category. On large systems these dropdowns
|
106 | can get large enough to expand beyond the page. To make the dropdowns render wider and stack the entries vertically, set this
|
107 | option to `"inline"`. Otherwise set it to `"vertical"` to make them regular stacked dropdowns.
|
108 | * __theme__
|
109 | This is the name of the them you want to use **in all lowercase**. The valid options are
|
110 | + `cerulean`
|
111 | + `cosmo`
|
112 | + `cyborg`
|
113 | + `flatly`
|
114 | + `journal`
|
115 | + `lumen`
|
116 | + `paper`
|
117 | + `readable`
|
118 | + `sandstone`
|
119 | + `simplex`
|
120 | + `slate`
|
121 | + `spacelab`
|
122 | + `superhero`
|
123 | + `united`
|
124 | + `yeti`
|
125 | * __linenums__
|
126 | When true, line numbers will appear in the source code listing. If you have
|
127 | [also turned that on](http://usejsdoc.org/about-configuring-jsdoc.html).
|
128 | * __collapseSymbols__
|
129 | If your pages have a large number of symbols, it can be easy to get lost in all the text. If you turn this to `true`
|
130 | all of the symbols in the page will roll their contents up so that you just get a list of symbols that can be expanded
|
131 | and collapsed.
|
132 | * __analytics__ Add a [Google Analytics](http://www.google.com/analytics) code to the template output
|
133 | _e.g._ `"analytics":{"ua":"UA-XXXXX-XXX", "domain":"XXXX"}`
|
134 | * __ua__ The google agent (see Google Analytics help for details)
|
135 | * __domain__ The domain being served. (see Google Analytics help for details)
|
136 | * __inverseNav__
|
137 | Bootstrap navbars come in two flavors, regular and inverse where inverse is generally higher contrast. Set this to `true` to
|
138 | use the inverse header.
|
139 | * __outputSourceFiles__
|
140 | When true, the system will produce source pretty printed file listings with a link from the documentation.
|
141 | * __outputSourcePath__
|
142 | When `outputSourceFiles` is `false`, you may still want to name the file even without a link to the pretty printed output.
|
143 | Set this to `true` when `outputSourceFiles` is `false`. `outputSourceFiles` when `true` takes precedence over this setting.
|
144 | * __dateFormat__ The date format to use when printing dates. It accepts any format string understood by [moment.js](http://momentjs.com/docs/#/displaying/format/)
|
145 | * __syntaxTheme__ String that determines the theme used for code blocks. Default value is `"default"`. It can be any value supported
|
146 | at [sunlight themes](https://github.com/tmont/sunlight/tree/master/src/themes) which right now consists of...uh...`"default"` and `"dark"`,
|
147 | but at least you have it if you need it.
|
148 | * __sort__ Defaults to true. Specifies whether jsdoc should sort data or use file order. Can also be a string and if so it is passed to jsdoc directly. The default string is `"longname, version, since"`.
|
149 | * __search__ By default, the template includes a quick search box. For large APIs, the search database can be too expensive to load. If needed you can disable this feature setting this option to false.
|
150 |
|
151 | ## Syntax Highlighting ##
|
152 |
|
153 | ### Language ###
|
154 |
|
155 | The default language will be JavaScript, but there are a couple of ways to secify the language.
|
156 |
|
157 | DocStrap support the language specified in the standard way e.g.
|
158 |
|
159 | ```
|
160 | ```html
|
161 | <html></html>
|
162 | ```
|
163 |
|
164 | DocStrap also introduces a new documentation tag which can appear inside any example block in source code,
|
165 | or in any fenced code block in markdown: `{@lang languageName}`, where
|
166 | _`language`_ can be any of the languages supported by [Sunlight](http://sunlightjs.com/)
|
167 |
|
168 | When in a doclet, add the tag just after the `@example` tag like this:
|
169 |
|
170 | `@example {@lang xml}`
|
171 | `<div>This is the most interesting web site ever</div>`
|
172 |
|
173 | These are the supported languages.
|
174 |
|
175 | * ActionScript
|
176 | * bash
|
177 | * C/C++
|
178 | * C♯
|
179 | * CSS
|
180 | * Diff
|
181 | * DOS batch
|
182 | * Erlang
|
183 | * Haskell
|
184 | * httpd (Apache)
|
185 | * Java
|
186 | * JavaScript
|
187 | * Lisp
|
188 | * Lua
|
189 | * MySQL
|
190 | * nginx
|
191 | * Objective-C
|
192 | * Perl
|
193 | * PHP
|
194 | * PowerShell
|
195 | * Python
|
196 | * Ruby
|
197 | * Scala
|
198 | * T-SQL
|
199 | * VB.NET
|
200 | * XML (HTML)
|
201 |
|
202 | ### Example Caption ###
|
203 |
|
204 | If you want a caption to your example, add it in a HTML caption before your example e.g.
|
205 |
|
206 | ```
|
207 | @example <caption>my caption</caption>
|
208 | {@lang xml}
|
209 | <mycode></mycode>
|
210 | ```
|
211 |
|
212 | ## Customizing DocStrap ##
|
213 | No template can meet every need and customizing templates is a favorite pastime of....well, no-one, but you may need to anyway.
|
214 | First make sure you have [bower](https://github.com/bower/bower) and [grunt-cli](https://github.com/gruntjs/grunt-cli) installed.
|
215 | Fetch the source using `git` or grab the [zip file from github.](https://github.com/docstrap/docstrap/archive/master.zip) and unzip
|
216 | it somewhere. Everything that follows happens in the unzip directory.
|
217 |
|
218 | Next, prepare the environment:
|
219 |
|
220 | bower install
|
221 |
|
222 | and
|
223 |
|
224 | npm install
|
225 |
|
226 | When that is done, you have all of the tools to start modifying the template. The template, like Bootstrap, uses [less](http://lesscss.org/).
|
227 | The way it works is that `./styles/main.less` pulls in the bootstrap files uncompiled so that you have access to all of bootstraps mixins, colors,
|
228 | etc, that you would want. There are two more files in that directory, `variables.less`, `bootswatch.less`. These are the
|
229 | theme files and you can modify them, but keep in mind that if you apply a new theme (see below) those files will be overwritten. It is best
|
230 | to keep your changes to the `main.less` file.
|
231 |
|
232 | To compile your changes to `main.less` and any other files it loads up,
|
233 |
|
234 | grunt less
|
235 |
|
236 | The output is will be put in `./template/static/styles/site.<theme-name>.css`. The next time you create your documentation, it
|
237 | will have the new css file included.
|
238 |
|
239 | To apply a different template to the `styles` directory to modify, open up the `conf.json` in the template directory and
|
240 | change the `theme` option to the theme you want. Then
|
241 |
|
242 | grunt apply
|
243 |
|
244 | And the new theme will be in `variables.less`, `bootswatch.less`. Don't forget to compile your changes using `grunt apply` to
|
245 | get that change into the template.
|
246 |
|
247 | **NOTE** that these steps are not necessary to just change the theme, this is only to modify the theme. If all you want to do is
|
248 | change the theme, just update conf.json with the new theme and build your docs!
|
249 |
|
250 | ## Contributing ##
|
251 | Yes! Contribute! Test! Share your ideas! Report Bugs!
|
252 |
|
253 | ### Contributers ###
|
254 |
|
255 | *Huge* thanks to all contributors. If your name should be here, but isn't, please let us know
|
256 |
|
257 | * [marklagendijk](https://github.com/marklagendijk)
|
258 | * [michaelward82](https://github.com/michaelward82)
|
259 | * [kaustavdm](https://github.com/kaustavdm)
|
260 | * [vmeurisse](https://github.com/vmeurisse)
|
261 | * [bmathern](https://github.com/bmathern)
|
262 | * [jrkim123us](https://github.com/jrkim123us)
|
263 | * [shawke](https://github.com/shawke)
|
264 | * [mar10](https://github.com/mar10)
|
265 | * [mwcz](https://github.com/mwcz)
|
266 | * [pocesar](https://github.com/pocesar)
|
267 | * [hyperandroid](https://github.com/hyperandroid)
|
268 | * [vmadman](https://github.com/vmadman)
|
269 | * [whitelynx](https://github.com/whitelynx)
|
270 | * [tswaters](https://github.com/tswaters)
|
271 | * [lukeapage](https://github.com/lukeapage)
|
272 | * [rcosnita](https://github.com/rcosnita)
|
273 |
|
274 |
|
275 | ## History ##
|
276 |
|
277 | ## 1.3.0 ##
|
278 |
|
279 | * Update dependencies and update CSS
|
280 | * Fixed TOC labels for members
|
281 | * Apply code highlighting to code blocks in markdown
|
282 | * Added an option to disable search
|
283 |
|
284 | ## 1.2.1 ##
|
285 |
|
286 | * Update lunr dependency used for searching
|
287 |
|
288 | ## 1.2.0 ##
|
289 |
|
290 | * Add square brackets around optional parameters
|
291 | * new option disablePackagePath option which if true makes docstrap not append the package and version to the out path
|
292 | * allow version to be missing in package.json
|
293 |
|
294 | ## 1.1.4 ##
|
295 |
|
296 | * Remove the unreadable orange on pre/code tags and use a dark red. Remove white background as is readable on black or white.
|
297 |
|
298 | ## 1.1.3 ##
|
299 |
|
300 | * Get sort option from navOptions as per docs
|
301 | * tweaks from bootswatch
|
302 |
|
303 | ## 1.1.2 ##
|
304 |
|
305 | * Allow example captions to contain markdown if configured in the markdown config `includeTags` section.
|
306 | * Fixes full path used as source URL for projects with one source file
|
307 | * Allow users to update the default template layout file
|
308 |
|
309 | ## 1.1.1 ##
|
310 |
|
311 | * Bootswatch update
|
312 | * Add viewport meta tag to html for better mobile experience
|
313 |
|
314 | ## 1.1.0 ##
|
315 |
|
316 | * Added includeDate option
|
317 |
|
318 | ## 1.0.5 ##
|
319 |
|
320 | * Navigation to anchor links now works in IE (with some flicker)
|
321 | * links to other pages now work (with some flicker in some browsers)
|
322 |
|
323 | ## 1.0.4 ##
|
324 |
|
325 | * Search results no longer erroneously included in side navbar
|
326 | * Tutorials now get page titles consistent with everything else
|
327 | * Improvements to the highlighted nav heading
|
328 |
|
329 | ## 1.0.3 ##
|
330 |
|
331 | * Drop-down shows a scrollbar when too big (regression in 1.0.1)
|
332 |
|
333 | ## 1.0.2 ##
|
334 |
|
335 | * Support older jsdoc by not looking in "interfaces"
|
336 |
|
337 | ## 1.0.1 ##
|
338 |
|
339 | * Tweak side nav and dropdowns to be the bootswatch style
|
340 | * Make the documentation responsive
|
341 |
|
342 | ## 1.0.0 ##
|
343 |
|
344 | * Bump to follow semver (initial development is well and truly over)
|
345 | * Corrected list of themes
|
346 | * Added Search
|
347 | * Remove highlightTutorialCode option - it didnt work
|
348 |
|
349 | ## 0.5.4 ##
|
350 |
|
351 | * Fix layout glitch on hte bottom of code samples
|
352 | * Support for specifying the language for fenced code blocks in the normal way
|
353 | * Fix the active item in some themes, which was missing a background
|
354 | * Tables get marked as tables
|
355 | * Dependency updates
|
356 |
|
357 | ## 0.5.3 ##
|
358 |
|
359 | * Removed duplicate headers
|
360 | * Remove "Index" header
|
361 | * re-fixed navigation
|
362 | * removed some dubious features (now pr's that can be re-added with a little polishing)
|
363 |
|
364 | ## 0.5.2 ##
|
365 | Major update__. Amazing help from [tswaters](https://github.com/tswaters) to solve a bunch of little problems and a to bring the codebase up to Bootstrap3.
|
366 | Make sure you are running the latest version of JSDoc before using this build.
|
367 |
|
368 | Again huge, huge thanks to [tswaters](https://github.com/tswaters). Make sure you send him thanks or a tip!!!!!
|
369 |
|
370 | ### v0.4.15 ###
|
371 | * PR Issue #76
|
372 | * PR Issue #77
|
373 |
|
374 | ### v0.4.14 ###
|
375 | * Issue #69
|
376 |
|
377 | ### v0.4.13 ###
|
378 | * Issue #68
|
379 |
|
380 | ### v0.4.11 ###
|
381 | * Pull Request #59
|
382 |
|
383 | ### v0.4.8 ###
|
384 | * Issue #58
|
385 |
|
386 | ### v0.4.7 ###
|
387 | * Issue #57
|
388 |
|
389 | ### v0.4.5 ###
|
390 | * Issue #55
|
391 | * Issue #54
|
392 | * Issue #52
|
393 | * Issue #51
|
394 | * Issue #50
|
395 | * Issue #45
|
396 | * Issue #44
|
397 |
|
398 | ### v0.4.3 ###
|
399 | * Issue #46
|
400 | * Issue #46
|
401 | * Issue #47
|
402 |
|
403 | ### v0.4.1-1###
|
404 | * Issue #44
|
405 | * Update documentation
|
406 | * Issue #43
|
407 | * Issue #42
|
408 | * Issue #34
|
409 |
|
410 | ### v0.4.0 ###
|
411 | * Issue #41
|
412 | * Issue #40
|
413 | * Issue #39
|
414 | * Issue #36
|
415 | * Issue #32
|
416 |
|
417 | ### v0.3.0 ###
|
418 | * Fixed navigation at page top
|
419 | * Adds -d switch to example jsdoc command.
|
420 | * Fixed typo in readme
|
421 | * Improve search box positioning and styles
|
422 | * Add dynamic quick search in TOC
|
423 | * Fix for line numbers styling issue
|
424 |
|
425 | ### v0.2.0 ###
|
426 |
|
427 | * Added jump to source linenumers - still a problem scrolling with fixed header
|
428 | * changed syntax highlighter to [sunlight](http://sunlightjs.com/)
|
429 | * Modify incoming bootswatch files to make font calls without protocol.
|
430 |
|
431 | ### v0.1.0 ###
|
432 | Initial release
|
433 |
|
434 |
|
435 | ## Notices ##
|
436 | If you like DocStrap, be sure and check out these excellent projects and support them!
|
437 |
|
438 | [JSDoc3 is licensed under the Apache License](https://github.com/jsdoc3/jsdoc/blob/master/LICENSE.md)
|
439 |
|
440 | [So is Bootstrap](https://github.com/twitter/bootstrap/blob/master/LICENSE)
|
441 |
|
442 | [And Bootswatch](https://github.com/thomaspark/bootswatch/blob/gh-pages/LICENSE)
|
443 |
|
444 | [TOC is licensed under MIT](https://github.com/jgallen23/toc/blob/master/LICENSE)
|
445 |
|
446 | [Grunt is also MIT](https://github.com/gruntjs/grunt-cli/blob/master/LICENSE-MIT)
|
447 |
|
448 | DocStrap [is licensed under the MIT license.](https://github.com/docstrap/docstrap/blob/master/LICENSE.md)
|
449 |
|
450 | [Sunlight uses the WTFPL](http://sunlightjs.com/)
|
451 |
|
452 | ## License ##
|
453 | DocStrap Copyright (c) 2012-2015 Terry Weiss & Contributors. All rights reserved.
|
454 |
|
455 | Permission is hereby granted, free of charge, to any person
|
456 | obtaining a copy of this software and associated documentation
|
457 | files (the "Software"), to deal in the Software without
|
458 | restriction, including without limitation the rights to use,
|
459 | copy, modify, merge, publish, distribute, sublicense, and/or sell
|
460 | copies of the Software, and to permit persons to whom the
|
461 | Software is furnished to do so, subject to the following
|
462 | conditions:
|
463 |
|
464 | The above copyright notice and this permission notice shall be
|
465 | included in all copies or substantial portions of the Software.
|
466 |
|
467 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
468 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
469 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
470 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
471 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
472 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
473 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
474 | OTHER DEALINGS IN THE SOFTWARE.
|