Skip to content

Commit 675bbea

Browse files
skotnicznymarijnh
authored andcommitted
Allow line break after single slash
1 parent 1fad1fe commit 675bbea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/render_latex.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ function escapeChar(ch) {
2828
case "~": return "\\textasciitilde "
2929
case "^": return "\\textasciicircum "
3030
case "\\": return "\\textbackslash "
31+
case "/": return "\/\\allowbreak "
3132
default: return "\\" + ch
3233
}
3334
}
3435
function escape(str) {
35-
return String(str).replace(/[&%$#_{}~^\\]/g, escapeChar)
36+
return String(str).replace(/[&%$#_{}~^\\]|\w(\/)\w/g, (match, group) => {
37+
if (group) return match[0] + escapeChar(group) + match[2]
38+
return escapeChar(match)
39+
})
3640
}
3741
function miniEscape(str) { return str.replace(/[`]/g, escapeChar) }
3842

0 commit comments

Comments
 (0)