FEATURE: Replace single dash arrows when the typographer is enabled. (#11730)
This commit is contained in:
parent
d0ef952af2
commit
9e25ab2e96
|
@ -1566,6 +1566,8 @@ var bar = 'bar';
|
|||
enabledTypographer,
|
||||
"<p> \u2192 \u2190 </p>"
|
||||
);
|
||||
assert.cookedOptions("a -> b", enabledTypographer, "<p>a \u2192 b</p>");
|
||||
assert.cookedOptions("a <- b", enabledTypographer, "<p>a \u2190 b</p>");
|
||||
assert.cookedOptions("a --> b", enabledTypographer, "<p>a \u2192 b</p>");
|
||||
assert.cookedOptions("-->", enabledTypographer, "<p> \u2192 </p>");
|
||||
assert.cookedOptions("<--", enabledTypographer, "<p> \u2190 </p>");
|
||||
|
|
|
@ -6,7 +6,7 @@ function replaceArrows(state) {
|
|||
continue;
|
||||
}
|
||||
|
||||
const arrowsRegexp = /-->|<--/;
|
||||
const arrowsRegexp = /-->|<--|->|<-/;
|
||||
if (arrowsRegexp.test(token.content)) {
|
||||
for (let ci = 0; ci < token.children.length; ci++) {
|
||||
let child = token.children[ci];
|
||||
|
@ -14,8 +14,8 @@ function replaceArrows(state) {
|
|||
if (child.type === "text") {
|
||||
if (arrowsRegexp.test(child.content)) {
|
||||
child.content = child.content
|
||||
.replace(/(^|\s)-->(\s|$)/gm, "\u0020\u2192\u0020")
|
||||
.replace(/(^|\s)<--(\s|$)/gm, "\u0020\u2190\u0020");
|
||||
.replace(/(^|\s)-{1,2}>(\s|$)/gm, "\u0020\u2192\u0020")
|
||||
.replace(/(^|\s)<-{1,2}(\s|$)/gm, "\u0020\u2190\u0020");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue