\
+ let LangString { added_classes, compile_fail, should_panic, ignore, edition, .. } =
+ match kind {
+ CodeBlockKind::Fenced(ref lang) => {
+ let parse_result = LangString::parse_without_check(
+ lang,
+ self.check_error_codes,
+ false,
+ self.custom_code_classes_in_docs,
+ );
+ if !parse_result.rust {
+ let added_classes = parse_result.added_classes;
+ let lang_string = if let Some(lang) = parse_result.unknown.first() {
+ format!("language-{}", lang)
+ } else {
+ String::new()
+ };
+ let whitespace = if added_classes.is_empty() { "" } else { " " };
+ return Some(Event::Html(
+ format!(
+ "
",
- added_classes = added_classes.join(" "),
- text = Escape(&original_text),
- )
- .into(),
- ));
+ added_classes = added_classes.join(" "),
+ text = Escape(&original_text),
+ )
+ .into(),
+ ));
+ }
+ parse_result
}
- parse_result
- }
- CodeBlockKind::Indented => Default::default(),
- };
+ CodeBlockKind::Indented => Default::default(),
+ };
- let added_classes = parse_result.added_classes;
let lines = original_text.lines().filter_map(|l| map_line(l).for_html());
let text = lines.intersperse("\n".into()).collect::
();
- compile_fail = parse_result.compile_fail;
- should_panic = parse_result.should_panic;
- ignore = parse_result.ignore;
- edition = parse_result.edition;
-
let explicit_edition = edition.is_some();
let edition = edition.unwrap_or(self.edition);