@@ -239,18 +239,22 @@ fn get_sequences(tokenizer: &mut Tokenizer) -> Vec<Sequence> {
239
239
let exit = & tokenizer. events [ end] ;
240
240
241
241
let marker = tokenizer. parse_state . bytes [ enter. point . index ] ;
242
- let before = classify_opt ( char_before_index (
243
- tokenizer. parse_state . bytes ,
244
- enter. point . index ,
245
- ) ) ;
246
- let after = classify_opt ( char_after_index (
247
- tokenizer. parse_state . bytes ,
248
- exit. point . index ,
249
- ) ) ;
242
+ let before_char = char_before_index ( tokenizer. parse_state . bytes , enter. point . index ) ;
243
+ let before = classify_opt ( before_char) ;
244
+ let after_char = char_after_index ( tokenizer. parse_state . bytes , exit. point . index ) ;
245
+ let after = classify_opt ( after_char) ;
250
246
let open = after == CharacterKind :: Other
251
- || ( after == CharacterKind :: Punctuation && before != CharacterKind :: Other ) ;
247
+ || ( after == CharacterKind :: Punctuation && before != CharacterKind :: Other )
248
+ // For regular attention markers (not strikethrough), the
249
+ // other attention markers can be used around them
250
+ || ( marker != b'~' && matches ! ( after_char, Some ( '*' | '_' ) ) )
251
+ || ( marker != b'~' && tokenizer. parse_state . options . constructs . gfm_strikethrough && matches ! ( after_char, Some ( '~' ) ) ) ;
252
252
let close = before == CharacterKind :: Other
253
- || ( before == CharacterKind :: Punctuation && after != CharacterKind :: Other ) ;
253
+ || ( before == CharacterKind :: Punctuation && after != CharacterKind :: Other )
254
+ || ( marker != b'~' && matches ! ( before_char, Some ( '*' | '_' ) ) )
255
+ || ( marker != b'~'
256
+ && tokenizer. parse_state . options . constructs . gfm_strikethrough
257
+ && matches ! ( before_char, Some ( '~' ) ) ) ;
254
258
255
259
sequences. push ( Sequence {
256
260
index,
0 commit comments