npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

doxie.inject

v0.1.1

Published

Inject rendered comments into your readme.

Downloads

10

Readme

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

A plugin for doxie.
Join rendered docs and inject them into your readme.

Installation

doxie --inject is a plugin for the command-line tool doxie. dox produces compatible data from jsDoc comments. Install all three if you haven’t already:

$ npm install --global dox doxie doxie.inject

Usage

  1. Write a readme

…or some other document in Markdown or HTML. Put the markers <!-- @doxie.inject start --> and <!-- @doxie.inject end --> somewhere in it.

  1. Profit!

Render your docs with doxie – here we use doxie --render for that. Then --inject them into your readme.

$ dox | doxie --render --inject

We’ll join your docs into one string and replace all content between the markers with that string.

  1. Options!

You can set things up with options:

--inject( <option> <argument>)*

For example:

$ doxie --render \
$   --inject into 'My docs.md' as public

Read on!

Options

 

Apart from the default markers you can have named markers. This way you can inject different docs at different places.

Put them in your readme: <!-- @doxie.inject start my-marker --> and <!-- @doxie.inject end my-marker -->.

Then inject your docs:

$ doxie --inject as my-marker

 

By default we’ll inject your docs into README.md, Readme.md, or readme.md in the current working directory. But if you want another target, no problem:

$ doxie --inject into ./documentation/my-docs.html

 

Programmatic usage

You can use doxie.inject directly with doxie-core. Install both if you haven’t already:

$ npm install doxie-core doxie.inject

Use it like this:

 

Parameters (properties of an object):

  • input
    type: String (or cast to String) | required
    The content of a readme – or another Markdown / HTML document.

  • as
    type: String or null (or cast to String) | optional | default: null
    Same as --inject as <marker name>.

Returned value:

 

Returned properties:

  • ['doxie.inject'].output
    type: String
    The resulting content of the readme – with your docs injected.


  • Other properties required by doxie-core.

Example:

const doxie = require('doxie-core');
const render = require('doxie.render');
const inject = require('doxie.inject');

doxie([
  render(require('./.doxie.render.js')),
  inject({
    input:
`#  My readme  #

##  Usage  ##
<!-- @doxie.input start usage -->
(this will be replaced)
<!-- @doxie.input end usage -->

##  License: MIT  ##
`,
    as: 'usage',
  }),
])([/* my docs’ data */]);
//» {
//    'doxie.inject': {output: "
//      #  My readme  #
//      
//      ##  Usage  ##
//      <!-- @doxie.input start usage -->
//      
//      ###  myFancyFunction(a, b, c)  ###
//      
//      Parameters:
//      
//      * a
//      * b
//      * c
//      
//      Return value:
//      
//      * d
//      <!-- @doxie.input end usage -->
//      
//      ##  License: MIT  ##
//    "},
//    …
//  }

 

License

MIT © Studio B12 GmbH