Antwerp
Antwerp is an open-source framework ported from JavaScript to Rust for GitHub pages and built with the Marcus HTML to MarkDown parser.
It outputs static web pages in dist/ using HTML and MarkDown templates in public/, which are converted to HTML using the Marcus MarkDown to HTML parser.
Demonstration:
Cargo.toml (Cargo.toml):
[]
= "<NAME>"
= "<VERSION>"
= "2021"
= "<DESCRIPTION>"
= "MIT"
= "README.md"
[]
= "0.3.1"
main.rs (src/main.rs):
use antwerp;
Input:
base.html (public/base.html):
{% block title | text | trim %}{% endblock title %}
{% block body %}
This paragraph serves as the default content for the body block.
{% endblock body %}
{% block footer | trim | text %}
# This is a header for the default footer (it won't get converted to HTML).
{% endblock footer %}
index.md (public/index.md):
{% extends "base.html" %}
{% block title %}Homepage{% endblock title %}
{% block body %}
This is the template, it contains a link to [a file](/section/chapter/file.html) in the first chapter of a random section and the default footer (below).
{% endblock body %}
file.md (public/section/chapter/file.md):
{% extends "base.html" %}
{% block title %}Section / Chapter / File{% endblock title %}
{% block body %}
This is the template, it takes you to [the homepage](/).
This page also includes CSS styles, which are ignored by the [Marcus](https://crates.io/crates/marcus) MarkDown to HTML converter.
{% endblock body %}
{% block footer %}
Output:
index.html (dist/index.html):
Homepage
Hello World!
This is the template, it contains a link to a file in the first chapter of a random section and the default footer (below).
# This is a header for the default footer (it won't get converted to HTML).
file.md (dist/section/chapter/file.md):
Section / Chapter / File
Hello World!
This is the template, it takes you to the homepage.
This page also includes CSS styles, which are ignored by the Marcus MarkDown to HTML converter.
This is a custom footer for the section / chapter / file page.
References:
Antwerp:
- https://crates.io/crates/antwerp
- https://github.com/Malekaia/Antwerp
- https://docs.rs/antwerp/latest/antwerp/
Marcus:
- https://crates.io/crates/marcus
- https://github.com/Malekaia/Marcus/
- https://docs.rs/marcus/latest/marcus/
MarkDown/HTML:
Licence:
The source code included in this repository is distributed, for free, under the MIT Licence, for the full license, see LICENSE.md.