Skip to content

Commit f7886a6

Browse files
GuillaumeGomezpietroalbini
authored andcommitted
Ensure that the source code display is working with DOS backline
1 parent 2f3b6e1 commit f7886a6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustdoc/html/highlight.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pub fn render_with_highlighting(
2121
playground_button: Option<&str>,
2222
tooltip: Option<(&str, &str)>,
2323
) -> String {
24+
// This replace allows to fix how the code source with DOS backline characters is displayed.
25+
let src = src.replace("\r\n", "\n");
2426
debug!("highlighting: ================\n{}\n==============", src);
2527
let mut out = String::with_capacity(src.len());
2628
if let Some((tooltip, class)) = tooltip {

0 commit comments

Comments
 (0)