Magnanimous Gopher

Magnanimous

The friendliest website generator in the world!


Magnanimous generates static websites from source files really fast.

And it’s incredibly simple to use!

Features:

Simple templating mechanism based on a tiny expression language,

2 + 2 is {{ eval 2 + 2 }}

Compose snippets to create content.

{{ include _header.html }}
<h2>Content!</h2>
{{ include footer.html }}

Define variables for easy re-use.

{{ define title "Hello world" }}

Components and slots inspired by web components.

{{ component other-file.html }}
  {{ slot main }}Main content{{ end }}
{{ end }}

Conditional content.

{{ if title == "Home" }}We are home{{ end }}

For loops over files and variables.

{{ for file /path/to/files }}
* Post name: {{eval file.postName}}
{{end}}

markdown content automatically converted to HTML.

## Markdown is easy!

> Note

Source code highlighting in markdown.

```javascript
const hello = () => "Hello world";
```

1. Download the binary

Go to the releases page and download the binary for your OS.

2. Write some sources

How about some HTML fragments?!

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{{ eval title }}</title>
</head>
<body>
source/processed/_header.html
</body>
</html>
source/_footer.html

Add some markdown for comfortably writing content.

{{ define title "My Website" }}
{{ include /processed/_header.html }}
# This is my website

How awesome is it?!

{{ include /_footer.html }}
source/processed/index.md

3. Run magnanimous

$ magnanimous

Your website is ready on the target directory!

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My Website</title>
</head>
<body>

<h1>This is my website</h1>

<p>How awesome is it?!</p>

</body>
</html>
target/index.html

You might have noticed how some funny contents like {{ eval title }}, in the title tag, and {{ define title "My Website" }}, in the markdown file…

These are Magnanimous instructions, which let Magnanimous know when you want it to process files, which means doing things like including a file into another, or declaring values to be used elsewhere… the text inside the {{ and }} braces are evaluated using the Magnanimous expression language. But don’t worry! You can learn that in about 15 minutes!

Also notice that all markdown content is converted automatically to HTML! Magnanimous will even highlight source code blocks in pretty much any language, just provide the block language as you do on GitHub markdown:

```javascript
const magnanimous = () => "Awesome";
```

Head to the Documentation to learn more.