Github heading slug
github-heading-slug · version 1.0.0 · Text · free, no key needed
Generate GitHub-style heading anchors in order, including deterministic duplicate suffix allocation.
Use when you need to: generate GitHub heading anchors · slug markdown headings · allocate duplicate heading ids.
Decide before calling
Read the versioned contract and the supported scope below. Reuse github-heading-slug@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use github-heading-slug@1.0.0 for generate GitHub heading anchors. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- generate GitHub heading anchors
- slug markdown headings
- allocate duplicate heading ids
- GitHub anchor for headings
- make table of contents anchors
- deduplicate heading slugs
Not supported
- parse Markdown documents
- generic URL slug conventions
- percent-encode fragment identifiers
Behavior
- Matches the ordered slug and duplicate-allocation behavior documented by github-slugger 2.0.0; input is already-extracted heading text.
- Each base slug is lowercased, the exact generated github-slugger 2.0.0 removal table is applied, and every ASCII space becomes a hyphen.
- The first base slug is unsuffixed. Later collisions receive -1, -2, and so on while also avoiding anchors already allocated by literal headings.
- Occurrence state is fresh for every run; empty base slugs are permitted and duplicates become -1, -2, and so on.
Input
headings(array of string, required): min items 1; max items 256; each max length 4096
Output
anchors(array of string, required): min items 1; max items 256; each max length 4110
Limits
- max headings: 256
- max heading bytes: 4096
- max total bytes: 65536
Example
Request input:
{
"headings": [
"Hello, World!",
"Hello World",
"Hello World"
]
}
Response:
{
"result": {
"anchors": [
"hello-world",
"hello-world-1",
"hello-world-2"
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "github-heading-slug",
"version": "1.0.0",
"input": {
"headings": [
"Hello, World!",
"Hello World",
"Hello World"
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/github-heading-slug/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"headings":["Hello, World!","Hello World","Hello World"]}'
The machine-readable contract is at /v1/tools/github-heading-slug/versions/1.0.0.
CLI
node cli.mjs run github-heading-slug 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Citation record dedupe: Group duplicate CSL citation records by deterministic DOI or folded year|author|title match keys, in input order.
- Markdown sections chunk: Chunk a CommonMark document into sections at its top-level ATX and setext headings, with levels, paths and spans.
- Bleu ngrams count: Count BLEU clipped n-gram matches and totals per order for tokenized segments, with optional clipping tables.
- Bleu sentence components: Extract sentence BLEU statistics: clipped matches, n-gram totals, candidate and closest reference length.
- Text minhash cluster: Cluster near-duplicate texts by fixed-seed MinHash signatures, with estimated Jaccard per pair.
- Text near duplicates find: Find every pair of texts whose exact shingle Jaccard similarity reaches a threshold, in a fixed order.