Skip to content

Latest commit

Β 

History

History
55 lines (43 loc) Β· 2.09 KB

File metadata and controls

55 lines (43 loc) Β· 2.09 KB
title Colophon

Colophon

This site is a Parklife/Sinatra static site hosted on GitHub Pages, it's open source and contributions are welcome and appreciated.

I chose Sinatra because it provides an awful lot of useful functionality out-of-the-box and its concise syntax makes it incredibly easy to make a fully-working website -- the whole app is basically one file with very few lines of code.

I wrote Decant because it's what was missing from my Parklife party -- easy frontmatter-aware access to a directory of content files (Markdown in this case). Here's how it's used in this site:

# Define a model-like class to wrap the content.
Page = Decant.define(dir: 'content', ext: 'md') do
  # Declare a frontmatter convenience reader.
  frontmatter :title
end

# Now find the page and work with it.
page = Page.find('colophon')
page.content     # => "Colophon\n\nThis site is a"...
page.frontmatter # => {:title=>"Colophon"}
page.title       # => "Colophon"

Markdown is handled by Kramdown with syntax-highlighting by Rouge styled by Pygments. I added support for GitHub-style alert callouts by extending Kramdown.

Here are the different alert types (for development/debugging), the icons are from Heroicons:

Note

A note.

Tip

A tip.

Important

They can have...

Many paragraphs.

Warning

And contain:

  • any
  • other
  • Markdown

Caution

Including syntax-highlighted code blocks:

if I.should(:stay)
  I.ll(:only).be in("your way")
end