{"_id":"contents","_rev":"17-cc9b3f4323400eabba44a7dd531b5b46","name":"contents","dist-tags":{"latest":"5.0.0"},"versions":{"0.0.1":{"name":"contents","version":"0.0.1","dependencies":{"flatiron":"*","union":"*","broadway":"*","underscore":"*","mongoose":"2.x.x","markdown":"git://github.com/kuruma-gs/markdown-js.git","mongoose-rest-in-flatiron":"*","coffee-script":"*","union-option-set":"*","mustache":"*","qs":"*","jQuery":"git://github.com/coolaj86/node-jquery"},"devDependencies":{"vows":"*","assert":"*","api-easy":"0.2.x","request":"*"},"scripts":{"test":"vows spec/*_spec.coffee","publish":"gap alpha hg:fetch && gap alpha restart"},"_id":"contents@0.0.1","dist":{"shasum":"fbca2405b2cf1475ae7b1af5a20a769c4d2b03f4","tarball":"https://registry.npmjs.org/contents/-/contents-0.0.1.tgz","integrity":"sha512-Ce1QBZppRmBbpr5oPhcaGzUgzXjVUIcMMX7iAx/HJEe1dmpzyfbs8xIAtpweEU2ZSCnANkHaepCOlod7V/+nGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCAYs8Dh+n8qR6KgHBVIardfjMgXmwIKobvjp+E4sU8hgIhAJDHt9Bq8lkHV5dPe9ob7nWiDVevEB3Kg8dcTYp2bU3D"}]},"maintainers":[{"name":"kuruma3","email":"tk.kuruma@gmail.com"}],"directories":{}},"3.0.4":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"3.0.4","main":"src/contents.js","devDependencies":{"del":"^0.1.2","gitdown":"^1.0.3","gulp":"^3.8.7","gulp-browserify":"^0.5.0","gulp-header":"^1.0.5","gulp-jshint":"^1.8.5","gulp-rename":"^1.2.0","gulp-uglify":"^0.3.1","gulp-util":"^3.0.0","jshint-stylish":"^1.0.0","jsonfile":"^2.0.0","karma":"^0.12.22","karma-html2js-preprocessor":"^0.1.0","karma-jasmine":"~0.2.2","karma-phantomjs-launcher":"^0.1.4"},"keywords":["table of contents","toc","contents"],"scrips":{"test":"gulp travis"},"license":"BSD-3-Clause","dependencies":{"sister":"^3.0.0"},"gitHead":"086c16db9b1982f3eab53a0abe90e9d977a5bcde","_id":"contents@3.0.4","scripts":{},"_shasum":"85af16b2c556baafbbdd4df6c981235bd5341f43","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"gajus","email":"gk@anuary.com"},"maintainers":[{"name":"gajus","email":"gk@anuary.com"}],"dist":{"shasum":"85af16b2c556baafbbdd4df6c981235bd5341f43","tarball":"https://registry.npmjs.org/contents/-/contents-3.0.4.tgz","integrity":"sha512-cIYCfZfs4QLHpl/UFYAGSHnf0GFd9M5LnHBaqztHqpHEXdJ73pxyB3rgCH7EhXhJ4YquYgc1OOy+W8Ej0PyUww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDDtHtKLqLsyY9kkaczve3rZ/g69g99CxXVg0xe1hJEhAiEA4X8YI5NOu6EVOelZ1EjESs6RQJP2kJljkn98FwJp+Sg="}]},"directories":{}},"4.0.0":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"4.0.0","author":{"name":"Gajus Kuizinas","email":"gk@anuary.com","url":"http://gajus.com"},"main":"dist/contents.js","devDependencies":{"babel-core":"^5.8.22","babel-loader":"^5.3.2","chai":"^3.2.0","gitdown":"^1.3.2","gulp":"^3.9.0","gulp-eslint":"^1.0.0","jquery":"^2.1.4","jquery-smooth-scroll":"^1.5.5","jsonfile":"^2.2.1","karma":"^0.13.9","karma-babel-preprocessor":"^5.2.1","karma-chai":"^0.1.0","karma-html2js-preprocessor":"^0.1.0","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","mocha":"^2.2.5","webpack":"^1.11.0"},"keywords":["table of contents","toc","contents"],"scrips":{"test":"gulp test"},"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"license":"BSD-3-Clause","dependencies":{"lodash":"^3.10.1","sister":"^3.0.0"},"gitHead":"867ac64872801f9bf40ffb5da8b1f63f7d2cae68","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@4.0.0","scripts":{},"_shasum":"f87d48d5fad76c0c467d2e311d8c167783f82ee3","_from":".","_npmVersion":"2.13.2","_nodeVersion":"2.5.0","_npmUser":{"name":"gajus","email":"gk@anuary.com"},"maintainers":[{"name":"gajus","email":"gk@anuary.com"}],"dist":{"shasum":"f87d48d5fad76c0c467d2e311d8c167783f82ee3","tarball":"https://registry.npmjs.org/contents/-/contents-4.0.0.tgz","integrity":"sha512-7LseZcyZzGqUCqEUcGirU7FCN3n7fWpqJuey4pZSx4ZkwRprqmeL7AYFVTtEkJUdzQnU+5wiGtO/SqLM7AZgFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHIviP6kjYCXQpdzi7Quyz/kmeea7veKCj7yp9KIamavAiEAknhtOwVxn+UTBAHTM8MqtckVstsVinzy13wPXaGXuzA="}]},"directories":{}},"4.0.1":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"4.0.1","author":{"name":"Gajus Kuizinas","email":"gk@anuary.com","url":"http://gajus.com"},"main":"./dist/es5/index.js","devDependencies":{"babel":"^5.8.23","babel-core":"^5.8.23","babel-loader":"^5.3.2","chai":"^3.2.0","gitdown":"^1.3.2","gulp":"^3.9.0","gulp-eslint":"^1.0.0","jquery":"^2.1.4","jquery-smooth-scroll":"^1.5.6","jsonfile":"^2.2.1","karma":"^0.13.9","karma-babel-preprocessor":"^5.2.2","karma-chai":"^0.1.0","karma-html2js-preprocessor":"^0.1.0","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","mocha":"^2.3.2","webpack":"^1.12.1"},"keywords":["table of contents","toc","contents"],"scripts":{"test":"gulp test","build":"webpack && babel ./src/ --out-dir ./dist/es5/"},"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"license":"BSD-3-Clause","dependencies":{"lodash":"^3.10.1","sister":"^3.0.0"},"gitHead":"b30077c0e6c2a565e941f564614d0ecc57e3f640","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@4.0.1","_shasum":"54ae7c2332436666a52a3b812d6c5baaea7d80d3","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"gajus","email":"gk@anuary.com"},"maintainers":[{"name":"gajus","email":"gk@anuary.com"}],"dist":{"shasum":"54ae7c2332436666a52a3b812d6c5baaea7d80d3","tarball":"https://registry.npmjs.org/contents/-/contents-4.0.1.tgz","integrity":"sha512-SjEBacBbNOJ3d9k0bSox8zZiZsAe75dbSaPGIsxcfKRSDdguSLq9bsWmVAByAVRVjbAazITd5UtNYcIgrP1m1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtc802sActbdQm5qCWRVzEE4/yTenhZl9Qn3QkDQSeEwIgW5jiL6b0Wf+g5hu7Y6+a7949igcnsS71Dq+omD4oV4c="}]},"directories":{}},"4.0.2":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"4.0.2","author":{"name":"Gajus Kuizinas","email":"gk@anuary.com","url":"http://gajus.com"},"main":"./dist/es5/index.js","devDependencies":{"babel-loader":"^5.3.2","chai":"^3.2.0","gitdown":"^1.3.2","gulp":"^3.9.0","gulp-eslint":"^1.0.0","jquery":"^2.1.4","jquery-smooth-scroll":"^1.5.6","jsonfile":"^2.2.1","karma":"^0.13.9","karma-babel-preprocessor":"^5.2.2","karma-chai":"^0.1.0","karma-html2js-preprocessor":"^0.1.0","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","mocha":"^2.3.2","webpack":"^1.12.1"},"keywords":["table of contents","toc","contents"],"scripts":{"test":"gulp test","build":"webpack && babel ./src/ --out-dir ./dist/es5/"},"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"license":"BSD-3-Clause","dependencies":{"babel":"^5.8.23","lodash":"^3.10.1","sister":"^3.0.0"},"gitHead":"4fbf2b44c7b74e041aa64fe380a7b2e1790370c7","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@4.0.2","_shasum":"3774cd36709824bcb4d87c221cdaafa8c618cbd2","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"gajus","email":"gk@anuary.com"},"maintainers":[{"name":"gajus","email":"gk@anuary.com"}],"dist":{"shasum":"3774cd36709824bcb4d87c221cdaafa8c618cbd2","tarball":"https://registry.npmjs.org/contents/-/contents-4.0.2.tgz","integrity":"sha512-f7jfFMPebtp84id2YC1nhyzidlC90KiBooUlvJ/51CFVzrEFaYx+uKnNpcJss++f/GWGCihs7/tYwpIrCiCe9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDX7L9Rj3Gxd+LGGiiETBG/BNddaz5EIU+Bx6P0w4ddUwIgPz/LNw1BKKmqTsLW6R5xy2tqCq4h98pNldFJ/tPJclA="}]},"directories":{}},"4.0.3":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"4.0.3","author":{"name":"Gajus Kuizinas","email":"gk@anuary.com","url":"http://gajus.com"},"main":"./dist/es5/index.js","devDependencies":{"babel-loader":"^5.3.2","chai":"^3.2.0","gitdown":"^2.5.2","gulp":"^3.9.0","gulp-eslint":"^1.0.0","jquery":"^2.1.4","jquery-smooth-scroll":"^1.5.6","jsonfile":"^2.2.1","karma":"^0.13.9","karma-babel-preprocessor":"^5.2.2","karma-chai":"^0.1.0","karma-html2js-preprocessor":"^0.1.0","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","mocha":"^2.3.2","phantomjs":"^2.1.7","webpack":"^1.12.1"},"keywords":["table of contents","toc","contents"],"scripts":{"test":"gulp test","generate-readme":"gitdown ./.README/README.md --output-file ./README.md","build":"webpack && babel ./src/ --out-dir ./dist/es5/"},"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"license":"BSD-3-Clause","dependencies":{"babel":"^5.8.23","lodash":"^3.10.1","sister":"^3.0.0"},"gitHead":"112c4428107a00232df8583220e8dc88e01ca85d","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@4.0.3","_shasum":"8db4f874412bf5eae1df77ce94a1fc3f67282011","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.12.0","_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"dist":{"shasum":"8db4f874412bf5eae1df77ce94a1fc3f67282011","tarball":"https://registry.npmjs.org/contents/-/contents-4.0.3.tgz","fileCount":38,"unpackedSize":446024,"integrity":"sha512-Trx06kHDJ+hIKueNBevZYuUKrlPvgr3daaC8PedVPRwxrivmkNy01t23KHUkFxHyQnNfSxsUwTRwOoeN+QYNoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDo1w2NfFREGLH0i5731yeKv0izEa9mZAJeZ8LWrLMrpgIgUMmPcG+gG7qnnJOhhOQeYt0RLM2ggqYa14c3FU6UrLw="}]},"maintainers":[{"email":"gajus@gajus.com","name":"gajus"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/contents_4.0.3_1529488092812_0.2713544559493688"},"_hasShrinkwrap":false},"4.0.4":{"name":"contents","title":"Contents","description":"Table of contents generator.","version":"4.0.4","author":{"name":"Gajus Kuizinas","email":"gk@anuary.com","url":"http://gajus.com"},"main":"./dist/es5/index.js","devDependencies":{"babel-loader":"^5.3.2","chai":"^3.2.0","gitdown":"^2.5.2","gulp":"^3.9.0","gulp-eslint":"^1.0.0","jquery":"^2.1.4","jquery-smooth-scroll":"^1.5.6","jsonfile":"^2.2.1","karma":"^0.13.9","karma-babel-preprocessor":"^5.2.2","karma-chai":"^0.1.0","karma-html2js-preprocessor":"^0.1.0","karma-mocha":"^0.2.0","karma-phantomjs-launcher":"^0.2.1","mocha":"^2.3.2","phantomjs":"^2.1.7","webpack":"^1.12.1"},"keywords":["table of contents","toc","contents"],"scripts":{"test":"gulp test","generate-readme":"gitdown ./.README/README.md --output-file ./README.md","build":"webpack && babel ./src/ --out-dir ./dist/es5/"},"repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"license":"BSD-3-Clause","dependencies":{"babel":"^5.8.23","lodash":"^3.10.1","sister":"^3.0.0"},"gitHead":"c6040eebb470af25e45db9dd18fa24b5d68e1c96","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@4.0.4","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"dist":{"integrity":"sha512-RNlS7ZTQf5jGV7Sex+s20jdJ4Rue5Gx+shtfvrWk91IyxeK4tCUHyGjeSb+tnjyrU5GBSs0wvcoASO09c7zysw==","shasum":"c09a4dcf99dd6e3bed925f1189560dac6d8fb908","tarball":"https://registry.npmjs.org/contents/-/contents-4.0.4.tgz","fileCount":26,"unpackedSize":1183009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKi3fCRA9TVsSAnZWagAAjDUP/16wyEpr0YAhvBdMwZmn\nFQGg3GyJ9uhM1/UUJNlBmdq2JBZoG5JRlk5pQy1dDmoeT6qfaCcDeXZ8JgKD\ndEmxbMEI2daBdbiBugxtNCfoiFL9Skr/klsmKhq8O3N18v9N0lvLwVta1l5r\n1ptgMIKntYNDRYUKcz8J6Ypdcso3a/Mz1fsllF63f7U+/n95NlXP8Pn3/kuH\n/OqXyqdD5q1y1sLbzras/gNrIAV4DTWYM4uQQb+mCOxBGW8Ts0Y+18Sh7AhM\njxLk0pNGAt5gLA8zmTsXNJld+T9Jhn8b/gdwzcsimbPWOZhqDM8cOmydpx3j\n/8y63baVm+TvVfNgzsT7CVep1fkswt6iyWEJ13REZQshYtZ3X8qIFrH+a6JC\nZdLKgcL/9PwFZj1TKGE8/NsyEEojtuB04TbR3jVxG+dMooSrF3e1ehXuZZUZ\ngEEe/JWXBvRNPivKSZvoasT3mMVzKbcz4ZsXuDfQgqwFEKxtDTGjWZMEZtfZ\nVES3tQO91novvXqh5UubNU99GcvhVFsiVig4cBTm07H8flRwKrS2Gr2KIDu9\nUNQobbEhqmBFZulZk0KvsRyH4lsqavR7UcpPnjiZeWRt1z1AIK0eVA7O0+2/\n8nqLV89opoZvW7L5PMCJSAk2Iukb/envrXdw7Daq5c+EWIdaQtqob3+5ECV3\nPT+K\r\n=OnNm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFXJ5c4m3cM3LltSN0u9TBppEBJdILDDAadsjs9t4p8sAiEAo6/cVqtDZp2KnOclsBnlyxct/kH4Ig2bIBN0SsBO6DM="}]},"maintainers":[{"email":"gajus@gajus.com","name":"gajus"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/contents_4.0.4_1529490910510_0.9430916376631038"},"_hasShrinkwrap":false},"5.0.0":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"dependencies":{"lodash":"^4.17.10","sister":"^3.0.1"},"description":"Table of contents generator.","devDependencies":{"@babel/cli":"^7.0.0","@babel/core":"^7.0.0","@babel/preset-env":"^7.0.0","@babel/register":"^7.0.0","chai":"^4.1.2","eslint-config-canonical":"^12.0.0","gitdown":"^2.5.2","jsdom":"^12.0.0","mocha":"^5.2.0"},"keywords":["table of contents","toc","contents"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"contents","repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"scripts":{"build":"rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps","generate-readme":"gitdown ./.README/README.md --output-file ./README.md","lint":"eslint ./src && flow","test":"mocha --require @babel/register"},"title":"Contents","version":"5.0.0","gitHead":"df8cb679f9fca1ade58fb2f5b65d223074dd8cc0","bugs":{"url":"https://github.com/gajus/contents/issues"},"homepage":"https://github.com/gajus/contents#readme","_id":"contents@5.0.0","_npmVersion":"6.4.0","_nodeVersion":"10.7.0","_npmUser":{"name":"gajus","email":"gajus@gajus.com"},"dist":{"integrity":"sha512-wnnGorqo07ZSIzMQmUc4vUv1NEXl7elBtqoz5UcysV+pbSvphZYfI763rXgpFK2H9o5rvjQQ8kZxp7hOOwIe3A==","shasum":"4310b7304509659779adc1686bfde940310a063e","tarball":"https://registry.npmjs.org/contents/-/contents-5.0.0.tgz","fileCount":19,"unpackedSize":426853,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiAROCRA9TVsSAnZWagAALhMP/3K7W23qI7H4txygUCQW\ni4UzPkeK3MrtdhWdVU5HLWjh9HgtZrGKFWHKIS6FkV46TxmQk/gJweZ3k2yH\nI1dQyKrFG4oxLv+Hlnco9dj/qsrja1URTFL4XuiyyxGWlOeI8e/C0ShGGDgP\nxnnRJ+YnmliK+9eWfgQa9Lt6YRpfwosU75yPFzFJ+MAakeLsLPnIlA3wYHz7\nyLVPtVLA9JL8RKiZc2o2e9XbWcAGqleLYg8DwN1LvUZ+s4S8mLEItzaKcEMU\niZD5w9ztMfowSaDPsE6Rpm3fp7u7rSWql2qHC5D3IEWA9AdebMHaJQDhtgzU\n+h0U5weoZvomUmU7FA3p8VNFzC/iCvbOglBzVIzZmItGI7sMphQyYcDvX7so\nuO+/jl4BYLXDBG1R7Hkp9FQ1WbxjDslICWkk3+TwiSbFRYC0PAOv+yrl1Gpn\nywMEdXuw/Nts+5wgwDV7xkq7yjIWJu//0WQiraTqszR7ZRGO8IkHupTYzhog\nX/ZP49Arfeip7F8m89YkrGzaUhWRCB0w+kIuuyMcMZrI5eHI+XmwR/quR6kc\nKx4vNUuZVwEVuCCaBcbyGiJpcMmcvItgxXyH80uCcicKC3GHiIRTSiJDqcM+\n6QPnbjC1XeXTV9s9Izo9vAHMkQespIGT4Z7PwZmq7bZwMHflzPxXAQPFjJVa\nE51h\r\n=IS8M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnZz3OKRJqGkPbE0m4XhnIjHFQ7hjwuNzjmPQn2DmUuQIhAPqCXN1QBPGrlvuva0fa560C+fy5GK3qh2RIFvUH1jTO"}]},"maintainers":[{"email":"gajus@gajus.com","name":"gajus"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/contents_5.0.0_1535640653509_0.7795881006993086"},"_hasShrinkwrap":false}},"readme":"<a name=\"table-of-contents-toc-generator\"></a>\n# Table of Contents (TOC) Generator\n\n[![Travis build status](http://img.shields.io/travis/gajus/contents/master.svg?style=flat-square)](https://travis-ci.org/gajus/contents)\n[![NPM version](http://img.shields.io/npm/v/contents.svg?style=flat-square)](https://www.npmjs.org/package/contents)\n\n<!--\n[![Tweet Button](./.gitdown/tweet-button.png)](https://twitter.com/intent/tweet?text=%23JavaScript%20library%20to%20generate%20table%20of%20contents%20for%20a%20given%20area%20of%20content.&url=https://github.com/gajus/contents&via=kuizinas)\n-->\n\nTable of contents generator.\n\n* [Table of Contents (TOC) Generator](#table-of-contents-toc-generator)\n    * [Usage](#table-of-contents-toc-generator-usage)\n        * [Quick Start](#table-of-contents-toc-generator-usage-quick-start)\n        * [Examples](#table-of-contents-toc-generator-usage-examples)\n    * [Introduction of ES6 in 4.0.0](#table-of-contents-toc-generator-introduction-of-es6-in-4-0-0)\n    * [Similar Libraries](#table-of-contents-toc-generator-similar-libraries)\n        * [Required 3rd Party Libraries](#table-of-contents-toc-generator-similar-libraries-required-3rd-party-libraries)\n        * [Smooth Scrolling](#table-of-contents-toc-generator-similar-libraries-smooth-scrolling)\n        * [Window Resize and `scroll` Event Handling](#table-of-contents-toc-generator-similar-libraries-window-resize-and-scroll-event-handling)\n* [Table of Contents Array](#table-of-contents-array)\n    * [Download](#table-of-contents-array-download)\n    * [Configuration](#table-of-contents-array-configuration)\n    * [Content Indexing](#table-of-contents-array-content-indexing)\n        * [Hierarchy](#table-of-contents-array-content-indexing-hierarchy)\n    * [Linking](#table-of-contents-array-linking)\n        * [Article ID](#table-of-contents-array-linking-article-id)\n    * [Markup](#table-of-contents-array-markup)\n    * [Events](#table-of-contents-array-events)\n\n\n<a name=\"table-of-contents-toc-generator-usage\"></a>\n## Usage\n\n<a name=\"table-of-contents-toc-generator-usage-quick-start\"></a>\n### Quick Start\n\n```js\nimport Contents from 'contents';\n\n// This example generates a table of contents for all of the headings in the document.\n// Table of contents is an ordered list element.\nconst contents = Contents();\n\n// Append the generated list element (table of contents) to the container.\ndocument.querySelector('#your-table-of-contents-container').appendChild(contents.list());\n\n// Attach event listeners:\ncontents.eventEmitter().on('change', function () {\n  console.log('User has navigated to a new section of the page.');\n});\n\n// The rest of the code illustrates firing \"resize\" event after you have\n// added new content after generating the table of contents.\nconst newHeading = document.createElement('h2');\n\nhewHeading.innerHTML = 'Dynamically generated title';\n\ndocument.body.appendChild(newHeading);\n\n// Firing the \"resize\" event will regenerate the table of contents.\ncontents.eventEmitter().trigger('resize');\n\n```\n\n<a name=\"table-of-contents-toc-generator-usage-examples\"></a>\n### Examples\n\n* [Good looking](http://gajus.com/sandbox/contents/examples/good-looking/) example.\n* [Plain](http://gajus.com/sandbox/contents/examples/plain/) table of contents not using jQuery.\n* [Events](http://gajus.com/sandbox/contents/examples/events/) table of contents with all events logged in the `console.log`.\n* [Obtain Generated List Element](http://gajus.com/sandbox/contents/examples/list-element/).\n* [jQuery](http://gajus.com/sandbox/contents/examples/jquery/) table of contents using jQuery.\n* [Smooth scrolling](http://gajus.com/sandbox/contents/examples/smooth-scrolling/) implemented using [jquery-smooth-scroll](https://github.com/kswedberg/jquery-smooth-scroll).\n\nThe code for all of the examples is in the [examples](./examples/) folder.\n\n[Raise an issue](https://github.com/gajus/contents/issues) if you are missing an example.\n\n<a name=\"table-of-contents-toc-generator-introduction-of-es6-in-4-0-0\"></a>\n## Introduction of ES6 in 4.0.0\n\n[Similar Libraries](#rimilar-libraries) stats have been generated in 22-Nov-14 08:44:41 UTC. Since then Contents has evolved a lot. The source code is written in ES6 and depends on `babel-core` to run. In projects that already depend on Babel and use webpack to build packages, this is not going to be a problem. Other projects need to consider the relatively heavy weight of the generated package.\n\n<a name=\"table-of-contents-toc-generator-similar-libraries\"></a>\n## Similar Libraries\n\n| Feature | [contents](https://github.com/gajus/contents) | [toc](https://github.com/jgallen23/toc) | [jquery.tocify.js](https://github.com/gfranko/jquery.tocify.js) |\n| --- | --- | --- | --- |\n| Markup using nested `<ol>` | ✓ | - | - |\n| [Smooth scrolling](#smooth-scrolling) | - | ✓ | ✓ |\n| Forward and back button support | ✓ | - | ✓ |\n| [Events](#events) | ✓ | - | - |\n| [Efficient `scroll` event](#window-resize-and-scroll-event-handling) | ✓ | ✓ | - |\n| [Reflect `window` resize](#window-resize-and-scroll-event-handling) | ✓ | - | ✓ |\n| [Extract table of contents as an array](#table-of-contents-array) | ✓ | - | - |\n| Overwrite markup and navigation | ✓ | - | - |\n| Can have multiple on a page | ✓ | ✓ | ✓ |\n| [Required 3rd party libraries](#required-3rd-party-libraries) | - | jQuery | jQuery, jQueryUI |\n| Size | < 6.000 kb | 2.581 kb | 7.246 kb |\n| GitHub Stars | 192 | 307 | 435 |\n\nLast updated: Saturday, 22-Nov-14 08:44:41 UTC.\n\n<a name=\"table-of-contents-toc-generator-similar-libraries-required-3rd-party-libraries\"></a>\n### Required 3rd Party Libraries\n\nThere are no 3rd party dependencies. jQuery selectors are used in the examples to make it simple for the reader.\n\n<a name=\"table-of-contents-toc-generator-similar-libraries-smooth-scrolling\"></a>\n### Smooth Scrolling\n\nYou can implement smooth scrolling using either of the existing libraries. See [Integration Examples](#integration-examples).\n\n<a name=\"table-of-contents-toc-generator-similar-libraries-window-resize-and-scroll-event-handling\"></a>\n### Window Resize and <code>scroll</code> Event Handling\n\nThe library will index `offsetTop` of all articles. This index is used to reflect the [change event](#events). The index is built upon loading the page, and in response to `window.onresize` and [`ready`](#events) events.\n\nReading `offsetTop` causes a [reflow](http://gent.ilcore.com/2011/03/how-not-to-trigger-layout-in-webkit.html). Therefore, this should not be done while scrolling.\n\n<a name=\"table-of-contents-array\"></a>\n# Table of Contents Array\n\nYou can extract the table of contents as a collection of nested objects representing the table of contents.\n\n```js\n/**\n * @return {array} Array representation of the table of contents.\n */\ncontents.tree();\n```\n\nTree is a collection of nodes:\n\n```js\n[\n  // Node\n  {\n    // Hierarchy level (e.g. h1 = 1)\n    level: 1,\n    // Id derived using articleId() function.\n    id: '',\n    // Name derived using articleName() function.\n    name: '',\n    // The article element.\n    element: null,\n    // Collection of the descendant nodes.\n    descendants: [ /* node */ ]\n  }\n]\n```\n\n<a name=\"table-of-contents-array-download\"></a>\n## Download\n\nUsing [NPM](https://www.npmjs.org/):\n\n```sh\nnpm install contents\n\n```\n\n<a name=\"table-of-contents-array-configuration\"></a>\n## Configuration\n\n| Name | Type | Description |\n| --- | --- | --- |\n| `articles` | `NodeList`, `jQuery` | (optional) The default behavior is to index all headings (H1-H6) in the document. See [Content Indexing](#content-indexing). |\n| `link` | `function` | (optional) Used to represent article in the table of contents and to setup navigation. See [Linking](#linking). |\n<a name=\"table-of-contents-array-content-indexing\"></a>\n## Content Indexing\n\nThe default behavior is to index all headings (H1-H6) in the document.\n\nUse `articles` setting to index content using your own selector:\n\n```js\nContents({\n  articles: document.querySelectorAll('main h2, main h2')\n  // If you are using jQuery\n  // articles: $('main').find('h2, h3').get()\n});\n\n```\n\n<a name=\"table-of-contents-array-content-indexing-hierarchy\"></a>\n### Hierarchy\n\n`articles` will be used to make the table of contents. `articles` have level of importance. The level of importance determines list nesting (see [Markup](#markup)). For HTML headings, the level of importance is derived from the tag name (`<h[1-6]>`). To set your own level of importance, use `Contents.level` [dataset](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.dataset) property or jQuery data property with the same name, e.g.\n\n```js\n$('main').find('.summary').data('gajus.contents.level', 4);\n\nContents({\n  articles: $('main').find('h1, h2, h3, .summary').get()\n});\n\n```\n\nWhen level of importance cannot be determined, it defaults to 1.\n\n<a name=\"table-of-contents-array-linking\"></a>\n## Linking\n\n`link` method is used to represent article in the table of contents and to setup navigation. This method is called once for each article after the list of the table of contents is generated.\n\nThe default implementation:\n\n1. Derives ID from the article\n2. Generates a hyperlink using article ID as the anchor\n3. Appends the URL to the table of contents\n4. Wraps the article node in a self-referencing hyperlink.\n\n```js\n/**\n * This function is called after the table of contents is generated.\n * It is called for each article in the index.\n * Used to represent article in the table of contents and to setup navigation.\n *\n * @param {HTMLElement} guide An element in the table of contents representing an article.\n * @param {HTMLElement} article The represented content element.\n */\nContents.link = (guide, article) => {\n  const guideLink = document.createElement('a'),\n  const articleLink = document.createElement('a'),\n  const articleName = article.innerText,\n  const articleId = article.id || Contents.id(articleName);\n\n  article.id = articleId;\n\n  articleLink.href = '#' + articleId;\n\n  while (article.childNodes.length) {\n    articleLink.appendChild(article.childNodes[0], articleLink);\n  }\n\n  article.appendChild(articleLink);\n\n  guideLink.appendChild(document.createTextNode(articleName));\n  guideLink.href = '#' + articleId;\n  guide.insertBefore(guideLink, guide.firstChild);\n};\n\n```\n\nTo overwrite the default behavior, you can provide your own `link` function as part of the configuration:\n\n```js\nContents({\n  // Example of implementation that does not wrap\n  // article node in a hyperlink.\n  link: (guide, article) => {\n    var guideLink,\n        articleName,\n        articleId;\n\n    guide = $(guide);\n    article = $(article);\n\n    guideLink = $('<a>');\n    articleName = article.text();\n    articleId = article.attr('id') || Contents.id(articleName);\n\n    guideLink\n      .text(articleName)\n      .attr('href', '#' + articleId)\n      .prependTo(guide);\n\n    article.attr('id', articleId);\n  }\n});\n\n```\n\n<a name=\"table-of-contents-array-linking-article-id\"></a>\n### Article ID\n\nThe default implementation relies on each article having an \"id\" attribute to enable anchor navigation.\n\nIf you are overwriting the default `link` implementation, you can take advantage of the `Contents.id` function.\n\n`Contents.id` is responsible for deriving a unique ID from the text of the article, e.g.\n\n```html\n<h2>Allow me to reiterate</h2>\n<h2>Allow me to reiterate</h2>\n<h2>Allow me to reiterate</h2>\n\n```\n\nThe default `link` implementation will use `Contents.id` to give each article a unique ID:\n\n```html\n<h2 id=\"allow-me-to-reiterate\">Allow me to reiterate</h2>\n<h2 id=\"allow-me-to-reiterate-1\">Allow me to reiterate</h2>\n<h2 id=\"allow-me-to-reiterate-2\">Allow me to reiterate</h2>\n\n```\n\n<a name=\"table-of-contents-array-markup\"></a>\n## Markup\n\nTable of contents is an ordered [list element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol). List nesting reflects the heading hierarchy. The default behavior is to represent each heading using a hyperlink (See [Linking](#linking)), e.g.\n\n```html\n<h1>JavaScript</h1>\n<h2>History</h2>\n<h2>Trademark</h2>\n<h2>Features</h2>\n<h3>Imperative and structured</h3>\n<h3>Dynamic</h3>\n<h3>Functional</h3>\n<h2>Syntax</h2>\n```\n\nContents will generate the following markup for the above content:\n\n```html\n<ol>\n  <li>\n    <a href=\"#javascript\">JavaScript</a>\n\n    <ol>\n      <li>\n        <a href=\"#history\">History</a>\n      </li>\n      <li>\n        <a href=\"#trademark\">Trademark</a>\n      </li>\n      <li>\n        <a href=\"#features\">Features</a>\n\n        <ol>\n          <li>\n            <a href=\"#imperative-and-structured\">Imperative and structured</a>\n          </li>\n          <li>\n            <a href=\"#dynamic\">Dynamic</a>\n          </li>\n          <li>\n            <a href=\"#functional\">Functional</a>\n          </li>\n        </ol>\n      </li>\n      <li>\n        <a href=\"#syntax\">Syntax</a>\n      </li>\n    </ol>\n  </li>\n</ol>\n```\n\n<a name=\"table-of-contents-array-events\"></a>\n## Events\n\n| Event | Description |\n| --- | --- |\n| `ready` | Fired once after the table of contents has been generated. |\n| `resize` | Fired when the page is loaded and in response to \"resize\" and \"orientationchange\" `window` events. |\n| `change` | Fired when the page is loaded and when user navigates to a new section of the page. |\n\nAttach event listeners using the `eventEmitter.on` of the resulting Contents object:\n\n```js\nconst contents = Contents();\n\ncontents.eventEmitter.on('ready', () => {});\ncontents.eventEmitter.on('resize', () => {});\n\n```\n\nThe `change` event listener is passed extra parameters: `.current.article`, `.current.guide`, and when available, `.previous.article`, `.previous.guide`:\n\n```js\ncontents.eventEmitter.on('change', (data) => {\n  if (data.previous) {\n    $(data.previous.article).removeClass('active-article');\n    $(data.previous.guide).removeClass('active-guide');\n  }\n\n  $(data.current.article).addClass('active-article');\n  $(data.current.guide).addClass('active-guide');\n});\n\n```\n\nYou must trigger \"resize\" event after programmatically changing the content or the presentation of the content.:\n\n```js\ncontents.eventEmitter.trigger('resize');\n\n```\n\nThis is required to recalculate the position of the content.\n\n","maintainers":[{"email":"gajus@gajus.com","name":"gajus"}],"time":{"modified":"2022-06-13T22:33:17.109Z","created":"2012-06-27T09:24:25.677Z","0.0.1":"2012-06-27T09:24:28.614Z","3.0.4":"2014-11-26T19:18:05.897Z","4.0.0":"2015-08-22T10:34:43.834Z","4.0.1":"2015-09-10T12:54:45.790Z","4.0.2":"2015-09-10T13:10:43.785Z","4.0.3":"2018-06-20T09:48:12.931Z","4.0.4":"2018-06-20T10:35:10.628Z","5.0.0":"2018-08-30T14:50:53.882Z"},"readmeFilename":"README.md","description":"Table of contents generator.","keywords":["table of contents","toc","contents"],"license":"BSD-3-Clause","homepage":"https://github.com/gajus/contents#readme","repository":{"type":"git","url":"git+ssh://git@github.com/gajus/contents.git"},"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"bugs":{"url":"https://github.com/gajus/contents/issues"}}