Skip to content

joodaloop/pager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A single-page site builder with live reload, auto-linked headings, image aspect ratios, markdown support, and accessibility warnings.

All you need are these two files in any folder:

├── pager.yaml
└── pager.html

You set up your site details in pager.yaml like so:

title: My Site
description: A cool site
favicon: link-to-favicon.png
card: link-to-card.png
domain: example.com
port: 8080
css:
  - style.css
inject: '<!-- anything you want to add to the <head> of the page -->'

And pager.html contains your content:

<main>
  <h1> You don't even need <body> or <head> tags </h1>
  <p> Just write content, and whatever else you want </p>
  <figure>
    <img src="photo.jpg"/>
    <figcaption> Like images, etc. </figcaption>
  </figure>
</main>

Once you have both files, you can start the server by running pager inside the folder. This builds index.html and index.md, starts a server that live-reloads on any file change. So, finally:

├── index.html // GENERATED BY PAGER: your page, ready to deploy
├── index.md // GENERATED BY PAGER: your page as Markdown, ready to share
└── pager.html // your prose
├── pager.yaml // your site config

NOTE: Unlike what you might expect, the index.html and index.md files are not meant to be edited by you. They are generated from the pager.html file, which is the thing you should be editing.

Additional features

Apart from giving you good HTML skeleton from your config details, Pager also comes with...

Support for Tailwind CLI

If you have the Tailwind CLI or executable installed globally, adding a @import "tailwindcss"; to the beginning of any of your CSS files will auto-apply Tailwind's styling to your built site.

<convert> snippets

Convert markdown or CSV files to HTML with the <convert> tag:

<convert src="about.md" />
<convert src="data.csv" />
  • .md — converted to HTML elements
  • .csv — rendered as an HTML <table> (first row becomes <thead>)

Syntax highlighting

Embed any file as a syntax-highlighted code block with the <syntax> tag, with the language auto- detected from the file extension using chroma.

<syntax src="example.py" />
<syntax src="config.yaml" />

Table of contents

Add <toc /> anywhere in content.html to render a list of links to headings (level 2 to 4) in the page.

Misc.

  • Markdown page for LLMs to read/humans to copy — generates index.md with YAML frontmatter as a render-equivalent of the HTML page.
  • Headings without an id get an auto-generated id based on their text content: <h2>My Section</h2><h2 id="my-section">My Section</h2>
  • Images with a local src get aspect-ratio from actual file dimensions.
  • External links get target="_blank" and rel="noopener".
  • Local link checking — warns on <a href="#missing-id"> and <a href="missing-file.pdf">
  • Asset hashing — links to CSS files using content hashes query strings for cache busting.
  • Warnings for missing alt text, icon-only links without aria-label, missing frontmatter fields, missing referenced files, title > 60 chars, description > 160 chars

Install

git clone https://github.com/youruser/pager.git
cd pager
go install

This places the pager binary in ~/go/bin. Make sure it's in your PATH:

# add to your ~/.zshrc or ~/.bashrc if not already there
export PATH=$PATH:$HOME/go/bin

Usage

We have a small set of CLI commands, and all you really need in practice is the pager command.

Create a new site:

pager new mysite
cd mysite

This is optional, Pager will work in any folder that has a pager.html and pager.yaml file, and you can arrange everything else however you like. This command just scaffolds my preferred structure to get you up and running.

Run the dev server:

pager

This builds index.html and index.md, starts a server that live-reloads on any file change.

Use -p for a different port:

pager -p 3000

Plain build:

pager build

Builds index.html and index.md without starting the server.

About

The best way to handwrite index.html sites, according to me.

Topics

Resources

Stars

Watchers

Forks

Contributors