detect markdown even when not at beginning of line (supports indentation)

This commit is contained in:
Jaromil 2015-01-29 18:28:15 +01:00
parent bf40ca63dc
commit df0a1ba05b
1 changed files with 2 additions and 2 deletions

4
render
View File

@ -236,8 +236,8 @@ render_html() {
# (a line starting with tmp.md$RAND)
tmp="tmp.$RANDOM"
awk 'BEGIN { srand(); markdown=0; }
/^<markdown>/ { markdown=1; out="tmp.md" rand(); print out; next }
/^<\/markdown>/ { markdown=0; next }
/<markdown>/ { markdown=1; out="tmp.md" rand(); print out; next }
/<\/markdown>/ { markdown=0; next }
{ if(markdown==1) { print $0 >out; next } else { print $0 } }
' > $tmp