Skip to content

cool-calm/collected-press

Repository files navigation

Collected Press

Render Markdown from any public GitHub repo or gist, handling syntax highlighting on the server.


Use Cases

  • Zero-build websites. As soon as you push changes to GitHub, it’s available to be directly served! No CMS, no build pipeline, and no dependencies to keep up to date.
  • Great for documentation websites. In fact, our own API docs use it.
  • Create a home page for your open source project — just load the Markdown readme alongside the code in your repo.

Principles

  • Service is stateless. Just uses HTTP. You pass in exactly what parameters you need: the GitHub repo, SHA, and path to the file you want to render.
  • Can be called from anywhere. Backends, frontends, JavaScript, Swift, Rust, C#, Golang…
  • Runs on the edge which means very low latency for end users so they get a great user experience.
  • Renders syntax highlighting for code blocks on the server. This means there’s no need to run highlight.js in your user’s browser, you just need to load the CSS.
  • Responses (will soon) be cached like a CDN.
  • Unique git tags or SHA must be used in URLs, as we can confidently cache those forever. Links like https://collected.press/github/facebook/react are redirected to a URL with the latest SHA like https://collected.press/github/facebook/react@6e2f38f3a4d58f11bbe86ca6f938c27767366967/. We do the equivalent of git fetch to get the latest HEAD SHA for you.

Examples

Rendered

These routes are conveniently short, and redirect to the latest SHA. Markdown and source code files are rendered as styled HTML.

Raw HTML

These routes have the prefix 1, and require a specific SHA. Markdown files are rendered as HTML without styles or any <head>.

Refs

Tech Stack

Local Development

npm ci
make dev
# Open http://localhost:4321