@@ -1213,6 +1213,7 @@ crate struct RustCodeBlock {
1213
1213
crate code : Range < usize > ,
1214
1214
crate is_fenced : bool ,
1215
1215
crate syntax : Option < String > ,
1216
+ crate is_ignore : bool ,
1216
1217
}
1217
1218
1218
1219
/// Returns a range of bytes for each code block in the markdown that is tagged as `rust` or
@@ -1228,7 +1229,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1228
1229
1229
1230
while let Some ( ( event, offset) ) = p. next ( ) {
1230
1231
if let Event :: Start ( Tag :: CodeBlock ( syntax) ) = event {
1231
- let ( syntax, code_start, code_end, range, is_fenced) = match syntax {
1232
+ let ( syntax, code_start, code_end, range, is_fenced, is_ignore ) = match syntax {
1232
1233
CodeBlockKind :: Fenced ( syntax) => {
1233
1234
let syntax = syntax. as_ref ( ) ;
1234
1235
let lang_string = if syntax. is_empty ( ) {
@@ -1249,6 +1250,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1249
1250
range : offset,
1250
1251
code,
1251
1252
syntax,
1253
+ is_ignore : lang_string. ignore != Ignore :: None ,
1252
1254
} ) ;
1253
1255
continue ;
1254
1256
}
@@ -1259,14 +1261,15 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1259
1261
range : offset,
1260
1262
code,
1261
1263
syntax,
1264
+ is_ignore : lang_string. ignore != Ignore :: None ,
1262
1265
} ) ;
1263
1266
continue ;
1264
1267
}
1265
1268
} ;
1266
1269
while let Some ( ( Event :: Text ( _) , offset) ) = p. next ( ) {
1267
1270
code_end = offset. end ;
1268
1271
}
1269
- ( syntax, code_start, code_end, offset, true )
1272
+ ( syntax, code_start, code_end, offset, true , lang_string . ignore != Ignore :: None )
1270
1273
}
1271
1274
CodeBlockKind :: Indented => {
1272
1275
// The ending of the offset goes too far sometime so we reduce it by one in
@@ -1278,9 +1281,10 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1278
1281
offset. end ,
1279
1282
Range { start : offset. start , end : offset. end - 1 } ,
1280
1283
false ,
1284
+ false ,
1281
1285
)
1282
1286
} else {
1283
- ( None , offset. start , offset. end , offset, false )
1287
+ ( None , offset. start , offset. end , offset, false , false )
1284
1288
}
1285
1289
}
1286
1290
} ;
@@ -1290,6 +1294,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
1290
1294
range,
1291
1295
code : Range { start : code_start, end : code_end } ,
1292
1296
syntax,
1297
+ is_ignore,
1293
1298
} ) ;
1294
1299
}
1295
1300
}
0 commit comments