Change:
I tried to document and publish my Windows crate to github pages. Things went pretty smooth until I opened the source code view. As you can see below, a newline is appended to each line doc comment, also no line number for each line: ! Here the render page on gh-pages: Beware that it has no version control for the generated doc. But the link here may work for a limited time before github purge the cache: Also here the the CI script I used: The same code published on is normal: : x86_64-pc-windows-msvc rustc 1.48.0-nightly ( 2020-09-04) modify labels: T-rustdoc
Could be related to normalization depending on the git checkout settings of the runner.
I set before , maybe this is my misconfigure somehow.
Try adding and possibly to make those files end with the right character.
Thanks Andy, I tried as you told but still the issue remains.
Oh, I meant for the source files, you might need to reconfigure git before checking out the source (and that's likely just a workaround, this seems likely to be a bug in rustdoc's handling of in source files).
Thank you, problem is solved in . I am pretty sure this issue is a duplicate of another, but I cannot find it. You could close this issue if you see fit.
(keywords cause I keep failing to search for this: dos line endings)
This is a recent regression, it was introduced sometime between and . I suspect is related, cc
The issue is that is being marked as a doc-comment:
I guess this means is being marked as a ? I don't see why it would.
My test was wrong.
This is not actually correct - it was a blank line in the original source code. The issue is that rustdoc used to strip in newlines, but no longer does. Here's 1.47: and 1.48:

Discussion:
} fn write_code(out: &mut String, src: &str) { <del> Classifier::new(src).highlight(&mut |highlight| { </del> <ins> // This replace allows to fix how the code source with DOS backline characters is displayed. let src = src.replace("rn", "n"); Classifier::new(&src).highlight(&mut |highlight| { </ins> match highlight { Highlight::Token { text, class } => string(out, Escape(text), class), Highlight::EnterSpan { class } => enter_span(out, class),

<ins> <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">foo</span>() { <span class="macro">println</span><span class="macro">!</span>(<span class="string">&quot;foo&quot;</span>); } </ins>

use super::write_code; use expect_test::expect_file; <del> #[test] fn test_html_highlighting() { let src = include_str!("fixtures/sample.rs"); let html = { let mut out = String::new(); write_code(&mut out, src); format!("{}<pre><code>{}</code></pre>n", STYLE, out) }; expect_file!["fixtures/sample.html"].assert_eq(&html); } </del> const STYLE: &str = r#" <style> .kw { color: #8959A8; }

.question-mark { color: #ff9011; } </style> "#; <ins> #[test] fn test_html_highlighting() { let src = include_str!("fixtures/sample.rs"); let html = { let mut out = String::new(); write_code(&mut out, src); format!("{}<pre><code>{}</code></pre>n", STYLE, out) }; expect_file!["fixtures/sample.html"].assert_eq(&html); } #[test] fn test_dos_backline() { let src = "pub fn foo() {rn println!("foo");rn }rn"; let mut html = String::new(); write_code(&mut html, src); expect_file!["fixtures/dos_line.html"].assert_eq(&html); } </ins>