{"_id":"toq","_rev":"29-a7dd7f4fa81f0cf91dc3c2e003f1692b","name":"toq","description":"Generate table of contents from html headings.","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"name":"toq","version":"0.0.1","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/reimund/toq.git"},"keywords":["toq","table","of","contents","toc","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"_id":"toq@0.0.1","dist":{"shasum":"86963b21feef2afb62304c8b4d42f9dc4cb19b76","tarball":"https://registry.npmjs.org/toq/-/toq-0.0.1.tgz","integrity":"sha512-WVkmtgv+XOZ27YMi2gnOCs4wM7ezuE+0dNOkbKTTJtfAidGwN9r+hk+XShbw/Pzz1WcmJv5ATTtYUFu1BvuS/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDh5AlYohRnKdPSakn6uCRhJny1kZdka4l+B0kxqdvMBwIhAIFSkfWpRSK/uvMAR7PkpgKCbMfRrA/KuDyXdMmF/JVz"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{}},"0.2.4":{"name":"toq","version":"0.2.4","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq","_id":"toq@0.2.4","dist":{"shasum":"247aac849c8b995eac66c1b6a03f881425f021d4","tarball":"https://registry.npmjs.org/toq/-/toq-0.2.4.tgz","integrity":"sha512-Y9BfD4rD525ri99fuuzRphPYgpin6BLRMwz56YR40G9C52Q3Ll9FvRWtS1GXymsaN8j7kqlsKFqMFvoTpFKU1w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBV5IXWZ3m9YP6Pgxpsn/89LA/OW+fR5J6B9ey5QJAZxAiEA9Qvi+QjfJ15XBMF48JnH7QHAbfg/VNiwWVePW6p1908="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{}},"0.3.1":{"name":"toq","version":"0.3.1","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq","_id":"toq@0.3.1","dist":{"shasum":"a4bb5fa77baadb339d64edebf04557ca0cc8d883","tarball":"https://registry.npmjs.org/toq/-/toq-0.3.1.tgz","integrity":"sha512-W0Wa1xmiWTMzCbOVYowj/5hcpWMhCHkzctsJlHuwwo3ZjtNLrzHeb4O/lPCZzZwyyheuhvAo1NlxUfxxWfv4Fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC90QCq3NxRJUDg0/SeUw0XZLcki95EBu5MWQF+3mGEMAIgIOcQE+f6GSYp2U5M6AAfvv4SKtJrMRJvWDvKOAspvH4="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{}},"0.3.2":{"name":"toq","version":"0.3.2","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq","_id":"toq@0.3.2","dist":{"shasum":"f8ab020b331dab5f6a5448019e784555e9d32b26","tarball":"https://registry.npmjs.org/toq/-/toq-0.3.2.tgz","integrity":"sha512-c94aIzL2VDdAEYQaaROGcvROgsxm5adi+4sclXXZZWmZh1jg/u8gsNukWG0BMjCJRbKHVLWne0NWYCcC355Pyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNbwPPv37Wq8eUduP8tsxBAv+ZUzT/SSk+ojW6+jXuyQIgKV1b+ZJY8ADGhdBxqB++CIHQjJ7vKXOb34B97OkfrDU="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{}},"0.3.3":{"name":"toq","version":"0.3.3","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq","_id":"toq@0.3.3","dist":{"shasum":"061d076c144f48abc542dc36a6eff5c2713630ad","tarball":"https://registry.npmjs.org/toq/-/toq-0.3.3.tgz","integrity":"sha512-rDqQYWSKVNwNLirqIjw4nEKKCePtbmjD575LWMHonswSu3nnVaHNPpffU10IauzADL58zUN2KDtq5tE/CQ4pAA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4i5pVZL/NuKq+N+AO2WwZkQ15Z31adqVbAv7SQDr+VAIgOl7rhdSqPoulqGCL5LgyhJVI7ZYxmdS23ov38lizxhA="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{}},"1.0.0":{"name":"toq","version":"1.0.0","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","lodash":"^4.17.11","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq#readme","_id":"toq@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"reimund","email":"reimund@code7.se"},"dist":{"integrity":"sha512-ksAYJUdAzRCQsBKd4VdbX9w31Ox4ZOGPTVVkpudHr5bQESOzG0uHQ2qYYeq4QZ9WYPElQCDWUcBkuCV7V0qUbA==","shasum":"311eececae90988fd291bb1987e3b9c4b0c75c86","tarball":"https://registry.npmjs.org/toq/-/toq-1.0.0.tgz","fileCount":3,"unpackedSize":7247,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc08oQCRA9TVsSAnZWagAAXfQQAJPTbPtPxGKX+DLkeZUl\nnEF6Qkv4HLyuSt7HBeJfUGEZHJpqeasbaMmCNLXEhZHVwkem6TLG/akR/3+7\nUMUXTeqbnE4QniX9IK2kXwnhumCgnNrfNFh8+sl+PN3lyb7k3+7BwfyZDbGv\n7iTeWmoiQDYNhmJV/b9OYucRQ++fKisXZYnjjlM45WOpohQ9sbDGg9RUqIhO\n3p8kT/zaNpWDZUzXbmxiE5CNfOZjdCvkzOqnQ8g566XN5p9U4QwdAxhghcb8\neghEiDY/Wd7ryfGTLL6tp8eT9eGO9/yibpTfM7x2jlswb2q2yhBYgnX7z6u+\nfjgbF0Q2Jvktui2ClnTtTPYOZPNghUK082h1Wv+41ib9PQntpTe+jV6b5o1C\nybZXoB73EllFiJg3DcGqwbC75OUt94ZCfFw3KK2dUHgRWExnnHuYADbhEiE6\nNJ8CQNNlbIGT0RN6PQi++fegXiV99xaLYJ2c5zfptl3w4hJAt0nxzMf2I/xz\nNtUp8IHGxWuV5tGlEqyRp1gjB1CaF3v7XJTs9zSrflWMiQ2IfVOurUHvq3am\nE2+Skdml4Ptt/1BgKlpem5qhIlJheRYqaZLK0bCDLL3UGkFTmy1I4CZj8r2T\nu574gFOngM/M4XDPN/vRn7W1DaB7GvKQ9Utq0YQReDj/BQNKnoLH8OQl3z1l\nq7er\r\n=lIVW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdhXR9YlmMoTTH5rg2JyXBJGvKQPF0V/upODk6HF6QfgIhANRyJuXc7tSR2C96AzwjQPIFJbF3nvDR/l/zsZx2Jaex"}]},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/toq_1.0.0_1557383696108_0.3843653562067897"},"_hasShrinkwrap":false},"1.0.1":{"name":"toq","version":"1.0.1","description":"Generate table of contents from html headings.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/reimund/toq.git"},"keywords":["table of contents","toc","toq","html"],"author":{"name":"Reimund Trost"},"license":"MIT","dependencies":{"cheerio":"~0.13.1","lodash":"^4.17.11","underscore":"~1.6.0"},"gitHead":"81f60e1094b6275c48eebe2ea2cf38a0586c658d","devDependencies":{},"bugs":{"url":"https://github.com/reimund/toq/issues"},"homepage":"https://github.com/reimund/toq#readme","_id":"toq@1.0.1","_nodeVersion":"10.11.0","_npmVersion":"6.12.0","dist":{"integrity":"sha512-USLRYRQnuTcw+RjMLj1EgPoPVrPEwhsH2Gha5hwKe7l8xFwoAXYD2lmg4M2nn2YRQX+mO+nCwWfKfA7ryqi8VQ==","shasum":"fa14853fd724d688dfcf1c4d7197bc153742ad72","tarball":"https://registry.npmjs.org/toq/-/toq-1.0.1.tgz","fileCount":3,"unpackedSize":7288,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd38rxCRA9TVsSAnZWagAAwOwQAJHQPDN+95l5CaRCR8Gy\nimdf7/yA/SkW5fGMvuFShpc61k7Ro1sK4YvmcAkPDkzE0jT9dg/Sz1RS1flx\npJuVK0MCmKnmP9qR5H4KYruovLJezXjkMZpFRlAmaQd1Cn/J/iq6C7NpvB18\nmRuTLj0P5ViNcqMZanrK3kwfIuhPpeWwfmxQXCpKsoU51qnw6SgUbBK0WaL0\nDfa31du2k6O3xlvC1dJ8Ug2kHReI6fyXIlkqJNaAx+4OyqQUhe3H4QNDdgjy\nl1jGclOm4w5lvISPG+aNwhUdJL99wlkl65GGWtZKL1hSF10lWJRe1C3sJTd9\nIouDNI8IRvqKNFG8wcuJdPOWO+iRmjtJvhxpDDAplC4SfgCYTYIJW9bYOJUW\neIz/aZay3ZSDr6oAdZzZ919KVaZyD7HG4kcfkcPaKcnmBF01TY+cUKRU6b3h\nWknV0O/HW57vBCOhFJe8jy4nAZilIm+Am4Fhh9zFJEEAjj+xgmcGvRVObzuQ\nfC4p1YQsY1Jxs6PD6qN3b71FJVSjClG0/ncfazKnxtU8KFBoGqb21kKM0tUA\nNuKcX4H2UJlRMwVG/n6ymxHAkeTYytDKqBZVbP8oOnj7yjuQdM20DcbUAvPH\nim6evOwjOhTBSUI2PoDm1t4dgl0S2aIj7whdaN2XynXDYe/9bG2vcjdiAFCo\nXy7a\r\n=SYNp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvkF47sFg1piLRhNs9yPk6Lluxrsfmgw4sjOkOPIt6OwIgPf5S+OG5ZSvbWEoK9FEkcqoR0SSOZlDYxftFSfI0oGY="}]},"maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"_npmUser":{"name":"reimund","email":"reimund@code7.se"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/toq_1.0.1_1574947568951_0.19911663199063856"},"_hasShrinkwrap":false}},"readme":"# toq - Table of contents generator\r\nGenerate table of contents from html headings.\r\n\r\nToq can also insert section numbers in your headings (see 2nd example below).\r\n\r\n## Installation\r\n`npm install toq`\r\n\r\n## Options:\r\n\r\n* **sectionNumbers** - Insert section numbers in the output contents. Default: false.\r\n* **flat** - Generate a flat list, without nested sub-lists. Default: false.\r\n\r\n## Examples\r\n\r\n### Example - Basic usage\r\n``` javascript\r\nvar html = '<h1 id=\"1a\">1st-level header</h1><p>foo</p>'\r\n\t+ '<h2 id=\"2a\">A 2nd-level header</h2><p>foo bar</p>'\r\n\t+ '<h2 id=\"2b\">A 2nd-level header</h2><p>bar foo</p>'\r\n\t+ '<h2 id=\"2b\">A 2nd-level header</h2><p>bar</p>'\r\n\t+ '<h3 id=\"3a\">A 3rd level header</h3><p>foo foo</p>'\r\n\t+ '<h3 id=\"3b\">A 3rd level header</h3><p>bar bar</p>'\r\n\t+ '<h2 id=\"2c\">Another 2nd-level header</h2><p>foobar</p>';\r\n\r\nvar toc = require('toq')(html).toc;\r\n\r\n```\r\n\r\nOutput:\r\n\r\n``` html\r\n<nav class=\"toq\">\r\n\t<ol class=\"nav\">\r\n\t\t<li class=\"toq-level-1\">\r\n\t\t\t<ol>\r\n\t\t\t\t<li class=\"toq-level-2\"><span>1</span> <a href=\"#1a\">1st-level header</a></li>\r\n\t\t\t\t<li class=\"toq-level-2\">\r\n\t\t\t\t\t<ol>\r\n\t\t\t\t\t\t<li class=\"toq-level-3\"><span>1.1</span> <a href=\"#2a\">A 2nd-level header</a></li>\r\n\t\t\t\t\t\t<li class=\"toq-level-3\"><span>1.2</span> <a href=\"#2b\">A 2nd-level header</a></li>\r\n\t\t\t\t\t\t<li class=\"toq-level-3\"><span>1.3</span> <a href=\"#2b\">A 2nd-level header</a></li>\r\n\t\t\t\t\t\t<li class=\"toq-level-3\">\r\n\t\t\t\t\t\t\t<ol>\r\n\t\t\t\t\t\t\t\t<li class=\"toq-level-4\"><span>1.3.1</span> <a href=\"#3a\">A 3rd level header</a></li>\r\n\t\t\t\t\t\t\t\t<li class=\"toq-level-4\"><span>1.3.2</span> <a href=\"#3b\">A 3rd level header</a></li>\r\n\t\t\t\t\t\t\t</ol>\r\n\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t<li class=\"toq-level-3\"><span>1.4</span> <a href=\"#2c\">Another 2nd-level header</a></li>\r\n\t\t\t\t\t</ol>\r\n\t\t\t\t</li>\r\n\t\t\t</ol>\r\n\t\t</li>\r\n\t</ol>\r\n</nav>\r\n```\r\n\r\n### Example - Section numbers\r\n\r\nIf you want to insert section numbers into the specified html, pass true as the second argument:\r\n\r\n``` javascript\r\nvar html = '<h1 id=\"1a\">1st-level header</h1><p>foo</p>'\r\n\t+ '<h2 id=\"2a\">A 2nd-level header</h2><p>foo bar</p>'\r\n\t+ '<h2 id=\"2b\">A 2nd-level header</h2><p>bar foo</p>'\r\n\t+ '<h2 id=\"2b\">A 2nd-level header</h2><p>bar</p>'\r\n\t+ '<h3 id=\"3a\">A 3rd level header</h3><p>foo foo</p>'\r\n\t+ '<h3 id=\"3b\">A 3rd level header</h3><p>bar bar</p>'\r\n\t+ '<h2 id=\"2c\">Another 2nd-level header</h2><p>foobar</p>';\r\n\r\nvar contents = require('toq')(html, { sectionNumbers: true }).contents\r\n\r\n```\r\n\r\nOutput:\r\n\r\n``` html\r\n<h1 id=\"1a\"><span class=\"section-number\">1</span> 1st-level header</h1>\r\n<p>foo</p>\r\n\r\n\t<h2 id=\"2a\"><span class=\"section-number\">1.1</span> A 2nd-level header</h2>\r\n\t<p>foo bar</p>\r\n\r\n\t<h2 id=\"2b\"><span class=\"section-number\">1.2</span> A 2nd-level header</h2>\r\n\t<p>bar foo</p>\r\n\r\n\t<h2 id=\"2b\"><span class=\"section-number\">1.3</span> A 2nd-level header</h2>\r\n\t<p>bar</p>\r\n\t\t<h3 id=\"3a\"><span class=\"section-number\">1.3.1</span> A 3rd level header</h3>\r\n\t\t<p>foo foo</p>\r\n\r\n\t\t<h3 id=\"3b\"><span class=\"section-number\">1.3.2</span> A 3rd level header</h3>\r\n\t\t<p>bar bar</p>\r\n\r\n\t<h2 id=\"2c\"><span class=\"section-number\">1.4</span> Another 2nd-level header</h2>\r\n\t<p>foobar</p>\r\n\r\n```\r\nIndented for better readability.\r\n\r\n### Example - Toc + section numbers\r\n\r\nTable of contents and section numbered content:\r\n\r\n``` javascript\r\nvar html = '<h1 id=\"1a\">1st-level header</h1><p>foo</p>'\r\n\t+ '<h2 id=\"2a\">A 2nd-level header</h2><p>foo bar</p>'\r\n\t+ '<h3 id=\"3a\">A 3rd level header</h3><p>foo foo</p>'\r\n\t+ '<h2 id=\"2c\">Another 2nd-level header</h2><p>foobar</p>';\r\n\r\nvar toq = require('toq')(html, true);\r\nconsole.log(toq.toc + toq.contents);\r\n\r\n```\r\n\r\n## MIT Licenced\r\n","maintainers":[{"name":"reimund","email":"reimund@code7.se"}],"time":{"modified":"2022-06-27T18:44:08.153Z","created":"2014-02-15T00:18:34.577Z","0.0.1":"2014-02-15T00:18:35.752Z","0.1.0":"2014-02-15T00:24:07.601Z","0.2.3":"2014-02-16T22:04:56.742Z","0.2.4":"2014-02-16T22:42:57.493Z","0.3.1":"2014-02-25T08:25:41.713Z","0.3.2":"2014-02-25T08:27:56.646Z","0.3.3":"2014-04-07T10:57:54.818Z","1.0.0":"2019-05-09T06:34:56.243Z","1.0.1":"2019-11-28T13:26:09.038Z"},"readmeFilename":"README.md","author":{"name":"Reimund Trost"},"repository":{"type":"git","url":"git+https://github.com/reimund/toq.git"},"homepage":"https://github.com/reimund/toq#readme","keywords":["table of contents","toc","toq","html"],"bugs":{"url":"https://github.com/reimund/toq/issues"},"license":"MIT"}