@@ -1193,6 +1193,7 @@ crate struct RustCodeBlock {
1193
1193
crate code : Range < usize > ,
1194
1194
crate is_fenced : bool ,
1195
1195
crate syntax : Option < String > ,
1196
+ crate is_ignore : bool ,
1196
1197
}
1197
1198
1198
1199
/// Returns a range of bytes for each code block in the markdown that is tagged as `rust` or
@@ -1208,7 +1209,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1208
1209
1209
1210
while let Some ( ( event, offset) ) = p. next ( ) {
1210
1211
if let Event :: Start ( Tag :: CodeBlock ( syntax) ) = event {
1211
- let ( syntax, code_start, code_end, range, is_fenced) = match syntax {
1212
+ let ( syntax, code_start, code_end, range, is_fenced, is_ignore ) = match syntax {
1212
1213
CodeBlockKind :: Fenced ( syntax) => {
1213
1214
let syntax = syntax. as_ref ( ) ;
1214
1215
let lang_string = if syntax. is_empty ( ) {
@@ -1219,6 +1220,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1219
1220
if !lang_string. rust {
1220
1221
continue ;
1221
1222
}
1223
+ let is_ignore = lang_string. ignore != Ignore :: None ;
1222
1224
let syntax = if syntax. is_empty ( ) { None } else { Some ( syntax. to_owned ( ) ) } ;
1223
1225
let ( code_start, mut code_end) = match p. next ( ) {
1224
1226
Some ( ( Event :: Text ( _) , offset) ) => ( offset. start , offset. end ) ,
@@ -1229,6 +1231,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1229
1231
range : offset,
1230
1232
code,
1231
1233
syntax,
1234
+ is_ignore,
1232
1235
} ) ;
1233
1236
continue ;
1234
1237
}
@@ -1239,14 +1242,15 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1239
1242
range : offset,
1240
1243
code,
1241
1244
syntax,
1245
+ is_ignore,
1242
1246
} ) ;
1243
1247
continue ;
1244
1248
}
1245
1249
} ;
1246
1250
while let Some ( ( Event :: Text ( _) , offset) ) = p. next ( ) {
1247
1251
code_end = offset. end ;
1248
1252
}
1249
- ( syntax, code_start, code_end, offset, true )
1253
+ ( syntax, code_start, code_end, offset, true , is_ignore )
1250
1254
}
1251
1255
CodeBlockKind :: Indented => {
1252
1256
// The ending of the offset goes too far sometime so we reduce it by one in
@@ -1258,9 +1262,10 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1258
1262
offset. end ,
1259
1263
Range { start : offset. start , end : offset. end - 1 } ,
1260
1264
false ,
1265
+ false ,
1261
1266
)
1262
1267
} else {
1263
- ( None , offset. start , offset. end , offset, false )
1268
+ ( None , offset. start , offset. end , offset, false , false )
1264
1269
}
1265
1270
}
1266
1271
} ;
@@ -1270,6 +1275,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1270
1275
range,
1271
1276
code : Range { start : code_start, end : code_end } ,
1272
1277
syntax,
1278
+ is_ignore,
1273
1279
} ) ;
1274
1280
}
1275
1281
}
0 commit comments