File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,19 @@ export default function text_join (state) {
2323 }
2424 }
2525
26- for ( curr = last = 0 ; curr < max ; curr ++ ) {
26+ for ( curr = last = 0 ; curr < tokens . length ; curr ++ ) {
2727 if ( tokens [ curr ] . type === 'text' &&
2828 curr + 1 < max &&
2929 tokens [ curr + 1 ] . type === 'text' ) {
3030 // collapse two adjacent text nodes
3131 tokens [ curr + 1 ] . content = tokens [ curr ] . content + tokens [ curr + 1 ] . content
32+
33+ // only move forward position when left token has content
34+ if ( tokens [ curr ] . content ) {
35+ tokens [ curr + 1 ] . position = tokens [ curr ] . position
36+ }
37+ // add up size
38+ tokens [ curr + 1 ] . size = ( tokens [ curr ] . size || 0 ) + ( tokens [ curr + 1 ] . size || 0 )
3239 } else {
3340 if ( curr !== last ) { tokens [ last ] = tokens [ curr ] }
3441
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ export default function escape (state, silent) {
6262
6363 token . markup = origStr
6464 token . info = 'escape'
65+ // size should reflect original source span (including backslash)
66+ token . size = origStr . length
6567 }
6668
6769 state . pos = pos + 1
You can’t perform that action at this time.
0 commit comments