diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-10-14 17:02:04 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-15 16:11:09 +0100 |
| commit | 1861a38ca9040c36741fb51f9b22f65228722b13 (patch) | |
| tree | 38e7001d752cf2edd616e32ab355a976940963d2 | |
| parent | 12f0dba618e761c987142474435dff95ab177f3c (diff) | |
| download | rust-1861a38ca9040c36741fb51f9b22f65228722b13.tar.gz rust-1861a38ca9040c36741fb51f9b22f65228722b13.zip | |
Ensure that the source code display is working with DOS backline
| -rw-r--r-- | src/librustdoc/html/highlight.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 4769edc50ff..98633733654 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -21,6 +21,8 @@ pub fn render_with_highlighting( playground_button: Option<&str>, tooltip: Option<(&str, &str)>, ) -> String { + // This replace allows to fix how the code source with DOS backline characters is displayed. + let src = src.replace("\r\n", "\n"); debug!("highlighting: ================\n{}\n==============", src); let mut out = String::with_capacity(src.len()); if let Some((tooltip, class)) = tooltip { |
