1.0.2 • Published 7 months ago

github-discussion-toc v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

github-discussion-toc

A script to generate a table of contents for a GitHub discussion.

The script finds all comments that begin with a level 3 heading (### My heading) and adds a table of contents with links to those headings to the top of the discussion.

CLI Usage

You need a GitHub personal access token with the public_repo scope for public repositories or the repo scope for private repositories.

GITHUB_TOKEN="<personal access token>" npx github-discussion-toc <discussion-url>

Module usage

import addTocToGitHubDiscussion from "github-discussion-toc";
import { Octokit } from "octokit";

const myOctokit = new Octokit({
  auth: process.env.GITHUB_TOKEN,
});
const myOwner = "octocat";
const myRepo = "hello-world";
const myDiscussionNumber = 123;

await addTocToGitHubDiscussion(myOctokit, myOwner, myRepo, myDiscussionNumber);

License

ISC

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

8 months ago