doxie.render

0.3.2 • Public • Published

Coveralls – test coverage Travis – build status David – status of dependencies Stability: unstable Code style: airbnb

doxie --render

A plugin for doxie.
Render a comment to markdown, HTML, or any other format.





Note: Don’t panic. doxie --render is a flexible, low-level plugin. We’re working on higher-level plugins which you can drop into your project without fiddling with configuration.

CLI Usage

doxie --render is a plugin for the command-line tool doxie. Most plugins are designed for dox data. Install all three if you haven’t already:

$ npm install --global dox doxie doxie.render

Create the module .doxie.render.js in your project directory. Export a template function from it. Then pass the option --render to doxie to put it in the plugin pipeline.

I’m including --output to print the results of doxie --render.

echo '
module.exports = function (comment) {
  return comment.data.isPrivate ? "Sshhh…\n" : "Boom!\n"
};' > .doxie.render.js
 
$ dox < my.js | doxie --render --output
Sshhh…
Boom!
Boom!

If you want to put the template function in another file, no problem:

$ doxie   --render build/my-template-function.js   --output

Programmatic usage

doxie.render can be used directly with doxie-core – the backend of doxie. Install both if you haven’t already:

$ npm install doxie-core doxie.render

Pass the template function to doxie.render to configure the plugin:

const doxie = require('doxie-core');
const render = require('doxie.render');
const output = require('doxie.output');
 
const myTemplate = ({data}) => `${data.isPrivate ? 'Sshhh…' : 'Boom!'}\n`;
const myDoxData = [{isPrivate: true}, {isPrivate: false}, {isPrivate: false}];
 
doxie([
  render(myTemplate),
  output(),
])(myDoxData).output;
//» "Sshhh…\nBoom!\nBoom!\n"

The template function

Work in progress…

License

MIT © Studio B12 GmbH

Readme

Keywords

Package Sidebar

Install

npm i doxie.render

Weekly Downloads

4

Version

0.3.2

License

MIT

Last publish

Collaborators

  • tomekwi