Git Product home page Git Product logo

docprint's Introduction

docprint

Introduction

Renders API Blueprint 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 api blueprint file is rendered here.

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.

npm install -g docprint
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:

npm install --save docprint

Then, convert some API Blueprint to HTML:

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

:[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)

docprint's People

Contributors

swathysubhash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docprint's Issues

HTML 4.0 Entities are being processed

When running the doc generation, HTML 4.0 entities are being processed in a few place.

In my case, I discovered this with &notice is being converted to ¬ice and rendering a not symbol.

This only applies to the URL method, not the same code that is generated.

See screenshot -

screen shot 2018-01-15 at 8 53 02 am

Code where query param is specified -

screen shot 2018-01-15 at 8 55 39 am

Request body into Example requests

Hi!

Maybe I am missing something, but it makes sense to include an example request body into generated Example requests, as otherwise there is no any use of POST example requests.

Is it currently supported somehow?

Nick

TypeError: Cannot read property 'find' of undefined

When I try to run the command line tool I always get this error:

$ docprint -p index.md -d docs
TypeError: Cannot read property 'find' of undefined
    at setHost (/usr/local/lib/node_modules/docprint/src/index.js:76:22)
    at module.exports (/usr/local/lib/node_modules/docprint/src/index.js:43:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/docprint/bin/index.js:15:18)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7) 'TypeError: Cannot read property \'find\' of undefined\n    at setHost (/usr/local/lib/node_modules/docprint/src/index.js:76:22)\n    at module.exports (/usr/local/lib/node_modules/docprint/src/index.js:43:5)\n    at Object.<anonymous> (/usr/local/lib/node_modules/docprint/bin/index.js:15:18)\n    at Module._compile (module.js:571:32)\n    at Object.Module._extensions..js (module.js:580:10)\n    at Module.load (module.js:488:32)\n    at tryModuleLoad (module.js:447:12)\n    at Function.Module._load (module.js:439:3)\n    at Module.runMain (module.js:605:10)\n    at run (bootstrap_node.js:425:7)'

For any input file. My node version is 7.7.3.

Data Structures

Hi,

This library is exactly what I'm looking for, but unfortunately it isn't working very well with data structures.

If I use, for example, the Data Structures example from apiblueprint, it doesn't work. Ignoring the missing HOST problem, which is easily fixed by adding HOST: in after FORMAT:, it fails to load the datastructure because the element has no content. Here is the output I found adding a console.log(result) at parse.js:23:

Result object parsing: { element: 'dataStructure', content: [ { element: 'Coupon' } ] }

Because the meta is empty, it fails and crashes.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.