3 <title>npm-docs</title>
4 <meta http-equiv="content-type" value="text/html;utf-8">
5 <link rel="stylesheet" type="text/css" href="../../static/style.css">
9 <h1><a href="../api/npm-docs.html">npm-docs</a></h1> <p>Docs for a package in a web browser maybe</p>
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
13 <pre><code>npm.commands.docs(package, callback)</code></pre>
15 <h2 id="DESCRIPTION">DESCRIPTION</h2>
17 <p>This command tries to guess at the likely location of a package's
18 documentation URL, and then tries to open it using the <code>--browser</code>
21 <p>Like other commands, the first parameter is an array. This command only
22 uses the first element, which is expected to be a package name with an
23 optional version number.</p>
25 <p>This command will launch a browser, so this command may not be the most
26 friendly for programmatic use.</p>
28 <p id="footer">npm-docs — npm@1.3.21</p>
31 var wrapper = document.getElementById("wrapper")
32 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
33 .filter(function (el) {
34 return el.parentNode === wrapper
35 && el.tagName.match(/H[1-6]/)
39 , toc = document.createElement("ul")
40 toc.innerHTML = els.map(function (el) {
41 var i = el.tagName.charAt(1)
51 out += "<li><a href='#" + el.id + "'>" +
52 ( el.innerText || el.text || el.innerHTML)
57 document.body.appendChild(toc)