Welcome to Slab

Slab is a programmable markup language that simplifies the creation of HTML. It combines concise notation with standard programming constructs to create reusable web content more efficiently.

A taste of Slab

Here's a quick example of Slab code and the resulting HTML. This shows how Slab can generate well-organized HTML with minimal effort.

frag page(titl)
  doctype html
  html
    head
      title= titl
    body
      h1= titl
      content

let t = "My first Slab page"
page(t)
  .main-content
    p Welcome to Slab! This is a simple example of how Slab works.
<!DOCTYPE HTML>

<html>
    <head>
        <title>
            My first Slab page
        </title>
    </head>
    <body>
        <h1>
            My first Slab page
        </h1>
        <div class="main-content">
            <p>
                Welcome to Slab! This is a simple example of how Slab works.
            </p>
        </div>
    </body>
</html>

Why Slab?

Slab offers several advantages over writing plain HTML or using other templating languages:

  • Concise syntax that reduces boilerplate and improves readability
  • Built-in programming constructs for conditionals, loops, and variable declarations
  • A fragment system that encourages code reuse and modularity
  • Seamless integration with JSON data for templating
  • A smooth learning curve for those familiar with HTML and basic programming concepts

Getting started

Ready to dive in? Here are some resources to help you get started with Slab:

Open source

Slab is an evolving open source project released under the terms of the 2-Clause BSD license. The source code and issue tracker are available on GitHub.