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 --outputSshhh…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 = ;const render = ;const output = ; const myTemplate = `\n`;const myDoxData = isPrivate: true isPrivate: false isPrivate: false; myDoxDataoutput;//» "Sshhh…\nBoom!\nBoom!\n"
The template function
Work in progress…