mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 14:07:04 +00:00
rustdoc: Enable Markdown extensions when looking for doctests
We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
This commit is contained in:
parent
f06e5c1e35
commit
8b227a42fa
@ -721,7 +721,7 @@ pub(crate) fn find_codes<T: doctest::DocTestVisitor>(
|
||||
extra_info: Option<&ExtraInfo<'_>>,
|
||||
include_non_rust: bool,
|
||||
) {
|
||||
let mut parser = Parser::new(doc).into_offset_iter();
|
||||
let mut parser = Parser::new_ext(doc, main_body_opts()).into_offset_iter();
|
||||
let mut prev_offset = 0;
|
||||
let mut nb_lines = 0;
|
||||
let mut register_header = None;
|
||||
|
18
tests/rustdoc-ui/multi-par-footnote.rs
Normal file
18
tests/rustdoc-ui/multi-par-footnote.rs
Normal file
@ -0,0 +1,18 @@
|
||||
//@ check-pass
|
||||
//@ compile-flags:--test
|
||||
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
// Regression test for #139064.
|
||||
|
||||
/// Example
|
||||
///
|
||||
/// Footnote with multiple paragraphs[^multiple]
|
||||
///
|
||||
/// [^multiple]:
|
||||
/// One
|
||||
///
|
||||
/// Two
|
||||
///
|
||||
/// Three
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
5
tests/rustdoc-ui/multi-par-footnote.stdout
Normal file
5
tests/rustdoc-ui/multi-par-footnote.stdout
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
running 0 tests
|
||||
|
||||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
Loading…
Reference in New Issue
Block a user