Markdown update - use ports

7 views
Skip to first unread message

Bryan Fink

unread,
May 11, 2007, 8:42:21 AM5/11/07
to erlyweb
Hi all. I just wanted to mention that I found an easy way to get
Markdown support in Erlyweb - use ports.

I'm not at my development machine right now, so I don't have the code
available to post, but I think anyone here could easily follow these
directions to get their own version running:

1. Grab a copy of the Python Markdown implementation
<http://www.freewisdom.org/projects/python-markdown/>
2. Download the source for the port-writing tutorial on trapexit
<http://wiki.trapexit.org/index.php/
Writing_an_Erlang_Port_using_OTP_Principles>
3. Change the echo.py script to accept multiple lines, terminated by a
"separator line". Once you have the lines you need, call
markdown.markdown(Lines). Return the result the same way the echo
script would return its result.
4. You're basically done at this point (just clean up the rough edges
I've left you with). I also changed the "OK" that echo.py uses to
signal the end of the reply to something less likely to show up in a
normal block of text.

Now when you call echo:echo("String"), you'll get back XHTML based on
the Markdown you gave it.

I can post my code later tonight, if people want it. I'm no Python
guru, so it would be interesting to see how many gasps of horror my
code would generate. ;)

If you'd like proof that this is possible, and I'm not just making it
up, please check out the website I've put together at <http://
beerriot.com/>. Comment fields accept Markdown syntax. And, yes, the
whole site is built on Erlyweb (v0.5 - I haven't had time to try out
0.6 yet). :)

*fingers crossed that my virtual server can handle public knowledge*
-Bryan

Bryan Fink

unread,
May 11, 2007, 8:45:26 AM5/11/07
to erlyweb
Doh! I see that Google Groups doesn't understand the <url> syntax
like most mail readers. My apologies for the resultant ugliness.

-Bryan

Dmitrii 'Mamut' Dimandt

unread,
May 11, 2007, 10:56:32 AM5/11/07
to erl...@googlegroups.com

It works! :)

Reply all
Reply to author
Forward
0 new messages