AmiFormat logo
Simple textile like web text generator done in Python

Introduction

  • AmiFormat is small. 600 lines of code vs. 1700 for MarkDown and 2800 for PyTextile.
  • AmiFormat is very simple and pretty fast.
  • Links, headings, code, lists, text style, images, paragraphs and line breaks are supported. The syntax looks a lot like Textile.
  • Support for plugins
  • AmiFormat is built to be mixed up with (X)HTML. With both MarkDown and Textile I personally encountered various bugs with (X)HTML.

AmiFormat syntax reference

Check out the online reference.

Example of use

This code:

from amiformat import amiformat

def commentHandler(args):
    if args.has_key('color'):
        return True, '<div style="color: %(color)s">%(data)s</div>'  % args

parser = amiformat.AmiFormat()
parser.registerMLPlugin('comment', commentHandler)
text = """
h2. Test
Here is a red comment:
[comment, color=red]
I am red
[/comment]"""
print parser.htmlFormat(text)

Outputs:

<h2>Just a test</h2>

<p>
Here is a red comment:
</p>
<div style="color: red">I am red</div>

Download

Change log

  • Version 2.2 - 29. April 2007
    - Added [quote]...[/quote] (which inserts blockquote)
  • Version 2.1 - 2. February 2007
    - Added support for http:// links
    - Small bug fixes (here and there, look in test_amiformat.py for the concrete bugs)
  • Version 2.0 - 23. December 2006
    - Rewritten everything from scratch, much cleaner and faster code
    - Added a plugin system
    - Added extra unit-tests
  • Version 1.5 - 14. August 2006
    - Bug fixes, but I haven't kept track on them.
    - Added [escape]...
  • Version 1.2 - 21. June 2006
    - Bug fixes, but I haven't kept track on them.
  • Version 1.1 - 22. May 2006
    - Support for %(b) %(i) Hello%% etc. added
  • Version 1.0 - 1. May 2006
    - Initial release
Powered by Skeletonz