{"id":15857656,"url":"https://github.com/jar-b/mdtoc","last_synced_at":"2026-01-21T01:02:00.554Z","repository":{"id":45271901,"uuid":"367248561","full_name":"jar-b/mdtoc","owner":"jar-b","description":"Generate a table of contents for an existing markdown document.","archived":false,"fork":false,"pushed_at":"2023-09-15T20:25:42.000Z","size":47,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T12:17:56.208Z","etag":null,"topics":["cli","markdown","table-of-contents","table-of-contents-generator"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jar-b/mdtoc","language":"Go","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/jar-b.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-05-14T04:28:32.000Z","updated_at":"2023-06-29T20:41:25.000Z","dependencies_parsed_at":"2024-06-21T02:05:45.450Z","dependency_job_id":"20a6dc55-935c-4b5c-aab5-d14bc94d3c95","html_url":"https://github.com/jar-b/mdtoc","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/jar-b/mdtoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jar-b%2Fmdtoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jar-b%2Fmdtoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jar-b%2Fmdtoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jar-b%2Fmdtoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jar-b","download_url":"https://codeload.github.com/jar-b/mdtoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jar-b%2Fmdtoc/sbom","scorecard":{"id":505941,"data":{"date":"2025-08-11","repo":{"name":"github.com/jar-b/mdtoc","commit":"deb833883518846b72fdb711f35fa5d795e0a3ba"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/jar-b/mdtoc/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jar-b/mdtoc/build.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T23:14:52.952Z","repository_id":45271901,"created_at":"2025-08-19T23:14:52.952Z","updated_at":"2025-08-19T23:14:52.952Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28620572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"ssl_error","status_checked_at":"2026-01-20T23:47:29.996Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["cli","markdown","table-of-contents","table-of-contents-generator"],"created_at":"2024-10-05T20:40:54.665Z","updated_at":"2026-01-21T01:02:00.340Z","avatar_url":"https://github.com/jar-b.png","language":"Go","readme":"# mdtoc\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/jar-b/mdtoc)\n[![build](https://github.com/jar-b/mdtoc/actions/workflows/build.yml/badge.svg)](https://github.com/jar-b/mdtoc/actions/workflows/build.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jar-b/mdtoc)](https://goreportcard.com/report/github.com/jar-b/mdtoc)\n[![Go Reference](https://pkg.go.dev/badge/github.com/jar-b/mdtoc.svg)](https://pkg.go.dev/github.com/jar-b/mdtoc)\n\nGenerate a table of contents for an existing markdown document. The table of contents will link to anchor tags, and preserve the level of nesting. \n\n\n\u003c!--mdtoc: begin--\u003e\n* [CLI](#cli)\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [Examples](#examples)\n* [Library](#library)\n  * [Usage](#usage-1)\n\u003c!--mdtoc: end--\u003e\n## CLI\n\n### Installation\n\nVia `go install`:\n\n```sh\ngo install github.com/jar-b/mdtoc/cmd/mdtoc@latest\n```\n\n### Usage\n\n```\n$ mdtoc -h\nGenerate a table of contents for an existing markdown document.\n\nUsage: mdtoc [flags] [filename]\n\nFlags:\n  -dry-run\n        print generated contents, but do not write to file (optional)\n  -force\n        force overwrite of existing contents (optional)\n  -out string\n        output file (optional, defaults to adding to source file)\n  -toc-heading string\n        contents heading (-with-toc-heading must be specified) (default \"Table of Contents\")\n  -version\n        display version\n  -with-toc-heading\n        include a heading with the generated contents (optional)\n```\n\n### Examples\n\n```sh\n# add new\nmdtoc mydoc.md\n\n# dry run\nmdtoc -dry-run mydoc.md\n\n# force overwrite of existing\nmdtoc -force mydoc.md\n\n# redirect output to new document\nmdtoc -out other.md mydoc.md\n\n# with custom heading\nmdtoc -with-toc-heading -toc-heading \"document stuff\" mydoc.md\n```\n\n## Library\n\n`import github.com/jar-b/mdtoc`\n\n### Usage\n\n```go\npackage main\n\nimport (\n        \"fmt\"\n\n        \"github.com/jar-b/mdtoc\"\n)\n\nfunc main() {\n        b := []byte(\"# Title\\ndescription text\\n\\n## Heading 1\\ntext\\n## Heading 2\\nmore text\")\n\n        // extract just the proposed TOC (\"dry-run\")\n        toc, _ := mdtoc.New(b)\n        fmt.Println(toc.String())\n\n        // OR insert TOC into an existing document\n        out, _ := mdtoc.Insert(b, mdtoc.DefaultConfig)\n        fmt.Println(string(out))\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjar-b%2Fmdtoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjar-b%2Fmdtoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjar-b%2Fmdtoc/lists"}