#!/bin/awk -f mode == "pre" && !/^ / { mode = "" printf "" } # mode == "list" && !/^\* / { # mode = "" # print "" # } /^# / { printf "

%s

", substr($0, 3); next } /^## / { printf "

%s

", substr($0, 4); next } /^### / { printf"

%s

", substr($0, 5); next } /^> / { printf"
%s
", substr($0, 2); next } /^ / { if (mode != "pre") { printf "
"
				mode = "pre"
			} else {
				print ""
			}
			printf substr($0, 3)
			next
		}
NF != 0 { printf "

%s

", $0 } END { print "
" }