aboutsummaryrefslogtreecommitdiff
path: root/anki-card-template/card.js
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-01-26 16:28:51 +0100
committerlonkaars <loek@pipeframe.xyz>2023-01-26 16:28:51 +0100
commit4edaed3e2ea6c7091665c14e583d500652d744c0 (patch)
tree0c254e2317cca91966f7d5a9aed123f71a3c08b9 /anki-card-template/card.js
parentb08431560751855a4cc3783f3635004164dfbc1b (diff)
update readme and fix escaped backslash2.2.0
Diffstat (limited to 'anki-card-template/card.js')
-rw-r--r--anki-card-template/card.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/anki-card-template/card.js b/anki-card-template/card.js
index 15870fa..d39e7a0 100644
--- a/anki-card-template/card.js
+++ b/anki-card-template/card.js
@@ -72,8 +72,9 @@ function parseFormat(nodes) {
var escaped = input[i+1];
if (escaped == "n") { out += "<br>"; i++; continue; } // newline
if (escaped == "t") { out += "\t"; i++; continue; } // tab
- if (escaped == "*") { out += "*"; i++; continue; } // tab
- if (escaped == "_") { out += "_"; i++; continue; } // tab
+ if (escaped == "*") { out += "*"; i++; continue; } // bold
+ if (escaped == "_") { out += "_"; i++; continue; } // italic
+ if (escaped == "\\") { out += "\\"; i++; continue; } // literal backslash
}
// parse *test* into <b>test</b>
if (input[i] == "*") { bold = !bold; out += `<${bold ? "" : "/"}b>`; continue; }
@@ -99,6 +100,7 @@ function parseIndicators(nodes) {
if (escaped == "[") { out += "["; i++; continue; }
if (escaped == "]") { out += "]"; i++; continue; }
if (escaped == "-" && indicator) { content += "-"; i++; continue; }
+ if (escaped == "\\") { out += "\\"; i++; continue; }
}
if (input[i] == "[") { indicator = true; out += `<span class="indicator">`; continue; }
@@ -216,6 +218,7 @@ function parseDefinitions(nodes) {
if (escaped == ",") { out += ","; i++; continue; }
if (escaped == "(") { out += "("; i++; continue; }
if (escaped == ")") { out += ")"; i++; continue; }
+ if (escaped == "\\") { out += "\\"; i++; continue; }
}
// subtile brackets