File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/site-kit/src/lib/markdown Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export function smart_quotes(
70
70
if ( html && char === '&' ) {
71
71
if ( str . slice ( index , index + 5 ) === ''' ) {
72
72
const left : boolean =
73
- ( ( first && stack . at ( - 1 ) !== "'" ) || ( index > 1 && before === '=' ) ) &&
73
+ ( ( first && before === '' ) || stack . at ( - 1 ) !== "'" || ( index > 1 && before === '=' ) ) &&
74
74
! opening_squo_chars . test ( before ) ;
75
75
res += `&${ left ? 'l' : 'r' } squo;` ;
76
76
index += 4 ;
@@ -81,7 +81,9 @@ export function smart_quotes(
81
81
}
82
82
} else if ( str . slice ( index , index + 6 ) === '"' ) {
83
83
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 ) === '=' ) ;
85
87
res += `&${ left ? 'l' : 'r' } dquo` ;
86
88
index += 5 ;
87
89
if ( ! left ) {
@@ -94,7 +96,7 @@ export function smart_quotes(
94
96
}
95
97
} else if ( ! html && ( char === '"' || char === "'" ) ) {
96
98
let left : boolean =
97
- ( ( first && stack . at ( - 1 ) !== char ) || ( index > 1 && before === '=' ) ) &&
99
+ ( ( first && before === '' ) || stack . at ( - 1 ) !== char || ( index > 1 && before === '=' ) ) &&
98
100
! ( char === "'" && ! opening_squo_chars . test ( before ) ) ;
99
101
let double = char === '"' ;
100
102
res += double ? ( left ? '“' : '”' ) : left ? '‘' : '’' ;
You can’t perform that action at this time.
0 commit comments