adding inline code processing
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
adf285d723
commit
75fa01d972
@ -61,6 +61,13 @@ function replaceInline(line, result, start, end) {
|
|||||||
line = substr(line, 1, start-1) "<a href=\"" matched_url "\">" matched_link "</a>" substr(line, end+1)
|
line = substr(line, 1, start-1) "<a href=\"" matched_url "\">" matched_link "</a>" substr(line, end+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Replace occurences of `...` with <code>...</code>
|
||||||
|
while (match(line, /`(.+)`/)) {
|
||||||
|
start = RSTART
|
||||||
|
end = RSTART + RLENGTH - 1
|
||||||
|
line = substr(line, 1, start-1) "<code>" substr(line, start+1, RLENGTH-2) "</code>" substr(line, end+1)
|
||||||
|
}
|
||||||
|
|
||||||
return line
|
return line
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +142,7 @@ function closeOne() {
|
|||||||
|
|
||||||
|
|
||||||
# Matching a simple paragraph
|
# Matching a simple paragraph
|
||||||
!/^(#|\*|-|\+|>|`|$|\t| )/ {
|
!/^(#|\*|-|\+|>|$|\t| )/ {
|
||||||
env = last()
|
env = last()
|
||||||
if (env == "none") {
|
if (env == "none") {
|
||||||
# If no block, print a paragraph
|
# If no block, print a paragraph
|
||||||
|
@ -116,6 +116,10 @@ declare -a tests=(
|
|||||||
"A link to [wikipedia](https://www.wikipedia.org)"
|
"A link to [wikipedia](https://www.wikipedia.org)"
|
||||||
"<p>A link to <a href=\"https://www.wikipedia.org\">wikipedia</a></p>"
|
"<p>A link to <a href=\"https://www.wikipedia.org\">wikipedia</a></p>"
|
||||||
|
|
||||||
|
"Inline code"
|
||||||
|
$'`a code block`'
|
||||||
|
"<p><code>a code block</code></p>"
|
||||||
|
|
||||||
|
|
||||||
# You can add more test cases following the same format...
|
# You can add more test cases following the same format...
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user