{"id":15700044,"url":"https://github.com/jonschlinkert/gulp-html-toc","last_synced_at":"2025-05-12T13:08:37.176Z","repository":{"id":57257789,"uuid":"88486971","full_name":"jonschlinkert/gulp-html-toc","owner":"jonschlinkert","description":"Gulp plugin for html-toc, for generating a HTML table of contents.","archived":false,"fork":false,"pushed_at":"2017-05-15T01:15:14.000Z","size":11,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T02:02:58.471Z","etag":null,"topics":["cheerio","gulp","gulpplugin","html","html-toc","table-of-contents","toc"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert/gulp-html-toc","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-17T08:16:18.000Z","updated_at":"2021-04-12T22:30:30.000Z","dependencies_parsed_at":"2022-08-25T21:23:34.072Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/gulp-html-toc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgulp-html-toc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgulp-html-toc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgulp-html-toc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgulp-html-toc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/gulp-html-toc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745160,"owners_count":21957317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheerio","gulp","gulpplugin","html","html-toc","table-of-contents","toc"],"created_at":"2024-10-03T19:44:41.000Z","updated_at":"2025-05-12T13:08:37.143Z","avatar_url":"https://github.com/jonschlinkert.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-html-toc [![NPM version](https://img.shields.io/npm/v/gulp-html-toc.svg?style=flat)](https://www.npmjs.com/package/gulp-html-toc) [![NPM monthly downloads](https://img.shields.io/npm/dm/gulp-html-toc.svg?style=flat)](https://npmjs.org/package/gulp-html-toc) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/gulp-html-toc.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/gulp-html-toc)\n\n\u003e Gulp plugin for html-toc, for generating a HTML table of contents.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save gulp-html-toc\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add gulp-html-toc\n```\n\n## Usage\n\n```js\nvar toc = require('gulp-html-toc');\n\ngulp.task('toc', function() {\n  return gulp.src('foo/*.html')\n    .pipe(toc())\n    .pipe(gulp.dest('bar'));\n});\n```\n\n## Options\n\n### options.id\n\n**Type**: `string`\n\n**Default**: `#toc` (usage: `\u003cdiv id=\"toc\"\u003e\u003c/div\u003e`)\n\nSpecify the id for where the table of contents should be injected.\n\n**Example**\n\n```js\ntoc({id: '#navigation'});\n```\n\nIn your HTML, add the following:\n\n```html\n\u003cdiv id=\"navigation\"\u003e\u003c/div\u003e\n```\n\n### options.anchors\n\n**Type**: `boolean`\n\n**Default**: `undefined`\n\nSet to `false` to disable anchors.\n\n**Example**\n\n```js\ntoc({anchors: false});\n```\n\n### options.anchorTemplate\n\nCustomize the template for creating anchors.\n\n**Type**: `function`\n\n**Default**\n\n```html\n\u003ca href=\"#${id}\" name=\"${id}\" class=\"anchor\"\u003e\n  \u003cspan class=\"anchor-target\" id=\"${id}\"\u003e\u003c/span\u003e\n  \u003cspan class=\"glyphicon glyphicon-link\"\u003e\u003c/span\u003e\n\u003c/a\u003e\n```\n\n**Example**\n\n```js\ntoc({\n  anchorTemplate: function(id) {\n    return `\u003ca class=\"anchor\" href=\"${id}\" id=\"${id}\"\u003e\u003c/a\u003e`;\n  }\n});\n```\n\n### options.selectors\n\nHeading selectors to use for generating the table of contents.\n\n**Type**: `string`\n\n**Default**: `h1,h2`\n\n**Example**\n\nGenerate a table of contents for all headings h1-h4.\n\n```js\ntoc({selectors: 'h1,h2,h3,h4'});\n```\n\n## About\n\n### Related projects\n\n* [gulp-htmlmin](https://www.npmjs.com/package/gulp-htmlmin): gulp plugin to minify HTML. | [homepage](https://github.com/jonschlinkert/gulp-htmlmin#readme \"gulp plugin to minify HTML.\")\n* [gulp-prettify](https://www.npmjs.com/package/gulp-prettify): Prettify, format, beautify HTML. | [homepage](https://github.com/jonschlinkert/gulp-prettify \"Prettify, format, beautify HTML.\")\n* [html-toc](https://www.npmjs.com/package/html-toc): Generate a HTML table of contents using cheerio. | [homepage](https://github.com/jonschlinkert/html-toc \"Generate a HTML table of contents using cheerio.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 17, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fgulp-html-toc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fgulp-html-toc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fgulp-html-toc/lists"}