Hello world!

This is my first website, built with my very own static website generator! I'm really excited to be able to use what I've built.

Well, I guess I'll use the rest of this page to tell you a bit more about the exciting parts of my project. (also maybe a bit about how satisfied I am with it)

You can find the code on my GitHub right here.

What it does

From a user standpoint, this project accomplishes three main things:

How it does what it does

To get a little more involved with the code, here is how a simple page with a blue "Hello world!" text would look in my HTML DSL:

(html (body (p :attrs (:style "color: blue;") "Hello world!")))

...which generates:

<html><body><p style="color:blue"> Hello world! </p></body></html>

Well, at first this may not look any different than regular HTML, but this has a few advantages that regular HTML doesn't:

The last two points are especially important, because that's the part that lets us generate static web pages from a template and markdown file, and does so elegantly.

Essentially, the template is first evaluated as Common Lisp code. The template, while being evaluated (or executed, in this context), executes code that reads and processes the markdown file. However the code that tokenizes, parses and then evaluates the markdown file itself makes use of even more Common Lisp code that generates HTML code, which is how we're able to turn (or compile) *text* into <i>text</i>, then place it in a template where it becomes part of an entire page with proper styling and everything!

It's quite amazing, isn't it?

Compiling Markdown

The next big component of my project is the Markdown compiler, which tokenizes, then parses the input markdown into an appropriate AST.

If you'd like some more details, here's how the transformation goes. Sorry if I'm detailing too much here, but I kind of want to show what I learnt here, so here we go...

The end result is that you can use this code: (process-markdown-string "*hello **world***")

... and it generates this string: "<p><i>hello <b>world</b></i></p>"

Or, if you think that was too simple of an example, take this page you're viewing right now. Yes, this page (along with the rest of the site) was generated with this very tool, you can view the source (both the markdown and the template) on my GitHub account.