{"id":15664483,"url":"https://github.com/n1k0/toctoc","last_synced_at":"2025-05-05T23:12:28.900Z","repository":{"id":52271127,"uuid":"54032909","full_name":"n1k0/toctoc","owner":"n1k0","description":"Generates and maintain a Table of Content for your README.md.","archived":false,"fork":false,"pushed_at":"2021-05-02T09:25:46.000Z","size":31,"stargazers_count":16,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T23:12:22.374Z","etag":null,"topics":["generator","markdown","markup","readme","table-of-contents"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n1k0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-16T13:10:44.000Z","updated_at":"2025-02-06T13:41:46.000Z","dependencies_parsed_at":"2022-09-11T12:41:09.739Z","dependency_job_id":null,"html_url":"https://github.com/n1k0/toctoc","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1k0%2Ftoctoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1k0%2Ftoctoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1k0%2Ftoctoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n1k0%2Ftoctoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n1k0","download_url":"https://codeload.github.com/n1k0/toctoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590628,"owners_count":21772940,"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":["generator","markdown","markup","readme","table-of-contents"],"created_at":"2024-10-03T13:42:47.005Z","updated_at":"2025-05-05T23:12:28.882Z","avatar_url":"https://github.com/n1k0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"toctoc\n======\n\nGenerates and maintain a Table of Content for any Markdown document, especially `README.md` files hosted on github.\n\n## Table of Contents\n\n  - [Installation](#installation)\n     - [Globally](#globally)\n     - [Locally](#locally)\n  - [Setup](#setup)\n  - [Usage](#usage)\n     - [Custom TOC heading](#custom-toc-heading)\n     - [Max TOC depth](#max-toc-depth)\n     - [Soft TOC](#soft-toc)\n     - [Directory](#directory)\n     - [For the adventurous](#for-the-adventurous)\n  - [License](#license)\n\n---\n## Installation\n\n### Globally\n\n```\n$ npm install -g toctoc\n```\n\n### Locally\n\n```\n$ npm install toctoc --save-dev\n```\n\n## Setup\n\nThe program will scan the passed file contents and look for TOC placeholder, which must follow this format:\n\n```markdown\n  ## Table of Contents\n\n  ---\n```\n\nNote the `\u003chr/\u003e` tag (`---` in Markdown) at the end of the block.\n\n## Usage\n\n```\n$ toctoc README.md\n```\n\nBy default, this command outputs the modified file contents with the TOC markdown added. You can overwrite the original file by using the `-w` option:\n\n```\n$ toctoc README.md -w\n```\n\nIf a TOC was previously generated for this file, its previous version will be replaced with the new one.\n\n```\n$ toctoc docs/**/*.md -w \n```\n\nYou can use a [glob](http://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html) pattern or a directory to match multiple files at once.\n\n```\n$ toctoc doc -w -e MD\n```\n\nIf you use a directory, the file extensions searched is `.md`, if you wish to use a different file extension for markdown, use `-e` option. \n\n\n### Custom TOC heading\n\nBy default the TOC is generated using the `Table of Contents` heading. You can specify a custom one by using the `-t` option:\n\n```\n$ toctoc -w README.md -t=\"My custom TOC title\"\n```\n\nJust ensure to update your source file to use this new heading, so the executable can find and replace the appropriate TOC section.\n\n### Max TOC depth\n\nBy default, the generated TOC will expose links to the deepest subsections of the document; to limit the maximum crawling depth, use the `-d` option:\n\n```\n$ toctoc README.md -w -d 2\n```\n\n### Soft TOC\n\nBy default, it will fail with an error if the targeted file(s) do not have any TOC. To remove this limitation, use `-s` option:\n\n```\n$ toctoc docs/**/*.md -w -s\n```\n\n### Directory \n\nBy default, toctoc will use a `.md` extension if used with a directory. You can customise the extension to be founds by passing `-e` option.\n\n\n```\n$ toctoc docs -w -s -e .MD\n```\n\n\n### For the adventurous\n\nIt's possible to automate updating the README in a `package.json` `prepublish` command, so you're sure your npm package homepage is always updated with the right TOC when released:\n\n```json\n  \"scripts\": {\n    \"prepublish\": \"./node_modules/.bin/toctoc README.md -d 2 -w\"\n  },\n```\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1k0%2Ftoctoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn1k0%2Ftoctoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn1k0%2Ftoctoc/lists"}