Ur/Web bindings to the Sundown Markdown rendering library
C Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


ur-sundown: Ur/Web bindings to the Sundown library for Markdown


This library violates all the principles of type-safety found in Ur/Web, as it effectively contains a function of type string -> xml, and you should be ashamed for using it. It only exists in all its misfortune because I wanted to use it for my own blog code, so I could write markdown-formatted posts (and you basically have to treat a literal string as an XML fragment at some point, somewhere.)

If you're willing to be considered an awful person on some level by using this unholy piece of code, then please, read on and continue.

This is a library that lets Ur/Web programs render markdown from plaintext, via the Sundown C library.

To install it, you need Python to run waf (I've used 2.7.1 and pypy 1.6 on Ubuntu Natty.) You also need the Ur/Web compiler installed.

If you have that, then install by saying:

sudo ./waf configure build install -p

If you installed Ur/Web to some other directory when you compiled it, for example, $HOME, you need to use the --prefix flag:

./waf configure build install -p --prefix=$HOME

Otherwise it won't be able to find the Ur/Web C FFI #include files.

Afterwords, you can test it by doing:

$ cd t/
$ urweb testSundown
$ ./testSundown.exe
# browse to http://localhost:8080/


Ur/Web and Sundown are both pretty fast. But how fast? Using siege on the included testSundown program, we get the following results. Note, the testSundown HTTP server was started with 8 threads on my hyperthreaded, dual core core i5 (4 logical CPUs,) and Siege was launched with 8 concurrent connections over 5 minutes. The sundown library renders markdown to HTML for every page hit.

Starting server:

$ ./testSundown.exe -t 8


 $ siege -b -c8 -t5m http://localhost:8080/


Availability:                 100.00 %
Elapsed time:                 299.06 secs
Data transferred:            1048.13 MB
Response time:                  0.00 secs
Transaction rate:           12849.65 trans/sec
Throughput:                   3.50 MB/sec
Concurrency:                    5.47
Successful transactions:     3842818
Failed transactions:               0
Longest transaction:            0.03
Shortest transaction:           0.00

During this test, gnome-system-monitor reported testSundown.exe was consistently using ~520KiB of memory.