Re:Show HN: Mawkdown – (Toy) Markdown Parser in Awk
by asicsp on Sunday July 19, 2020 @12:25AM
(#23886995)
As far as I know, 'match' function is part of POSIX spec for awk. Only the third array argument is specific to gawk. So, this should work for any awk.
awk 'match($0, /^#+ /){l=RLENGTH-1; print "<h" l ">" substr($0,RLENGTH+1) "</h" l ">"}'
I checked it on https://awk.js.org/ and it did work
As you'll read on, you'll certainly find more areas for improvements, because this is pretty much based on an idea I had in the shower and then typed it out in a hour :)