Skip to content

Instantly share code, notes, and snippets.

@oofdere
Last active November 28, 2021 09:04
Show Gist options
  • Save oofdere/01a1f9b1aec4835f20ae9a8f3dd46bbb to your computer and use it in GitHub Desktop.
Save oofdere/01a1f9b1aec4835f20ae9a8f3dd46bbb to your computer and use it in GitHub Desktop.
yabe

yabe

A static site generator that does the bare minimum.

what makes yabe different from other SSGs?

yabe is highly opinionated. You don't get to choose youe templating or content languages. You will use Markdown and you will be happy. You will use Git and you will be happy. There's no preview server (for now); stop being so lazy.

yabe is written in the latest C standard and should compile with any C compiler. In its vanilla form, so long as you clone the repository with submodules, you should not need any other dependencies. This makes yabe ridiculously portable; it will run on anything with enough memory and input/output support.

how does yabe work?

yabe works like C.

  1. It starts by preprocessing your content, adding any mixins/includes/drops you've put into your content and templates.
  2. Next, your content is compiled from Markdown to HTML.
  3. Then, the content and templates are linked together into one big, happy, static website.

folder structure

  • site-name/
    • content/
      • YYYY-MM-DD-post-title.md
    • layout/
    • drops/
      • init.c is run before anything else.
      • compile.c is run right before compiling.
      • link.c is run right before linking.
      • wrap.c is run at the very end.

isn't this extremely redundant?

Yes, a lot of work gets thrown away each time a site is updated. Fixing this is as easy as checking if a file has changed since the last update, and if it hasn't, skipping it. Thus, it is not a major concern.

A lot of this could also be multithreaded, since it goes one file at a time.

how much memory do I need?

You need as much memory as the two biggest files in your project combined, plus 10%.

this doesn't sound very extendable

You can easily add your own C code to do things before and after each step. Support for other languages will follow if popularity grows.

To-do

  • Parse command line options
  • Markdown parser
  • Template parser
  • new option to generate directory structure
  • Mixins
  • RSS support
  • PWA support
  • BibTeX/Zotero citations
  • Desktop notification support
  • Dark mode helper
  • Web Monetization support
  • Compile-time validation (W3C, Lighthouse)
  • Compile only changes
  • Preview "server" (just a directory)
  • Github Actions support
  • Cloudflare Pages support
  • Auto-push to GitHub/GitLab/Cloudflare
  • Multi-language support (i18n)
  • Accessibility support (a11y)
  • Extended Markdown (furigana, charts, internal links, etc.)
  • Search support (clientside)
  • Filtering support (no JS)
  • SEO
  • GUI
  • Single-page option (falls back to default for clients without javascript)
  • Webhook support
  • Clientside API queries for dynamic content
  • Audio/video transcripts
  • Podcast RSS
  • Pandoc support
  • Fountain support
  • Rewrite in a lower level language (probably C)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment