Hacker News new | ask | show | jobs
by yiyus 1596 days ago
I used a similar technique for my awk markdown parser: https://github.com/yiyus/md2html.awk

An awk state machine is a quite straightforward way to deal with data like this log file. It is not so clear that this is the best way to write a relatively large piece of software, like a markdown parser (when I wrote md2html.awk in 2009, the standard md parser was the original one by John Gruber, written in Perl, so it actually was an improvement in code clarity, performance, and portability (we had no perl in Plan 9!), but nowadays it is easy to find much better solutions).

1 comments

Wow, I've bookmarked this.

I also wrote an Markdown to HTML converter in Awk once, though my purpose was to convert marked down comments in source code to documentation. I started with an Awk script to extract the comments and then systematically added markdown features. My end result isn't very elegant though.

https://github.com/wernsey/d.awk/blob/master/d.awk