Downloads in past


746671.3.26 years ago11 years agoMinified + gzip package size for ink-docstrap in KB


Dependency Status devDependency Status
DocStrap Built with Grunt
DocStrap is Bootstrap based template for JSDoc3. In addition, it includes all of the themes from Bootswatch giving you a great deal of look and feel options for your documentation, along with a simple search. Additionally, it adds some options to the conf.json file that gives you even more flexibility to tweak the template to your needs. It will also make your teeth whiter.

Features ##

  • Right side TOC for navigation in pages
  • Integrated offline search
  • Themed
  • Customizable
  • Syntax highlighting

What It Looks Like ###

Here are examples of this template with the different Bootswatch themes:

To change your theme, just change it in the conf.json file. See below for details.

Ooooh, I want it! How do I get it? ##

If you manage your own version of jsdoc:
npm install ink-docstrap

When using grunt, please look at grunt-jsdoc which you can use with docstrap.

Command Line Example ###

jsdoc -c path/to/conf.json -t ./node_modules/ink-docstrap/template -R -r .

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.
The -t sets the template. This is the option you need to set to get the docstrap template to be used.
The -R sets a markdown file to be the front page of the documentation.
The -r tells jsdoc to run recursively.
The . says from current directory.

Configuring the template ##

DocStrap ships with a conf.json file in the template/ directory. It is just a regular old JSDoc configuration file, but with the following new options:
"templates": {
	"systemName"            : "{string}",
	"footer"                : "{string}",
	"copyright"             :  "{string}",
	"includeDate"           : "{boolean}",
	"navType"               : "{vertical|inline}",
	"theme"                 : "{theme}",
	"linenums"              : "{boolean}",
	"collapseSymbols"       : "{boolean}",
	"inverseNav"            : "{boolean}",
	"outputSourceFiles"     : "{boolean}" ,
	"outputSourcePath"      : "{boolean}",
	"dateFormat"            : "{string}",
	"syntaxTheme"           : "{string}",
	"sort"					: "{boolean|string}",
	"search"                : "{boolean}" 

Options ###

  • systemName
The name of the system being documented. This will appear in the page title for each page
  • footer
Any markup want to appear in the footer of each page. This is not processed at all, just printed exactly as you enter it
  • copyright
You can add a copyright message below the footer and above the JSDoc timestamp at the bottom of the page
  • includeDate
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`
  • navType
The template uses top level navigation with dropdowns for the contents of each category. On large systems these dropdowns
can get large enough to expand beyond the page. To make the dropdowns render wider and stack the entries vertically, set this
option to `"inline"`. Otherwise set it to `"vertical"` to make them regular stacked dropdowns.
  • theme
This is the name of the them you want to use **in all lowercase**. The valid options are
+ `cerulean`
+ `cosmo`
+ `cyborg`
+ `flatly`
+ `journal`
+ `lumen`
+ `paper`
+ `readable`
+ `sandstone`
+ `simplex`
+ `slate`
+ `spacelab`
+ `superhero`
+ `united`
+ `yeti`
  • linenums
When true, line numbers will appear in the source code listing. If you have
[also turned that on](
  • collapseSymbols
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`
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
and collapsed.
e.g. "analytics":{"ua":"UA-XXXXX-XXX", "domain":"XXXX"}
* __ua__ The google agent (see Google Analytics help for details)
* __domain__ The domain being served. (see Google Analytics help for details)
  • inverseNav
Bootstrap navbars come in two flavors, regular and inverse where inverse is generally higher contrast. Set this to `true` to
use the inverse header.
  • outputSourceFiles
When true, the system will produce source pretty printed file listings with a link from the documentation.
  • outputSourcePath
When `outputSourceFiles` is `false`, you may still want to name the file even without a link to the pretty printed output.
Set  this to `true` when `outputSourceFiles` is `false`. `outputSourceFiles` when `true` takes precedence over this setting.
  • dateFormat The date format to use when printing dates. It accepts any format string understood by moment.js
  • syntaxTheme String that determines the theme used for code blocks. Default value is "default". It can be any value supported
at [sunlight themes]( which right now consists of...uh...`"default"` and `"dark"`,
but at least you have it if you need it.
  • 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".
  • 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.

Syntax Highlighting ##

Language ###

The default language will be JavaScript, but there are a couple of ways to secify the language.
DocStrap support the language specified in the standard way e.g.

DocStrap also introduces a new documentation tag which can appear inside any example block in source code, or in any fenced code block in markdown: {@lang languageName}, where language can be any of the languages supported by Sunlight
When in a doclet, add the tag just after the @example tag like this:
@example {@lang xml} <div>This is the most interesting web site ever</div>
These are the supported languages.
  • ActionScript
  • bash
  • C/C++
  • C♯
  • CSS
  • Diff
  • DOS batch
  • Erlang
  • Haskell
  • httpd (Apache)
  • Java
  • JavaScript
  • Lisp
  • Lua
  • MySQL
  • nginx
  • Objective-C
  • Perl
  • PHP
  • PowerShell
  • Python
  • Ruby
  • Scala
  • T-SQL
  • VB.NET
  • XML (HTML)

Example Caption ###

If you want a caption to your example, add it in a HTML caption before your example e.g.
@example <caption>my caption</caption>
{@lang xml}

Customizing DocStrap ##

No template can meet every need and customizing templates is a favorite pastime of....well, no-one, but you may need to anyway. First make sure you have bower and grunt-cli installed. Fetch the source using git or grab the zip file from github. and unzip it somewhere. Everything that follows happens in the unzip directory.
Next, prepare the environment:
bower install
npm install
When that is done, you have all of the tools to start modifying the template. The template, like Bootstrap, uses less. 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, etc, that you would want. There are two more files in that directory, variables.less, bootswatch.less. These are the 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 to keep your changes to the main.less file.
To compile your changes to main.less and any other files it loads up,
grunt less
The output is will be put in ./template/static/styles/site.<theme-name>.css. The next time you create your documentation, it will have the new css file included.
To apply a different template to the styles directory to modify, open up the conf.json in the template directory and change the theme option to the theme you want. Then
grunt apply
And the new theme will be in variables.less, bootswatch.less. Don't forget to compile your changes using grunt apply to get that change into the template.
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 change the theme, just update conf.json with the new theme and build your docs!

Contributing ##

Yes! Contribute! Test! Share your ideas! Report Bugs!

Contributers ###

Huge thanks to all contributors. If your name should be here, but isn't, please let us know

History ##

1.3.0 ##

Update dependencies and update CSS Fixed TOC labels for members Apply code highlighting to code blocks in markdown Added an option to disable search

1.2.1 ##

Update lunr dependency used for searching

1.2.0 ##

Add square brackets around optional parameters new option disablePackagePath option which if true makes docstrap not append the package and version to the out path allow version to be missing in package.json

1.1.4 ##

Remove the unreadable orange on pre/code tags and use a dark red. Remove white background as is readable on black or white.

1.1.3 ##

Get sort option from navOptions as per docs tweaks from bootswatch

1.1.2 ##

Allow example captions to contain markdown if configured in the markdown config includeTags section. Fixes full path used as source URL for projects with one source file Allow users to update the default template layout file

1.1.1 ##

Bootswatch update Add viewport meta tag to html for better mobile experience

1.1.0 ##

Added includeDate option

1.0.5 ##

Navigation to anchor links now works in IE (with some flicker) links to other pages now work (with some flicker in some browsers)

1.0.4 ##

Search results no longer erroneously included in side navbar Tutorials now get page titles consistent with everything else Improvements to the highlighted nav heading

1.0.3 ##

Drop-down shows a scrollbar when too big (regression in 1.0.1)

1.0.2 ##

Support older jsdoc by not looking in "interfaces"

1.0.1 ##

Tweak side nav and dropdowns to be the bootswatch style Make the documentation responsive

1.0.0 ##

Bump to follow semver (initial development is well and truly over) Corrected list of themes Added Search Remove highlightTutorialCode option - it didnt work

0.5.4 ##

Fix layout glitch on hte bottom of code samples Support for specifying the language for fenced code blocks in the normal way Fix the active item in some themes, which was missing a background Tables get marked as tables Dependency updates

0.5.3 ##

Removed duplicate headers Remove "Index" header re-fixed navigation removed some dubious features (now pr's that can be re-added with a little polishing)

0.5.2 ##

Major update. Amazing help from tswaters
to solve a bunch of little problems and a to bring the codebase up to Bootstrap3. Make sure you are running the latest version of JSDoc before using this build.
Again huge, huge thanks to tswaters. Make sure you send him thanks or a tip!!!!!

v0.4.15 ###

  • PR Issue #76
  • PR Issue #77

v0.4.14 ###

  • Issue #69

v0.4.13 ###

  • Issue #68

v0.4.11 ###

  • Pull Request #59

v0.4.8 ###

  • Issue #58

v0.4.7 ###

  • Issue #57

v0.4.5 ###

  • Issue #55
  • Issue #54
  • Issue #52
  • Issue #51
  • Issue #50
  • Issue #45
  • Issue #44

v0.4.3 ###

  • Issue #46
  • Issue #46
  • Issue #47


  • Issue #44
  • Update documentation
  • Issue #43
  • Issue #42
  • Issue #34

v0.4.0 ###

  • Issue #41
  • Issue #40
  • Issue #39
  • Issue #36
  • Issue #32

v0.3.0 ###

  • Fixed navigation at page top
  • Adds -d switch to example jsdoc command.
  • Fixed typo in readme
  • Improve search box positioning and styles
  • Add dynamic quick search in TOC
  • Fix for line numbers styling issue

v0.2.0 ###

  • Added jump to source linenumers - still a problem scrolling with fixed header
  • changed syntax highlighter to sunlight
  • Modify incoming bootswatch files to make font calls without protocol.

v0.1.0 ###

Initial release

Notices ##

If you like DocStrap, be sure and check out these excellent projects and support them!
JSDoc3 is licensed under the Apache License
So is Bootstrap
And Bootswatch
TOC is licensed under MIT
Grunt is also MIT
DocStrap is licensed under the MIT license.
Sunlight uses the WTFPL

License ##

DocStrap Copyright (c) 2012-2015 Terry Weiss & Contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.