diff --git a/markdown.awk b/markdown.awk index d4dc694..471006c 100644 --- a/markdown.awk +++ b/markdown.awk @@ -240,6 +240,22 @@ function escape_text(str) { return str; } +function extract_emphasis(str, i, sstr, arr, num, c) { + sstr=substr(str, i, length(str) - i + 1); + c = "" + + if (match(sstr, /^\*{1,3}[^\*]/)) { + c = "*"; + num = RLENGTH; + } + + if (match(sstr, /^_{1,3}[^_]/)) { + c = "_"; + num = RLENGTH; + } + +} + function parse_line(str, result, end, i, c) { result = "" @@ -383,9 +399,9 @@ function parse_block(str) { return parse_blockquote(str); } else if ( \ - match(str, /^[[:space:]]*\*[[:space:]]*\*[[:space:]]*\*[[:space:]]*$/) || - match(str, /^[[:space:]]*-[[:space:]]*-[[:space:]]*-[[:space:]]*$/) || - match(str, /^[[:space:]]*_[[:space:]]*_[[:space:]]*_[[:space:]]*$/)) { + match(str, /^([[:space:]]*\*){3,}[[:space:]]*$/) || + match(str, /^([[:space:]]*-){3,}[[:space:]]*$/) || + match(str, /^([[:space:]]*_){3,}[[:space:]]*$/)) { return "
"; } else if (match(str, /^[-+*][[:space:]]/) || match(str, /^[[:digit:]]\.[[:space:]]/)) { diff --git a/test.sh b/test.sh index 82a3010..25012bb 100755 --- a/test.sh +++ b/test.sh @@ -440,11 +440,14 @@ Horizontal rules: * * * _ _ _ + +******** ---

Horizontal rules:




+
EOF echo