diff --git a/lib/markdown.awk b/lib/markdown.awk index e66a068..ac66d06 100755 --- a/lib/markdown.awk +++ b/lib/markdown.awk @@ -61,6 +61,13 @@ function replaceInline(line, result, start, end) { line = substr(line, 1, start-1) "" matched_link "" substr(line, end+1) } + # Replace occurences of `...` with ... + while (match(line, /`(.+)`/)) { + start = RSTART + end = RSTART + RLENGTH - 1 + line = substr(line, 1, start-1) "" substr(line, start+1, RLENGTH-2) "" substr(line, end+1) + } + return line } @@ -135,7 +142,7 @@ function closeOne() { # Matching a simple paragraph -!/^(#|\*|-|\+|>|`|$|\t| )/ { +!/^(#|\*|-|\+|>|$|\t| )/ { env = last() if (env == "none") { # If no block, print a paragraph diff --git a/test/parser/test_md_parser.sh b/test/parser/test_md_parser.sh index 18873a7..c4d6430 100755 --- a/test/parser/test_md_parser.sh +++ b/test/parser/test_md_parser.sh @@ -116,6 +116,10 @@ declare -a tests=( "A link to [wikipedia](https://www.wikipedia.org)" "

A link to wikipedia

" + "Inline code" + $'`a code block`' + "

a code block

" + # You can add more test cases following the same format... )