File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -290,14 +290,27 @@ function normalizeReference(str) {
290290}
291291
292292function getLineOffset ( state ) {
293- if ( state . env . parentToken . parentType === 'blockquote' ) {
293+ if ( isInBlockquote ( state ) ) {
294294 const blockState = state . env . state_block ;
295295 return blockState . lineOffsets [ state . currentLine ] ?? 0 ;
296296 } else {
297297 return 0 ;
298298 }
299299}
300300
301+ function isInBlockquote ( state ) {
302+ let count = 0 ;
303+ for ( let i = state . env . parentTokenIndex ; i >= 0 ; i -- ) {
304+ const token = state . env . parentState . tokens [ i ] ;
305+ if ( token . type === 'blockquote_open' || token . type === 'alert_open' ) {
306+ count ++ ;
307+ } else if ( token . type === 'blockquote_close' || token . type === 'alert_close' ) {
308+ count -- ;
309+ }
310+ }
311+ return count > 0 ;
312+ }
313+
301314function trimLeftOffset ( str ) {
302315 return str . length - str . trimLeft ( ) . length ;
303316}
You can’t perform that action at this time.
0 commit comments