diff --git a/lib/markdown.awk b/lib/markdown.awk index e66a068..c6802c6 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) } + while (match(line, /`([^*]+)`/)) { + start = RSTART + end = RSTART + RLENGTH - 1 + # Build the result: before match, , content, , after match + line = substr(line, 1, start-1) "" substr(line, start+1, RLENGTH-2) "" substr(line, end+1) + } + return line } diff --git a/test/parser/test_md_parser.sh b/test/parser/test_md_parser.sh index 9b9a292..abb2623 100755 --- a/test/parser/test_md_parser.sh +++ b/test/parser/test_md_parser.sh @@ -116,7 +116,9 @@ declare -a tests=( "A link to [wikipedia](https://www.wikipedia.org)" "

A link to wikipedia

" - + "Inline Code" + $'A tiny variable `x`' + "

A tiny variable x

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