# docprint

> Generates documentation from api-blueprint files

Latest version **1.9.0** (published 2017-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install docprint
pnpm add docprint
yarn add docprint
bun add docprint
```

Provides the command `docprint`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.0 |
| Published | 2017-03-23 |
| First published | 2016-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Known vulnerabilities | 0 (+10 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 57 |
| Author | swathysubhash@gmail.com |
| Maintainers | swathysubhash |

## Links

- npm: https://www.npmjs.com/package/docprint
- Repository: https://github.com/swathysubhash/docprint
- Homepage: https://github.com/swathysubhash/docprint#readme
- Issues: https://github.com/swathysubhash/docprint/issues
- npm.io page: https://npm.io/package/docprint

## Dependencies (11)

- [pug](https://npm.io/package/pug.md) ^2.0.0-beta4
- [mkdirp](https://npm.io/package/mkdirp.md) 0.5.1
- [cheerio](https://npm.io/package/cheerio.md) 0.22.0
- [drafter](https://npm.io/package/drafter.md) 1.1.0
- [hercule](https://npm.io/package/hercule.md) ^3.0.5
- [commander](https://npm.io/package/commander.md) 2.9.0
- [httpsnippet](https://npm.io/package/httpsnippet.md) 1.16.5
- [markdown-it](https://npm.io/package/markdown-it.md) 8.0.0
- [highlight.js](https://npm.io/package/highlight.js.md) 9.7.0
- [markdown-it-anchor](https://npm.io/package/markdown-it-anchor.md) 2.5.0
- [markdown-it-highlightjs](https://npm.io/package/markdown-it-highlightjs.md) 2.0.0

## Recent versions

- 1.9.0 (latest) — 2017-03-23
- 1.8.0 — 2017-02-01
- 1.7.0 — 2017-01-12
- 1.6.0 — 2016-10-28
- 1.5.0 — 2016-10-18
- 1.4.0 — 2016-10-17
- 1.3.0 — 2016-10-17
- 1.2.0 — 2016-10-17
- 1.1.0 — 2016-10-14
- 1.0.0 — 2016-10-14

## README

# docprint

# Introduction
Renders [API Blueprint](http://apiblueprint.org/) files to static HTML files. API Blueprint is a Markdown-based documentation format which can be used for writing API documentations.

## Features

* Attributes of resources rendered separately
* Nested Attributes
* Can add custom header and custom css file
* Supports code snippets of six different languages
* Waypoint support
* Markdown support
* Clean UI

## Example

Example can be seen in the build folder. Output for [Polls](https://raw.githubusercontent.com/swathysubhash/docprint/master/build/apib/polls.apib) api blueprint file is rendered [here](http://htmlpreview.github.io/?https://raw.githubusercontent.com/swathysubhash/docprint/blob/master/build/docs/curl/index.html).

# Installation & Usage
We can use docprint as an executable as well as node js library. 
Seven documentation files will be created in different folders for different languages. 

## Executable
Install docprint via NPM. You need nodejs for install.

```bash
npm install -g docprint
```

```bash
docprint -p './build/apib/polls.apib' -d './build/docs' -h './build/files/header.html' -c './build/files/custom.css'
```

## Node js Library
You can also use docprint as a library. First, install and save it as a dependency:

```bash
npm install --save docprint
```

Then, convert some API Blueprint to HTML:

```javascript
var docprint = require('docprint');

var filepath = './build/apib/polls.apib';
var destination = './build/docs';
var header = './build/files/header.html';
var css = './build/files/custom.css';

docprint({
	filepath: filepath,
	destination: destination,
	header: header,
	css: css
})
```

# File inclusions
Files can be included in to index file using this format. For more info see [hercule](https://github.com/jamesramsay/hercule/tree/master/examples/api-blueprint)

```
:[name](path)
```

For Eg:

```
:[Overview](blueprint/overview.md)
:[Search](blueprint/search.apib)
:[Products](blueprint/products.json)
```



# Language selection
During language selection in the documentation, it will replace the 'language keyword' from url with the new language selected. You should mount the static files in the application in a similar way so that changing url should work for different languages.

For eg: http://api.xyz.com/docs/curl/index.html  --- for curl
while selecting php, url will change to
http://api.xyz.com/docs/php/index.html  --- by replacing curl with php


### Reference

#### docprint (options)
Renders the documentation. Options object can contain : 

| Option      | Type   | Description                            |
| ----------- | ------ | -------------------------------------- |
| filepath    | string | location of api blueprint file         |
| destination | string | destination of documentation generated |
| header      | string | location of file containing html header|
| css         | string | location of file containing custom css |
| headerhtml  | string | header html string - (optional)        |

---
_Source: https://npm.io/package/docprint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
