This repository was archived by the owner on Oct 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -228,14 +228,17 @@ sf.format = function() {
228
228
for ( var i = 0 ; i < comments [ c ] . childNodes . length ; i ++ ) {
229
229
if ( comments [ c ] . childNodes [ i ] . nodeName == "#text" ) {
230
230
var p = document . createElement ( "span" ) ;
231
- p . innerHTML = " " + sf . parse ( comments [ c ] . childNodes [ i ] . data ) ;
231
+ p . innerHTML = " " + sf . parse ( comments [ c ] . childNodes [ i ] . data ) + " " ;
232
232
comments [ c ] . childNodes [ i ] . replaceWith ( p ) ;
233
233
}
234
234
}
235
235
}
236
236
}
237
237
238
238
sf . parseMD = function ( text ) {
239
+ // Allow asterisks in code block
240
+ text = text . replace ( / [ ` ] .+ [ ` ] / gm, function ( x ) { return x . replace ( / \* / gm, "*" ) } ) ;
241
+
239
242
text = text . replace ( / ` ` ` ( ( .| \n * ) * ?) ` ` ` / gm, "<code>$1</code>" ) ;
240
243
text = text . replace ( / ` ( .* ?) ` / g, "<code>$1</code>" ) ;
241
244
@@ -244,7 +247,7 @@ sf.parseMD = function(text) {
244
247
text = text . replace ( / \* ( .* ?) \* / g, "<i>$1</i>" ) ;
245
248
246
249
// Don't format links that already have a tag with them
247
- // Sorry, I cheated with both Stackoverflow :\
250
+ // Sorry, I cheated with Stackoverflow :\
248
251
// https://stackoverflow.com/a/8943487
249
252
text = text . replace ( / ( \b ( h t t p s ? | f t p | f i l e ) : \/ \/ [ - A - Z 0 - 9 + & @ # \/ % ? = ~ _ | ! : , . ; ] * [ - A - Z 0 - 9 + & @ # \/ % = ~ _ | ] ) / ig, "<a href='$1'>$1</a>" ) ;
250
253
You can’t perform that action at this time.
0 commit comments