Skip to content

Commit b02cea6

Browse files
committed
try this
1 parent 4f9b2b0 commit b02cea6

File tree

1 file changed

+5
-3
lines changed
  • packages/site-kit/src/lib/markdown

1 file changed

+5
-3
lines changed

packages/site-kit/src/lib/markdown/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function smart_quotes(
7070
if (html && char === '&') {
7171
if (str.slice(index, index + 5) === ''') {
7272
const left: boolean =
73-
((first && stack.at(-1) !== "'") || (index > 1 && before === '=')) &&
73+
((first && before === '') || stack.at(-1) !== "'" || (index > 1 && before === '=')) &&
7474
!opening_squo_chars.test(before);
7575
res += `&${left ? 'l' : 'r'}squo;`;
7676
index += 4;
@@ -81,7 +81,9 @@ export function smart_quotes(
8181
}
8282
} else if (str.slice(index, index + 6) === '"') {
8383
const left: boolean =
84-
(first && stack.at(-1) !== '"') || (index > 1 && str.charAt(index - 1) === '=');
84+
(first && before === '') ||
85+
stack.at(-1) !== '"' ||
86+
(index > 1 && str.charAt(index - 1) === '=');
8587
res += `&${left ? 'l' : 'r'}dquo`;
8688
index += 5;
8789
if (!left) {
@@ -94,7 +96,7 @@ export function smart_quotes(
9496
}
9597
} else if (!html && (char === '"' || char === "'")) {
9698
let left: boolean =
97-
((first && stack.at(-1) !== char) || (index > 1 && before === '=')) &&
99+
((first && before === '') || stack.at(-1) !== char || (index > 1 && before === '=')) &&
98100
!(char === "'" && !opening_squo_chars.test(before));
99101
let double = char === '"';
100102
res += double ? (left ? '“' : '”') : left ? '‘' : '’';

0 commit comments

Comments
 (0)