@@ -250,8 +250,8 @@ sub add ($self, $string, $mode = 'inline') {
250250 # Determine what the image's "number" is.
251251 if ($useCache ) {
252252 $imageNum = $self -> {equationCache }-> lookup($realString );
253- $aligntag = ' MaRkEr ' . $imageNum if $self -> {useMarkers };
254- $depths -> {$imageNum } = ' none' if $self -> {store_depths };
253+ $aligntag = qq{ data-imagegen-alignment-marker=" $imageNum " } if $self -> {useMarkers };
254+ $depths -> {$imageNum } = ' none' if $self -> {store_depths };
255255 # Insert a slash after 2 characters. This effectively divides the images into 16^2 = 256 subdirectories.
256256 substr ($imageNum , 2, 0) = ' /' ;
257257 } else {
@@ -461,11 +461,16 @@ sub fix_markers ($self) {
461461
462462 my %depths = %{ $self -> {depths } };
463463 for my $depthkey (keys %depths ) {
464+ # The data-imagegen-alignment-marker value may be quoted with double quotes or with " if the image is
465+ # inside another HTML element attribute (such as for images in the feedback button). So both quote types need
466+ # to be checked, and the replaced style attribute needs to use the same quoting that it comes in with.
464467 if ($depths {$depthkey } eq ' none' ) {
465- ${ $self -> {body_text } } =~ s / MaRkEr$depthkey/ style="vertical-align:$self ->{dvipng_align}"/ g ;
468+ ${ $self -> {body_text } } =~
469+ s / data-imagegen-alignment-marker=("|")$depthkey\1 / style=$1vertical-align:$self ->{dvipng_align}$1 / g ;
466470 } else {
467471 my $ndepth = 0 - $depths {$depthkey };
468- ${ $self -> {body_text } } =~ s / MaRkEr$depthkey/ style="vertical-align:${ndepth} px"/ g ;
472+ ${ $self -> {body_text } } =~
473+ s / data-imagegen-alignment-marker=("|")$depthkey\1 / style=$1vertical-align:${ndepth} px$1 / g ;
469474 }
470475 }
471476 return ;
0 commit comments