Skip to content

Commit 61d91eb

Browse files
Update doc.js
1 parent c0ec29c commit 61d91eb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/doc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ var prototype = node.derive({
150150
baseline: line.baseline,
151151
left,
152152
content: {
153+
// replace( /&(?!#?[a-z0-9]+;)/, '&' ) is to replace ampersand char with '&'
154+
// as `&` can't be rendered in an SVG text
155+
// The regex explainer https://regex101.com/r/4vhX9N/1
153156
text: text.run.text.trim().replace( /&(?!#?[a-z0-9]+;)/, '&' ) + ' '.repeat( word.space.length ),
154157
size: text.run.size || this.defaultFormatting.size,
155158
font: text.run.font || this.defaultFormatting.font,

0 commit comments

Comments
 (0)