addint backticks for inline code parsing

This commit is contained in:
simonpetit 2024-12-09 15:25:16 +00:00
parent a4d03c8e8d
commit 86042d597c

View File

@ -45,6 +45,14 @@ function replaceInline(line, result, start, end) {
# Build the result: before match, <em>, content, </em>, after match
line = substr(line, 1, start-1) "<em>" substr(line, start+1, RLENGTH-2) "</em>" substr(line, end+1)
}
# Replace occurrences of `...` with <code>...</code>
while (match(line, /`([^`]+)`/)) {
start = RSTART
end = RSTART + RLENGTH - 1
# Build the result: before match, <em>, content, </em>, after match
line = substr(line, 1, start-1) "<code>" substr(line, start+1, RLENGTH-2) "</code>" substr(line, end+1)
}
# Replace occurances of [link](url) with <a href="url">link</<a>
while (match(line, /\[([^\]]+)\]\([^\)]+\)/)) {