Skip to main content

A lightweight template-driven markup language

Project description

Mau v3

Mau is a lightweight markup language heavily inspired by AsciiDoc, Asciidoctor and Markdown.

As I wasn't satisfied by the results I got with those tools I decided to try to write my own language and the tool to render it.

I am currently using Mau to render posts on my blog The Digital Cat and the online version of my book "Clean Architectures in Python". I also used it to transpile the code of the book to Markua, to be able to publish the book on Leanpub using their toolchain.

Quick start

To install Mau use pip

pip install mau

Then install at least one visitor plugin. You probably want to start with mau-html-visitor

pip install mau-html-visitor

To convert Mau sources into HTML just run

mau -i source.mau -o destination.html -f html

To use Mau in your tool you can run it programmatically

from mau import Mau, load_visitors

visitor_classes = load_visitors()

visitors = {i.format_code: i for i in visitor_classes}
visitor_class = visitors["html"]

mau = Mau(
    "path/of/the/source",
    visitor_class=visitor_class,
)

lexer = self._mau.run_lexer(text)
parser = self._mau.run_parser(lexer.tokens)
content = self._mau.process(parser.nodes, parser.environment)

if visitor_class.transform:
    content = visitor_class.transform(content)

Check out Mau documentation for further information.

Pelican plugin

There is a Pelican plugin that enables you to use Mau in your blog. Check it at https://github.com/pelican-plugins/mau-reader.

You can see the plugin in action at https://www.thedigitalcatonline.com/blog/2021/02/22/mau-a-lightweight-markup-language/ and on other pages in my blog.

Support

You may report bugs or missing features use the issues page. If you want to ask for help or discuss ideas use the discussions page

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mau-3.0.2.tar.gz (77.6 kB view details)

Uploaded Source

Built Distribution

mau-3.0.2-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

Details for the file mau-3.0.2.tar.gz.

File metadata

  • Download URL: mau-3.0.2.tar.gz
  • Upload date:
  • Size: 77.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for mau-3.0.2.tar.gz
Algorithm Hash digest
SHA256 9a840dafa16de501925531f5f3bdb89cdb79c5f6bf7e2124390d5972c443f4b6
MD5 02325256cddadd32147e68379e5e5f6c
BLAKE2b-256 e7b49f77fbec67132f1e7e9acc5543cb47df18072d2e8e22d4c65472cc0b3f58

See more details on using hashes here.

File details

Details for the file mau-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: mau-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 43.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for mau-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0dd32b85d02f87106d1c5989862326d224c13eb9f84e03f1d5b875edc09b8fd8
MD5 b27ab62f5d16ae20ca781af5e3f1d793
BLAKE2b-256 1a745bfcca4969b017934784e6b2271497cfd610d5c0e60718077de71f4b4609

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page