1- import repeat from 'repeat-string'
21import { longestStreak } from 'longest-streak'
32import safe from 'mdast-util-to-markdown/lib/util/safe.js'
43
@@ -100,7 +99,7 @@ function exitMathData(token) {
10099
101100function math ( node , _ , context ) {
102101 var raw = node . value || ''
103- var fence = repeat ( '$' , Math . max ( longestStreak ( raw , '$' ) + 1 , 2 ) )
102+ var fence = '$' . repeat ( Math . max ( longestStreak ( raw , '$' ) + 1 , 2 ) )
104103 var exit = context . enter ( 'mathFlow' )
105104 var value = fence
106105 var subexit
@@ -131,9 +130,7 @@ function inlineMath(node) {
131130 // If there is a single dollar sign on its own in the math, use a fence of
132131 // two.
133132 // If there are two in a row, use one.
134- while (
135- new RegExp ( '(^|[^$])' + repeat ( '\\$' , size ) + '([^$]|$)' ) . test ( value )
136- ) {
133+ while ( new RegExp ( '(^|[^$])' + '\\$' . repeat ( size ) + '([^$]|$)' ) . test ( value ) ) {
137134 size ++
138135 }
139136
@@ -147,7 +144,7 @@ function inlineMath(node) {
147144 pad = ' '
148145 }
149146
150- sequence = repeat ( '$' , size )
147+ sequence = '$' . repeat ( size )
151148 return sequence + pad + value + pad + sequence
152149}
153150
0 commit comments