@@ -1213,6 +1213,7 @@ crate struct RustCodeBlock {
12131213 crate code : Range < usize > ,
12141214 crate is_fenced : bool ,
12151215 crate syntax : Option < String > ,
1216+ crate is_ignore : bool ,
12161217}
12171218
12181219/// 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
12281229
12291230 while let Some ( ( event, offset) ) = p. next ( ) {
12301231 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 {
12321233 CodeBlockKind :: Fenced ( syntax) => {
12331234 let syntax = syntax. as_ref ( ) ;
12341235 let lang_string = if syntax. is_empty ( ) {
@@ -1249,6 +1250,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12491250 range : offset,
12501251 code,
12511252 syntax,
1253+ is_ignore : lang_string. ignore != Ignore :: None ,
12521254 } ) ;
12531255 continue ;
12541256 }
@@ -1259,14 +1261,15 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12591261 range : offset,
12601262 code,
12611263 syntax,
1264+ is_ignore : lang_string. ignore != Ignore :: None ,
12621265 } ) ;
12631266 continue ;
12641267 }
12651268 } ;
12661269 while let Some ( ( Event :: Text ( _) , offset) ) = p. next ( ) {
12671270 code_end = offset. end ;
12681271 }
1269- ( syntax, code_start, code_end, offset, true )
1272+ ( syntax, code_start, code_end, offset, true , lang_string . ignore != Ignore :: None )
12701273 }
12711274 CodeBlockKind :: Indented => {
12721275 // 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
12781281 offset. end ,
12791282 Range { start : offset. start , end : offset. end - 1 } ,
12801283 false ,
1284+ false ,
12811285 )
12821286 } else {
1283- ( None , offset. start , offset. end , offset, false )
1287+ ( None , offset. start , offset. end , offset, false , false )
12841288 }
12851289 }
12861290 } ;
@@ -1290,6 +1294,7 @@ crate fn rust_code_blocks(md: &str, extra_info: &ExtraInfo<'_, '_>) -> Vec<RustC
12901294 range,
12911295 code : Range { start : code_start, end : code_end } ,
12921296 syntax,
1297+ is_ignore,
12931298 } ) ;
12941299 }
12951300 }
0 commit comments