1
- import repeat from 'repeat-string'
2
1
import { longestStreak } from 'longest-streak'
3
2
import safe from 'mdast-util-to-markdown/lib/util/safe.js'
4
3
@@ -100,7 +99,7 @@ function exitMathData(token) {
100
99
101
100
function math ( node , _ , context ) {
102
101
var raw = node . value || ''
103
- var fence = repeat ( '$' , Math . max ( longestStreak ( raw , '$' ) + 1 , 2 ) )
102
+ var fence = '$' . repeat ( Math . max ( longestStreak ( raw , '$' ) + 1 , 2 ) )
104
103
var exit = context . enter ( 'mathFlow' )
105
104
var value = fence
106
105
var subexit
@@ -131,9 +130,7 @@ function inlineMath(node) {
131
130
// If there is a single dollar sign on its own in the math, use a fence of
132
131
// two.
133
132
// 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 ) ) {
137
134
size ++
138
135
}
139
136
@@ -147,7 +144,7 @@ function inlineMath(node) {
147
144
pad = ' '
148
145
}
149
146
150
- sequence = repeat ( '$' , size )
147
+ sequence = '$' . repeat ( size )
151
148
return sequence + pad + value + pad + sequence
152
149
}
153
150
0 commit comments