Skip to main content

Badges & shields

Readma renders a badge row under the readme header using shields.io, with reference-style markdown links so the header stays tidy. Every badge has an accessible name and points to the most useful URL (the issues badge links to the issue tracker, the release badge to the releases page, and so on).

Built-in badges​

All badges are enabled by default. Ids marked conditional only appear when they apply to your project.

IdBadgeLinks toCondition
registryJSR / NPM / Crates.io versionPackage pageconditional — see below
codecovCodecovCodecov page for the branchalways
contributorsContributorsContributors graphalways
forksForksNetwork membersalways
starsStargazersStargazers pagealways
commitActivityCommit activityCommits (weekly interval)always
actionsBranch action runsActions filtered on the branchalways
issuesIssuesIssues listalways
pullRequestsPull requestsPulls listalways
lastCommitLast commitCommits listalways
releaseReleaseReleases pagealways
licenseLicenseLicense file on masteralways
linkedinLinkedInProfile pageconditional — linkedinUsername set
msrvCrates MSRVCrates pageconditional — language: "rs"

The registry badge​

Rendered only when the registry/language combination is published:

languagepackageRegistryBadgeRequires
tsjsrJSR versiona workspace member
tsnpmNPM versiona workspace member
rscrates.ioCrates.io versionpackage name

Root readmes get no version badge (the root is rarely published); member readmes do.

Disabling badges​

badges: {
disabled: ["issues", "commitActivity"],
}

Passing an id in disabled removes it from the row — useful when a badge would be noisy (e.g. a private repo with zero stars) or redundant with your hosting platform UI.

Custom badges​

Custom badges are appended after the built-in ones:

badges: {
custom: [
{
name: "Sponsor",
image: "https://img.shields.io/badge/-Sponsor-purple",
link: "https://sponsor.me/my-project",
},
],
}
FieldMeaning
nameAccessible name, also used to derive the markdown reference
imageFull image URL (any shields.io style or arbitrary SVG)
linkURL the badge points to
tip

Mix built-in styling with custom badges by giving your image URLs the same style= query parameter as badgeStyle, so the row stays coherent.

Badge style​

badgeStyle: "flat-square"

Applies the shields.io style parameter to every badge, built-in and custom. Available styles: for-the-badge, social, flat, flat-square, plastic.

How badges are rendered​

Badges use markdown reference-style links. The header contains:

[![Codecov][codecov-shield]][codecov-url]
[![Stargazers][stars-shield]][stars-url]

and the footer carries the URL definitions, keeping the top of the file readable when the readme is edited by hand:

<!--MARKDOWN LINKS & IMAGES-->
[codecov-shield]: https://img.shields.io/codecov/c/github/elcoosp/readma/main.svg?style=flat-square&logo=codecov&logoColor=f5f5f5
[codecov-url]: https://codecov.io/github/elcoosp/readma/tree/main

The reference names are derived from the badge names with the same slug rules GitHub uses for anchors (kebab-case via paramCase).

Programmatic access​

The badge pipeline is exported from @readma/core if you want to reuse it:

import { shields, renderShields, shieldUrl } from "@readma/core";

const list = shields({
repoName: "readma",
repoUrl: "https://github.com/elcoosp/readma",
githubUsername: "elcoosp",
branch: "main",
commitActivityInterval: "w",
language: "ts",
});
const { shieldsBadges, shieldsRefs } = renderShields(list);