{"id":22799053,"url":"https://github.com/thomd/rehype-navigation","last_synced_at":"2026-01-27T07:34:26.317Z","repository":{"id":248358693,"uuid":"828349334","full_name":"thomd/rehype-navigation","owner":"thomd","description":"rehype plugin which creates a navigation reflecting the headline hierarchy","archived":false,"fork":false,"pushed_at":"2024-11-16T17:40:56.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-28T18:13:46.158Z","etag":null,"topics":["rehype","rehype-plugin"],"latest_commit_sha":null,"homepage":"https://thomd.github.io/rehype-navigation/","language":"JavaScript","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/thomd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-13T21:37:29.000Z","updated_at":"2024-11-16T17:40:59.000Z","dependencies_parsed_at":"2025-04-20T14:17:08.618Z","dependency_job_id":null,"html_url":"https://github.com/thomd/rehype-navigation","commit_stats":null,"previous_names":["thomd/rehype-navigation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thomd/rehype-navigation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-navigation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-navigation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-navigation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-navigation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomd","download_url":"https://codeload.github.com/thomd/rehype-navigation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-navigation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28808023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:14:39.408Z","status":"ssl_error","status_checked_at":"2026-01-27T07:14:39.098Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["rehype","rehype-plugin"],"created_at":"2024-12-12T07:07:45.313Z","updated_at":"2026-01-27T07:34:26.273Z","avatar_url":"https://github.com/thomd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rehype-navigation\n\n![Build][build-badge]\n\n`rehype-navigation` is a [rehype][rehype] plugin to create a navigation with anchor links reflecting the headline hierarchy.\n\nThe plugin works best with headings having `id` attributes. You may use for example [rehype-slug][rehype-slug] to add them. If `id` attributes are missing, then the navigation is generated without anchor links.\n\n## Demo\n\nGenerate the HTML for a demo page like this:\n\n```\ncd demo\nnode demo.js \u003e index.html\nnpx http-server\nopen http://localhost:8080\n```\n\nor open this [demo page](https://thomd.github.io/rehype-navigation/).\n\n## Usage\n\nSay we have the following file `example.md`:\n\n```markdown\n# Level 1.1\n\n## Level 2.1\n\ntext\n\n## Level 2.2\n\ntext\n\n# Level 1.2\n\ntext\n```\n\nand a module `example.js`:\n\n```js\nimport { remark } from 'remark'\nimport remarkRehype from 'remark-rehype'\nimport rehypeSlug from 'rehype-slug'\nimport rehypeNavigation from 'rehype-navigation'\nimport rehypeStringify from 'rehype-stringify'\nimport { read } from 'to-vfile'\n\nconst file = await remark()\n   .use(remarkRehype)\n   .use(rehypeSlug)\n   .use(rehypeNavigation, { wrapperTag: 'nav', maxDepth: 3 })\n   .use(rehypeStringify)\n   .process(await read('example.md'))\n\nconsole.log(file.value)\n```\n\nthen running `node example.js` yields:\n\n```html\n\u003ch1 id=\"level-11\"\u003eLevel 1.1\u003c/h1\u003e\n\u003ch2 id=\"level-21\"\u003eLevel 2.1\u003c/h2\u003e\n\u003cp\u003etext\u003c/p\u003e\n\u003ch2 id=\"level-22\"\u003eLevel 2.2\u003c/h2\u003e\n\u003cp\u003etext\u003c/p\u003e\n\u003ch1 id=\"level-12\"\u003eLevel 1.2\u003c/h1\u003e\n\u003cp\u003etext\u003c/p\u003e\n\u003cnav\u003e\n   \u003cul\u003e\n      \u003cli\u003e\n         \u003ca href=\"#level-11\"\u003eLevel 1.1\u003c/a\u003e\n         \u003cul\u003e\n            \u003cli\u003e\u003ca href=\"#level-21\"\u003eLevel 2.1\u003c/a\u003e\u003c/li\u003e\n            \u003cli\u003e\u003ca href=\"#level-22\"\u003eLevel 2.2\u003c/a\u003e\u003c/li\u003e\n         \u003c/ul\u003e\n      \u003c/li\u003e\n      \u003cli\u003e\u003ca href=\"#level-12\"\u003eLevel 1.2\u003c/a\u003e\u003c/li\u003e\n   \u003c/ul\u003e\n\u003c/nav\u003e\n```\n\n## API\n\nThe default export is `rehypeNavigation`.\n\n```js\nunified().use(rehypeNavigation, options)\n```\n\n### Options\n\nThe following options are available:\n\n-  `extract` (`Boolean`, optional) — Generate only the navigation and remove everything else. Default is `false`.\n\n-  `maxDepth` (`Integer`, optional) — Maximum depth of the headings hierarchy which should be taken into account for the navigation. Default is `6`.\n\n-  `wrapperTag` (`String`, optional) — Tag to wrap the navigation. Default is no wrapper tag.\n\n-  `fullMonty` (`Boolean`, optional) — Generate navigation even if there is only **one** headline. Default is `true`.\n\n[rehype]: https://github.com/rehypejs/rehype\n[rehype-slug]: https://github.com/rehypejs/rehype-slug\n[build-badge]: https://github.com/thomd/rehype-navigation/workflows/plugin-test/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Frehype-navigation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomd%2Frehype-navigation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Frehype-navigation/lists"}