Plim Documentation

Plim is a Python port of Ruby’s Slim template language built on top of Mako Templates. It uses Mako’s preprocessor feature to translate its syntax into a valid HTML/Mako markup.


pip install Plim


Plim provides an extensive test suite based on nosetests. You can run the tests with the following command

python nosetests

Coverage statistics are available online.

Detailed example

/ base.html
doctype html
html = next.body()
/ helpers.html
-def other_headers()
    meta charset="utf-8"
    link rel="stylesheet" href="/static/css/main.css"
/ layout.html
-inherit base.html
-namespace name="helper" helpers.html

  title Plim Example
  meta name="keywords" content="template language"
  = helper.other_headers()

    /* "script" and "style" blocks do not require explicit literal indicator "|"  */

    body {

    /* SCSS/SASS extension */
    @option compress: no;
    .selector {
      a {
        display: block;
      strong {
        color: blue;

    # CoffeeScript extension
    square = (x) -> x * x

  h1 Markup examples
    p Nest by indentation
      p Mix raw HTML and Plim markup

      Use Markdown

      See the syntax on [this page][1].


      or Use reStructuredText

      See the syntax on `this page`_.

      .. _this page:

  -if items
    table: -for item in items: tr
      td =
      td = item.price
  -elif show_empty
    p No items found
    a href=request.route_url('items.add') =, _('Add items')

  -unless user.authenticated
    p Please, sign in.
    p Welcome, ${}!
      --- i = 0
          limit = 5

      -while i < limit
        li#idx-${i}.up: a href='#' title="Title" == i
        --- i += 1

      -until i < 0
        li#idx-${i}.down-${i}: a href='''#''' title="""Title""" ==, i
        --- i -= 1

    Copyright &copy; 2014.
    -include footer_links.html

= render('tracking_code')

Indices and tables