Collected.Press API

We serve a read-only transformation of public GitHub repos. It is provided with no warranty.

View GitHub Repo

Fetches the HEAD and redirects to include its SHA.

For example:

Styled GitHub Repo File


Renders a file within a GitHub repo.

Markdown (file extension .md)

If the file is Markdown, then it is rendered as HTML. Syntax highlighting is done using highlight.js. This HTML has no <head> or <body>, and is designed for you to provide your own CSS, meta tags, links, and so on.

Images (MIME type image/*)

Images are presented within an HTML page, loading from their corresponding jsdelivr URL.

Other file types

Other file types are wrapped in Markdown fenced code blocks using the file extension as the language. This is then rendered to HTML like any other Markdown.

For example a style.css file will get transformed into:

CONTENTS OF style.css

GitHub Repo Directory

Renders a list of files fetched from jsdelivr.

Unstyled GitHub Repo File


Renders a file within a GitHub repo without a <head> or any styles. This makes it a good fit for being loaded by an edge worker, where you can prepend your own <head> and styles.

Get Latest GitHub HEAD Ref


Get the latest SHA of the default branch, which is usually main.

This is equivalent to running git ls-remote --symref HEAD in your shell.

You can use this SHA in any route that accepts them.

For example, here is the result for facebook/react:

  "sha": "a4bc8ae4c1db471bb34d908dd890a09d4c774303",
  "HEADRef": "refs/heads/main"



Renders the latest version of the readme.

It does this by:

  1. It reads the HEAD ref’s SHA from the RoyalIcing/collected-press GitHub repo.
  2. It loads the Markdown for the file at that SHA.
  3. It renders that Markdown to HTML.
  4. It links to CSS inside a HTML <head> with the rendered Markdown inside a <body>.